Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(216)

Unified Diff: content/browser/android/content_view_core_impl.cc

Issue 331353008: Fix the crash when swap the WebContents with power save blocker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sync Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/android/content_view_core_impl.cc
diff --git a/content/browser/android/content_view_core_impl.cc b/content/browser/android/content_view_core_impl.cc
index c91af2e030d6eca1c1c536ed0f46913fe436e4f8..c40460ce2d296643fb59c34e10050ad0f75b6aec 100644
--- a/content/browser/android/content_view_core_impl.cc
+++ b/content/browser/android/content_view_core_impl.cc
@@ -272,6 +272,15 @@ void ContentViewCoreImpl::OnJavaContentViewCoreDestroyed(JNIEnv* env,
jobject obj) {
DCHECK(env->IsSameObject(java_ref_.get(env).obj(), obj));
java_ref_.reset();
+ // Java peer has gone, ContentViewCore is not functional and waits to
+ // be destroyed with WebContents.
+ // We need to reset WebContentsViewAndroid's reference, otherwise, there
+ // could have call in when swapping the WebContents,
+ // see http://crbug.com/383939 .
+ DCHECK(web_contents_);
+ static_cast<WebContentsViewAndroid*>(
+ static_cast<WebContentsImpl*>(web_contents_)->GetView())->
+ SetContentViewCore(NULL);
}
void ContentViewCoreImpl::InitWebContents() {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698