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

Unified Diff: android_webview/java/src/org/chromium/android_webview/AwBrowserProcess.java

Issue 1378653002: [Android] Enable ApplicationStatus for WebView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add intial sCachedApplicationState Created 5 years, 2 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/java/src/org/chromium/android_webview/AwBrowserProcess.java
diff --git a/android_webview/java/src/org/chromium/android_webview/AwBrowserProcess.java b/android_webview/java/src/org/chromium/android_webview/AwBrowserProcess.java
index 0989339b969783fb484cf3eec493e0da9250c82c..35bb81ed96d516a924431fa1a3cb0ccd44142413 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwBrowserProcess.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwBrowserProcess.java
@@ -4,8 +4,10 @@
package org.chromium.android_webview;
+import android.app.Application;
import android.content.Context;
+import org.chromium.base.ApplicationStatus;
import org.chromium.base.CommandLine;
import org.chromium.base.PathUtils;
import org.chromium.base.ThreadUtils;
@@ -46,14 +48,19 @@ public abstract class AwBrowserProcess {
* and performs other per-app resource allocations; must not be called from zygote.
* Note: it is up to the caller to ensure this is only called once.
* @param context The Android application context
+ * @param application The Android application. Used to enable ApplicationStatus, if
+ * null the ApplicationStatus is not enabled.
*/
- public static void start(final Context context) {
+ public static void start(final Context context, final Application application) {
// We must post to the UI thread to cover the case that the user
// has invoked Chromium startup by using the (thread-safe)
// CookieManager rather than creating a WebView.
ThreadUtils.runOnUiThreadBlocking(new Runnable() {
@Override
public void run() {
+ if (application != null) {
+ ApplicationStatus.initializeActivityIndependent(application, context);
+ }
try {
BrowserStartupController.get(context, LibraryProcessType.PROCESS_WEBVIEW)
.startBrowserProcessesSync(!CommandLine.getInstance().hasSwitch(
@@ -64,4 +71,11 @@ public abstract class AwBrowserProcess {
}
});
}
+
+ /**
+ * Same as {@link #start(Context, Application)} except it does not enable ApplicationStatus.
+ */
+ public static void start(final Context context) {
+ start(context, null);
+ }
}

Powered by Google App Engine
This is Rietveld 408576698