Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2326)

Unified Diff: android_webview/glue/java/src/com/android/webview/chromium/WebViewDelegateFactory.java

Issue 2645413002: Prepare to get the multiprocess setting from WebViewDelegate. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: android_webview/glue/java/src/com/android/webview/chromium/WebViewDelegateFactory.java
diff --git a/android_webview/glue/java/src/com/android/webview/chromium/WebViewDelegateFactory.java b/android_webview/glue/java/src/com/android/webview/chromium/WebViewDelegateFactory.java
index c2b42958ed57e707d572f8b6e0bcb95b8d528c1e..0bb5c16f2efbb23b1d71fca7d710ff0ee0019726 100644
--- a/android_webview/glue/java/src/com/android/webview/chromium/WebViewDelegateFactory.java
+++ b/android_webview/glue/java/src/com/android/webview/chromium/WebViewDelegateFactory.java
@@ -14,9 +14,12 @@ import android.content.res.Resources;
import android.graphics.Canvas;
import android.os.Build;
import android.os.Trace;
+import android.provider.Settings;
import android.util.SparseArray;
import android.view.View;
+import org.chromium.base.ContextUtils;
+
import java.lang.reflect.Method;
/**
@@ -82,6 +85,9 @@ class WebViewDelegateFactory {
/** @see android.webkit.WebViewDelegate#addWebViewAssetPath */
void addWebViewAssetPath(Context context);
+
+ /** @see android.webkit.WebViewDelegate#isMultiProcessEnabled */
+ boolean isMultiProcessEnabled();
}
/**
@@ -110,7 +116,7 @@ class WebViewDelegateFactory {
* A {@link WebViewDelegate com.android.webview.chromium.WebViewDelegate} that proxies requests
* to a {@link android.webkit.WebViewDelegate android.webkit.WebViewDelegate}.
*/
- private static class ProxyDelegate implements WebViewDelegate {
+ static class ProxyDelegate implements WebViewDelegate {
boliu 2017/01/23 16:34:18 does protected work here too..?
Torne 2017/01/23 17:27:30 Likewise no point.
android.webkit.WebViewDelegate mDelegate;
ProxyDelegate(android.webkit.WebViewDelegate delegate) {
@@ -198,6 +204,16 @@ class WebViewDelegateFactory {
}
});
}
+
+ @Override
+ public boolean isMultiProcessEnabled() {
+ // Multiprocess requires N or later.
boliu 2017/01/23 16:34:18 I suppose this class was never meant to contain im
Torne 2017/01/23 17:27:30 I was considering renaming it to Api22AndUpDelegat
boliu 2017/01/23 17:44:04 Err, no :p I meant at callsite, have a if <= N, d
Torne 2017/01/24 11:24:01 I think that's a better idea actually; I'll do it
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) return false;
+
+ // Check the multiprocess developer setting.
+ return Settings.Global.getInt(ContextUtils.getApplicationContext().getContentResolver(),
+ Settings.Global.WEBVIEW_MULTIPROCESS, 0) == 1;
+ }
}
/**
@@ -383,5 +399,10 @@ class WebViewDelegateFactory {
throw new RuntimeException("Invalid reflection", e);
}
}
+
+ @Override
+ public boolean isMultiProcessEnabled() {
+ return false;
+ }
}
}

Powered by Google App Engine
This is Rietveld 408576698