summaryrefslogtreecommitdiff
path: root/core/java/android/webkit/WebViewClient.java
diff options
context:
space:
mode:
authorTao Bai <michaelbai@google.com>2016-11-16 15:21:40 -0800
committerTao Bai <michaelbai@google.com>2016-12-16 10:33:37 -0800
commitc53fae1001035a042aaae00d337f730a09de4566 (patch)
tree98d6706d41b850c4206d2b1d1c91f79220d3398b /core/java/android/webkit/WebViewClient.java
parent03c403d273e1c265b141504a44da22bae48a4493 (diff)
WebView: Add the definition of crash API.
Bug: 30824898 Test: There is no test yet, this patch just add the defintion of API, and make it easy to work on chromium side. Change-Id: I7fdaf894f18cc8bad8e84465e4a0390b22f8bba8
Diffstat (limited to 'core/java/android/webkit/WebViewClient.java')
-rw-r--r--core/java/android/webkit/WebViewClient.java27
1 files changed, 27 insertions, 0 deletions
diff --git a/core/java/android/webkit/WebViewClient.java b/core/java/android/webkit/WebViewClient.java
index 76d3fb15d049..8703468a74a7 100644
--- a/core/java/android/webkit/WebViewClient.java
+++ b/core/java/android/webkit/WebViewClient.java
@@ -466,4 +466,31 @@ public class WebViewClient {
public void onReceivedLoginRequest(WebView view, String realm,
String account, String args) {
}
+
+ /**
+ * Notify host application that the given webview's render process has exited.
+ *
+ * Multiple WebView instances may be associated with a single render process;
+ * onRenderProcessGone will be called for each WebView that was affected.
+ * The application's implementation of this callback should only attempt to
+ * clean up the specific WebView given as a parameter, and should not assume
+ * that other WebView instances are affected.
+ *
+ * The given WebView can't be used, and should be removed from the view hierarchy,
+ * all references to it should be cleaned up, e.g any references in the Activity
+ * or other classes saved using findViewById and similar calls, etc
+ *
+ * To cause an render process crash for test purpose, the application can
+ * call loadUrl("chrome://crash") on the WebView. Note that multiple WebView
+ * instances may be affected if they share a render process, not just the
+ * specific WebView which loaded chrome://crash.
+ *
+ * @param view The WebView which needs to be cleaned up.
+ * @param detail the reason why it exited.
+ * @return true if the host application handled the situation that process has
+ * exited, otherwise, application will crash.
+ */
+ public boolean onRenderProcessGone(WebView view, RenderProcessGoneDetail detail) {
+ return false;
+ }
}