diff options
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/webkit/WebViewClassic.java | 5 | ||||
| -rw-r--r-- | core/java/android/webkit/WebViewCore.java | 19 |
2 files changed, 21 insertions, 3 deletions
diff --git a/core/java/android/webkit/WebViewClassic.java b/core/java/android/webkit/WebViewClassic.java index 9f8771c5355e..f03fb86a6b64 100644 --- a/core/java/android/webkit/WebViewClassic.java +++ b/core/java/android/webkit/WebViewClassic.java @@ -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(); diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java index af7914e3f29a..ba42ff5181bd 100644 --- a/core/java/android/webkit/WebViewCore.java +++ b/core/java/android/webkit/WebViewCore.java @@ -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,9 +181,13 @@ public final class WebViewCore { Log.e(LOGTAG, Log.getStackTraceString(e)); } - // Start the singleton watchdog which will monitor the WebCore thread - // to verify it's still processing messages. - WebCoreThreadWatchdog.start(sWebCoreHandler); + if (sShouldMonitorWebCoreThread) { + // Start the singleton watchdog which will monitor the WebCore thread + // 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); |
