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

Unified Diff: chrome/app/android/chrome_main_delegate_android.cc

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 Joth'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: chrome/app/android/chrome_main_delegate_android.cc
diff --git a/chrome/app/android/chrome_main_delegate_android.cc b/chrome/app/android/chrome_main_delegate_android.cc
index 81f402936423b81d476b4374b57b0c7181c80c94..a1022e4b3709474d889e7776e9da445cde600ee6 100644
--- a/chrome/app/android/chrome_main_delegate_android.cc
+++ b/chrome/app/android/chrome_main_delegate_android.cc
@@ -6,6 +6,7 @@
#include "base/android/jni_android.h"
#include "base/debug/trace_event.h"
+#include "base/memory/scoped_ptr.h"
#include "chrome/browser/android/chrome_jni_registrar.h"
#include "chrome/browser/android/chrome_startup_flags.h"
#include "content/public/browser/browser_main_runner.h"
@@ -13,8 +14,8 @@
// ChromeMainDelegateAndroid is created when the library is loaded. It is always
// done in the process's main Java thread. But for non browser process, e.g.
// renderer process, it is not the native Chrome's main thread.
-ChromeMainDelegateAndroid::ChromeMainDelegateAndroid() {
-}
+ChromeMainDelegateAndroid::ChromeMainDelegateAndroid()
+ : incremental_startup_enabled_(false) {}
ChromeMainDelegateAndroid::~ChromeMainDelegateAndroid() {
}
@@ -33,7 +34,17 @@ int ChromeMainDelegateAndroid::RunProcess(
RegisterApplicationNativeMethods(env);
browser_runner_.reset(content::BrowserMainRunner::Create());
- return browser_runner_->Initialize(main_function_params);
+
+ // For Chrome on android we want to run the startup tasks incrementally, so
Yaron 2013/07/23 02:14:03 Any reason not to do this on testshell as well and
aberent 2013/07/23 13:45:03 This has to be conditional, since there are a numb
+ // that UI tasks can get in in-between.
+ content::StartupTaskRunner::StartupMode mode =
+ incremental_startup_enabled_ ? content::StartupTaskRunner::INCREMENTAL
+ : content::StartupTaskRunner::IMMEDIATE;
+ scoped_refptr<content::StartupTaskRunner> startup_task_runner(
+ new content::StartupTaskRunner(mode, GetStartupObserver()));
+
+ return browser_runner_->Initialize(main_function_params,
+ startup_task_runner);
}
return ChromeMainDelegate::RunProcess(process_type, main_function_params);
@@ -47,3 +58,7 @@ bool ChromeMainDelegateAndroid::BasicStartupComplete(int* exit_code) {
bool ChromeMainDelegateAndroid::RegisterApplicationNativeMethods(JNIEnv* env) {
return chrome::android::RegisterJni(env);
}
+
+void ChromeMainDelegateAndroid::EnableIncrementalStartup(bool enable) {
+ incremental_startup_enabled_ = enable;
+}

Powered by Google App Engine
This is Rietveld 408576698