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

Unified Diff: content/public/android/java/src/org/chromium/content/browser/BrowserStartupConfig.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 - Jam's nits 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/BrowserStartupConfig.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/BrowserStartupConfig.java b/content/public/android/java/src/org/chromium/content/browser/BrowserStartupConfig.java
new file mode 100644
index 0000000000000000000000000000000000000000..f784c7a678ddc286d984368f63cbd93f70c8f33f
--- /dev/null
+++ b/content/public/android/java/src/org/chromium/content/browser/BrowserStartupConfig.java
@@ -0,0 +1,43 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.content.browser;
+
+import org.chromium.base.CalledByNative;
+import org.chromium.base.JNINamespace;
+/**
+ * This class controls how C++ browser main loop is run.
+ */
+@JNINamespace("content")
+public class BrowserStartupConfig {
+ public interface StartupCallback {
+ void run(int startupResult);
+ }
+
+ private static boolean sBrowserMayStartAsynchronously = false;
+ private static StartupCallback sBrowserStartupCompleteCallback = null;
+
+ @CalledByNative
+ private static boolean browserMayStartAsynchonously() {
+ return sBrowserMayStartAsynchronously;
+ }
+
+ @CalledByNative
+ private static void browserStartupComplete(int result) {
+ if(sBrowserStartupCompleteCallback != null) {
+ sBrowserStartupCompleteCallback.run(result);
+ }
+ }
+
+ /**
+ * Set browser to start asynchronously. May only be called before contentMain.start(). If it
+ * has been called then contentMain.start() will queue up a series of UI tasks to complete
+ * browser initialization.
+ * @param browserStartupCompleteCallback If not null called when browser startup is complete.
+ */
+ public static void setAsync(StartupCallback browserStartupCompleteCallback) {
+ sBrowserMayStartAsynchronously = true;
+ sBrowserStartupCompleteCallback = browserStartupCompleteCallback;
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698