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

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 - minor comment fixes 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..9c8d47ce83055161e288474dfe7dc7e0390180b8 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,13 @@ 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
joth 2013/07/22 16:28:15 nit: i think convention is to indent this (to alig
aberent 2013/07/22 19:37:40 Done.
+ * @param observer startup observer provides callback when startup complete
* @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 +78,27 @@ public class AndroidBrowserProcess {
nativeSetCommandLineFlags(maxRendererProcesses,
nativeIsPluginEnabled() ? getPlugins(context) : null);
ContentMain.initApplicationContext(appContext);
- int result = ContentMain.start();
+
+ if(observer == null) {
joth 2013/07/22 16:28:15 nit: you could make the Aw caller just pass null i
aberent 2013/07/22 19:37:40 Done. I was worried about whether null checks woul
+ // Create a default observer that does nothing
+ observer = new StartupObserver();
+ }
+
+ 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