summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfeng@chromium.org <feng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-04 02:01:09 +0000
committerfeng@chromium.org <feng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-04 02:01:09 +0000
commit822e2eb2d8a2b5edf674a629af9af4129d0215e0 (patch)
tree5bb7f5f59e1650bcc4b23ab8abd52bc976ec8b06
parent4cd1f5633ea262ac5ad200b6ad004c6f7516e343 (diff)
downloadchromium_src-822e2eb2d8a2b5edf674a629af9af4129d0215e0.zip
chromium_src-822e2eb2d8a2b5edf674a629af9af4129d0215e0.tar.gz
chromium_src-822e2eb2d8a2b5edf674a629af9af4129d0215e0.tar.bz2
Merge 247878 "android: Fix ContentViewCore and RenderWidgetHostV..."
> android: Fix ContentViewCore and RenderWidgetHostViewAndroid lifetime issue > > https://codereview.chromium.org/26753005/ might have introduced crashes that > trace to SetContentViewCore. That previous patch assumed that ContentViewCore > (CVC) always outlives its associated RenderWidgetHostView. In this patch, we > are trying to ensure that the RWHVA pointer to CVC is nulled when CVC is > destroyed. > > Note the following: > - WebContents owns ContentViewCore and WebContentsView. > - CVC and WebContentsView are implicitly destroyed (no direct call to clean-up > code). So ContentViewCore cannot refer to WebContents or WebContentsView in > its destructor. > > Therefore, we use the observer of when WebContents is destroyed to start the > clean up on CVC. > > > BUG=335165, 324341 > > Review URL: https://codereview.chromium.org/133073012 TBR=powei@chromium.org Review URL: https://codereview.chromium.org/152763003 git-svn-id: svn://svn.chromium.org/chrome/branches/1750/src@248661 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/browser/android/content_view_core_impl.cc7
-rw-r--r--content/browser/android/content_view_core_impl.h1
2 files changed, 8 insertions, 0 deletions
diff --git a/content/browser/android/content_view_core_impl.cc b/content/browser/android/content_view_core_impl.cc
index 1de255e..dfb8c10 100644
--- a/content/browser/android/content_view_core_impl.cc
+++ b/content/browser/android/content_view_core_impl.cc
@@ -1652,6 +1652,13 @@ void ContentViewCoreImpl::OnSmartClipDataExtracted(const string16& result) {
env, obj.obj(), jresult.obj());
}
+void ContentViewCoreImpl::WebContentsDestroyed(WebContents* web_contents) {
+ WebContentsViewAndroid* wcva =
+ static_cast<WebContentsViewAndroid*>(web_contents->GetView());
+ DCHECK(wcva);
+ wcva->SetContentViewCore(NULL);
+}
+
// This is called for each ContentView.
jlong Init(JNIEnv* env, jobject obj,
jboolean hardware_accelerated,
diff --git a/content/browser/android/content_view_core_impl.h b/content/browser/android/content_view_core_impl.h
index f34d42d..5c61ae6 100644
--- a/content/browser/android/content_view_core_impl.h
+++ b/content/browser/android/content_view_core_impl.h
@@ -329,6 +329,7 @@ class ContentViewCoreImpl : public ContentViewCore,
// WebContentsObserver implementation.
virtual void RenderViewReady() OVERRIDE;
+ virtual void WebContentsDestroyed(WebContents* web_contents) OVERRIDE;
// --------------------------------------------------------------------------
// Other private methods and data