From eed46bd4a665dc6c7e7a023ffadeef86b093674e Mon Sep 17 00:00:00 2001 From: Piotr Tworek Date: Thu, 14 May 2015 11:32:28 +0200 Subject: [PATCH] Improve renderer process crash handling in EWK. Since the refactoring removed a lot of unnecessary inter dependencies between EWK and content layers we no longer need to re-create WebContents each time the renderer process has crashed. On UI process side renderer process is only represented by the RenderWidgetHostView class. This fix brings a big benefit of not loosing browsing history whenever renderer process crashes. Such state is associated with WebContents not RWHV. This patch also includes additional bug fix which makes sure LoadHTMLString function is not called directly from a callback informing us about a crash. Calling any load method directly from the crash callback triggers a DCHECK in mojo code when renderer process crashes multiple times for the same WebContents instance. Reviewed by: Antonio Gomes, SeungSeop Park, Youngha Jung Change-Id: Id220b563bea90e6dedd0b55a26ef856fb1528069 Signed-off-by: Piotr Tworek --- tizen_src/ewk/efl_integration/eweb_view.cc | 11 ++++++++--- tizen_src/ewk/efl_integration/eweb_view.h | 1 + 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/tizen_src/ewk/efl_integration/eweb_view.cc b/tizen_src/ewk/efl_integration/eweb_view.cc index 5d5ed5a..5421252 100644 --- a/tizen_src/ewk/efl_integration/eweb_view.cc +++ b/tizen_src/ewk/efl_integration/eweb_view.cc @@ -2157,9 +2157,8 @@ bool EWebView::StopInspectorServer() { return true; } -void EWebView::HandleRendererProcessCrash() { - InitializeContent(); - +void EWebView::InvokeWebProcessCrashedCallback() { + DCHECK_CURRENTLY_ON(BrowserThread::UI); const char* last_url = GetURL(); bool callback_handled = false; SmartCallback().call(&callback_handled); @@ -2167,6 +2166,12 @@ void EWebView::HandleRendererProcessCrash() { LoadHTMLString(kRendererCrashedHTMLMessage, NULL, last_url); } +void EWebView::HandleRendererProcessCrash() { + BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, + base::Bind(&EWebView::InvokeWebProcessCrashedCallback, + base::Unretained(this))); +} + void EWebView::InitializeContent() { int width, height; evas_object_geometry_get(evas_object_, 0, 0, &width, &height); diff --git a/tizen_src/ewk/efl_integration/eweb_view.h b/tizen_src/ewk/efl_integration/eweb_view.h index a4524af..bbbe852 100644 --- a/tizen_src/ewk/efl_integration/eweb_view.h +++ b/tizen_src/ewk/efl_integration/eweb_view.h @@ -466,6 +466,7 @@ class EWebView { bool HandleTextSelectionUp(int x, int y); void HandleRendererProcessCrash(); + void InvokeWebProcessCrashedCallback(); void HandlePostponedGesture(int x, int y, ui::EventType type); private: void InitializeContent(); -- 2.7.4