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

Commit a95e9da7 authored by Ben Murdoch's avatar Ben Murdoch Committed by Android (Google) Code Review
Browse files

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

parents fd824487 2b5d6682
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -8494,6 +8494,11 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
        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     nativeDebugDump();
    private native void     nativeDestroy();
+16 −3
Original line number Diff line number Diff line
@@ -144,6 +144,11 @@ public final class WebViewCore {
    private int mChromeCanFocusDirection;
    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
    // debugging other classes that require operation within the WebCore thread.
    /* package */ static final String THREAD_NAME = "WebViewCoreThread";
@@ -176,10 +181,14 @@ public final class WebViewCore {
                    Log.e(LOGTAG, Log.getStackTraceString(e));
                }

                if (sShouldMonitorWebCoreThread) {
                    // 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);
                }
            }
            // Make sure the Watchdog is aware of this new WebView.
            WebCoreThreadWatchdog.registerWebView(w);
        }
@@ -3061,6 +3070,10 @@ public final class WebViewCore {
        return mDeviceOrientationService;
    }

    static void setShouldMonitorWebCoreThread() {
        sShouldMonitorWebCoreThread = true;
    }

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