diff options
author | Bo Liu <boliu@chromium.org> | 2015-05-20 17:40:11 -0700 |
---|---|---|
committer | Bo Liu <boliu@chromium.org> | 2015-05-21 00:40:47 +0000 |
commit | 3471abed9e5821f71fb4c87f0f3980ecccae7b3e (patch) | |
tree | 023fbea25dfb72c37c2f0911a895c6f0f1092f8a | |
parent | 7645c1992694c43390dcfb743bb44aa7cdc9bbff (diff) | |
download | chromium_src-3471abed9e5821f71fb4c87f0f3980ecccae7b3e.zip chromium_src-3471abed9e5821f71fb4c87f0f3980ecccae7b3e.tar.gz chromium_src-3471abed9e5821f71fb4c87f0f3980ecccae7b3e.tar.bz2 |
branch 2357: Check for destroyed WebView before adding a callback in didNavigateMainFrame
Check to make sure at the time that didNavigateMainFrame occurs that
the WebView is not destroyed (in which case skip registering the
visual state listener callback for onPageCommitVisible).
BUG=481534
Review URL: https://codereview.chromium.org/1109833002
Cr-Commit-Position: refs/heads/master@{#327062}
(cherry picked from commit 46473984c6887c2a7b5a8602ef5526e6d16b06ec)
TBR=tobiasjs@chromium.org
Review URL: https://codereview.chromium.org/1146303002
Cr-Commit-Position: refs/branch-heads/2357@{#423}
Cr-Branched-From: 59d4494849b405682265ed5d3f5164573b9a939b-refs/heads/master@{#323860}
-rw-r--r-- | android_webview/java/src/org/chromium/android_webview/AwContents.java | 7 | ||||
-rw-r--r-- | android_webview/java/src/org/chromium/android_webview/AwWebContentsObserver.java | 17 |
2 files changed, 16 insertions, 8 deletions
diff --git a/android_webview/java/src/org/chromium/android_webview/AwContents.java b/android_webview/java/src/org/chromium/android_webview/AwContents.java index 7011daf..226e651 100644 --- a/android_webview/java/src/org/chromium/android_webview/AwContents.java +++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java @@ -2619,6 +2619,13 @@ public class AwContents implements SmartClipProvider, }); } + protected void insertVisualStateCallbackIfNotDestroyed( + long requestId, VisualStateCallback callback) { + if (TRACE) Log.d(TAG, "insertVisualStateCallbackIfNotDestroyed"); + if (isDestroyed()) return; + nativeInsertVisualStateCallback(mNativeAwContents, requestId, callback); + } + // -------------------------------------------------------------------------------------------- // This is the AwViewMethods implementation that does real work. The AwViewMethodsImpl is // hooked up to the WebView in embedded mode and to the FullScreenView in fullscreen mode, diff --git a/android_webview/java/src/org/chromium/android_webview/AwWebContentsObserver.java b/android_webview/java/src/org/chromium/android_webview/AwWebContentsObserver.java index de5dfb1..ec722f6 100644 --- a/android_webview/java/src/org/chromium/android_webview/AwWebContentsObserver.java +++ b/android_webview/java/src/org/chromium/android_webview/AwWebContentsObserver.java @@ -68,14 +68,15 @@ public class AwWebContentsObserver extends WebContentsObserver { public void run() { AwContents awContents = mAwContents.get(); if (awContents != null) { - awContents.insertVisualStateCallback(0, new VisualStateCallback() { - @Override - public void onComplete(long requestId) { - AwContentsClient client = mAwContentsClient.get(); - if (client == null) return; - client.onPageCommitVisible(url); - } - }); + awContents.insertVisualStateCallbackIfNotDestroyed( + 0, new VisualStateCallback() { + @Override + public void onComplete(long requestId) { + AwContentsClient client = mAwContentsClient.get(); + if (client == null) return; + client.onPageCommitVisible(url); + } + }); } } }); |