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

Unified Diff: content/public/android/java/src/org/chromium/content/browser/AndroidBrowserProcess.java

Issue 19957002: Run the later parts of startup as UI thread tasks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Run the later parts of startup as UI thread tasks - patch for Yaron's comments Created 7 years, 5 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: content/public/android/java/src/org/chromium/content/browser/AndroidBrowserProcess.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/AndroidBrowserProcess.java b/content/public/android/java/src/org/chromium/content/browser/AndroidBrowserProcess.java
index bf046f9751525369b574e7c7195b943c0ef551f4..e485d5a2f02a690608dbc9bd5abf072754f38551 100644
--- a/content/public/android/java/src/org/chromium/content/browser/AndroidBrowserProcess.java
+++ b/content/public/android/java/src/org/chromium/content/browser/AndroidBrowserProcess.java
@@ -45,10 +45,14 @@ public class AndroidBrowserProcess {
* MAX_RENDERERS_SINGLE_PROCESS requests single-process mode where the renderer will run in the
* application process in a separate thread. The maximum number of allowed renderers is capped
* by MAX_RENDERERS_LIMIT.
- *
+ * @param mustBeImmediate true if initialization must be completed without creating additional
+ * UI tasks
+ * @param observer startup observer provides callback when startup complete. May be null if
+ * no callback is required.
* @return Whether the process actually needed to be initialized (false if already running).
*/
- public static boolean init(Context context, int maxRendererProcesses)
+ public static boolean init(Context context, int maxRendererProcesses, boolean mustBeImmediate,
+ StartupObserver observer)
throws ProcessInitException {
assert maxRendererProcesses >= 0;
assert maxRendererProcesses <= MAX_RENDERERS_LIMIT;
@@ -75,11 +79,22 @@ public class AndroidBrowserProcess {
nativeSetCommandLineFlags(maxRendererProcesses,
nativeIsPluginEnabled() ? getPlugins(context) : null);
ContentMain.initApplicationContext(appContext);
- int result = ContentMain.start();
+
+ int result = ContentMain.start(mustBeImmediate, observer);
if (result > 0) throw new ProcessInitException(result);
return true;
}
+ /*
+ * Old version of init, kept short term to simplify change to new version
+ * TODO (aberent) : remove this once callers updated.
+ */
+ @Deprecated
+ public static boolean init(Context context, int maxRendererProcesses)
+ throws ProcessInitException {
+ return init(context, maxRendererProcesses, true, null);
+ }
+
/**
* Initialization needed for tests. Mainly used by content browsertests.
*/

Powered by Google App Engine
This is Rietveld 408576698