Improve renderer process crash handling in EWK.
authorPiotr Tworek <p.tworek@samsung.com>
Thu, 14 May 2015 09:32:28 +0000 (11:32 +0200)
committerYoungsoo Choi <kenshin.choi@samsung.com>
Tue, 10 Jul 2018 06:57:09 +0000 (06:57 +0000)
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 <p.tworek@samsung.com>
tizen_src/ewk/efl_integration/eweb_view.cc
tizen_src/ewk/efl_integration/eweb_view.h

index 5d5ed5a..5421252 100644 (file)
@@ -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<EWebViewCallbacks::WebProcessCrashed>().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);
index a4524af..bbbe852 100644 (file)
@@ -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();