Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cde7efde authored by Ben Murdoch's avatar Ben Murdoch Committed by Android Git Automerger
Browse files

am a95e9da7: Merge "Make the WebCore thread watchdog opt in." into jb-dev

* commit 'a95e9da7':
  Make the WebCore thread watchdog opt in.
parents af239b5f a95e9da7
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -8494,6 +8494,11 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
        mWebView.postInvalidate();
        mWebView.postInvalidate();
    }
    }


    // Note: must be called before first WebViewClassic is created.
    public static void setShouldMonitorWebCoreThread() {
        WebViewCore.setShouldMonitorWebCoreThread();
    }

    private native void     nativeCreate(int ptr, String drawableDir, boolean isHighEndGfx);
    private native void     nativeCreate(int ptr, String drawableDir, boolean isHighEndGfx);
    private native void     nativeDebugDump();
    private native void     nativeDebugDump();
    private native void     nativeDestroy();
    private native void     nativeDestroy();
+16 −3
Original line number Original line Diff line number Diff line
@@ -144,6 +144,11 @@ public final class WebViewCore {
    private int mChromeCanFocusDirection;
    private int mChromeCanFocusDirection;
    private int mTextSelectionChangeReason = TextSelectionData.REASON_UNKNOWN;
    private int mTextSelectionChangeReason = TextSelectionData.REASON_UNKNOWN;


    // Used to determine if we should monitor the WebCore thread for responsiveness.
    // If it "hangs", for example a web page enters a while(true) loop, we will
    // prompt the user with a dialog allowing them to terminate the process.
    private static boolean sShouldMonitorWebCoreThread;

    // The thread name used to identify the WebCore thread and for use in
    // The thread name used to identify the WebCore thread and for use in
    // debugging other classes that require operation within the WebCore thread.
    // debugging other classes that require operation within the WebCore thread.
    /* package */ static final String THREAD_NAME = "WebViewCoreThread";
    /* package */ static final String THREAD_NAME = "WebViewCoreThread";
@@ -176,10 +181,14 @@ public final class WebViewCore {
                    Log.e(LOGTAG, Log.getStackTraceString(e));
                    Log.e(LOGTAG, Log.getStackTraceString(e));
                }
                }


                if (sShouldMonitorWebCoreThread) {
                    // Start the singleton watchdog which will monitor the WebCore thread
                    // Start the singleton watchdog which will monitor the WebCore thread
                // to verify it's still processing messages.
                    // to verify it's still processing messages. Note that this is the only
                    // time we need to check the value as all the other public methods on
                    // the WebCoreThreadWatchdog are no-ops if start() is not called.
                    WebCoreThreadWatchdog.start(sWebCoreHandler);
                    WebCoreThreadWatchdog.start(sWebCoreHandler);
                }
                }
            }
            // Make sure the Watchdog is aware of this new WebView.
            // Make sure the Watchdog is aware of this new WebView.
            WebCoreThreadWatchdog.registerWebView(w);
            WebCoreThreadWatchdog.registerWebView(w);
        }
        }
@@ -3061,6 +3070,10 @@ public final class WebViewCore {
        return mDeviceOrientationService;
        return mDeviceOrientationService;
    }
    }


    static void setShouldMonitorWebCoreThread() {
        sShouldMonitorWebCoreThread = true;
    }

    private native void nativeSetIsPaused(int nativeClass, boolean isPaused);
    private native void nativeSetIsPaused(int nativeClass, boolean isPaused);
    private native void nativePause(int nativeClass);
    private native void nativePause(int nativeClass);
    private native void nativeResume(int nativeClass);
    private native void nativeResume(int nativeClass);