diff options
author | yfriedman@chromium.org <yfriedman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-23 20:36:36 +0000 |
---|---|---|
committer | yfriedman@chromium.org <yfriedman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-23 20:36:36 +0000 |
commit | 2789ef864c34809072799238e0af41c5ea9783fb (patch) | |
tree | 4a741964137b0469ca0104bc5244ba9af4451295 /content/browser/android | |
parent | 8d9317254ae5a9044bcb5e454139be1422b50ad4 (diff) | |
download | chromium_src-2789ef864c34809072799238e0af41c5ea9783fb.zip chromium_src-2789ef864c34809072799238e0af41c5ea9783fb.tar.gz chromium_src-2789ef864c34809072799238e0af41c5ea9783fb.tar.bz2 |
Enable sad tab for Android renderer crashes.
Review URL: https://codereview.chromium.org/11240004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@163666 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/android')
-rw-r--r-- | content/browser/android/content_view_core_impl.cc | 21 | ||||
-rw-r--r-- | content/browser/android/content_view_core_impl.h | 2 |
2 files changed, 22 insertions, 1 deletions
diff --git a/content/browser/android/content_view_core_impl.cc b/content/browser/android/content_view_core_impl.cc index bd4137a..e86d70d 100644 --- a/content/browser/android/content_view_core_impl.cc +++ b/content/browser/android/content_view_core_impl.cc @@ -295,6 +295,27 @@ void ContentViewCoreImpl::Hide() { GetWebContents()->WasHidden(); } +void ContentViewCoreImpl::OnTabCrashed() { + // if tab_crashed_ is already true, just return. e.g. if two tabs share the + // render process, this will be called for each tab when the render process + // crashed. If user reload one tab, a new render process is created. It can be + // shared by the other tab. But if user closes the tab before reload the other + // tab, the new render process will be shut down. This will trigger the other + // tab's OnTabCrashed() called again as two tabs share the same + // BrowserRenderProcessHost. + if (tab_crashed_) + return; + tab_crashed_ = true; + // This can happen as WebContents is destroyed after java_object_ is set to 0 + if (!java_object_) + return; + JNIEnv* env = AttachCurrentThread(); + ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); + if (obj.is_null()) + return; + Java_ContentViewCore_onTabCrash(env, obj.obj()); +} + void ContentViewCoreImpl::UpdateContentSize(int width, int height) { JNIEnv* env = AttachCurrentThread(); ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); diff --git a/content/browser/android/content_view_core_impl.h b/content/browser/android/content_view_core_impl.h index ccc56af..e2066a8 100644 --- a/content/browser/android/content_view_core_impl.h +++ b/content/browser/android/content_view_core_impl.h @@ -192,7 +192,7 @@ class ContentViewCoreImpl : public ContentViewCore, int selected_item, bool multiple); - void OnTabCrashed(const base::ProcessHandle handle); + void OnTabCrashed(); void UpdateContentSize(int width, int height); void UpdateScrollOffsetAndPageScaleFactor(int x, int y, float scale); void UpdatePageScaleLimits(float minimum_scale, float maximum_scale); |