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

Unified Diff: content/app/android/content_main.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: content/app/android/content_main.cc
diff --git a/content/app/android/content_main.cc b/content/app/android/content_main.cc
index d89d4f21c6959e6ea172d98fe0d488b2b5a112d8..2bd97edb1fb04ce8c6c5507a55ee6577b2bb5a1a 100644
--- a/content/app/android/content_main.cc
+++ b/content/app/android/content_main.cc
@@ -9,6 +9,7 @@
#include "base/command_line.h"
#include "base/debug/trace_event.h"
#include "base/lazy_instance.h"
+#include "content/browser/android/android_startup_observer.h"
#include "content/public/app/content_main.h"
#include "content/public/app/content_main_delegate.h"
#include "content/public/app/content_main_runner.h"
@@ -35,13 +36,28 @@ static void InitApplicationContext(JNIEnv* env, jclass clazz, jobject context) {
base::android::InitApplicationContext(scoped_context);
}
-static jint Start(JNIEnv* env, jclass clazz) {
+static jint Start(JNIEnv* env,
+ jclass clazz,
+ jboolean immediate_startup,
+ jobject java_startup_observer) {
TRACE_EVENT0("startup", "content::Start");
+ java_startup_observer = env->NewGlobalRef(java_startup_observer);
+
DCHECK(!g_content_runner.Get().get());
g_content_runner.Get().reset(ContentMainRunner::Create());
- g_content_runner.Get()->Initialize(0, NULL,
- g_content_main_delegate.Get().get());
+
+ ContentMainDelegate* delegate = g_content_main_delegate.Get().get();
+
+ if(java_startup_observer != NULL){
+ scoped_ptr<StartupTaskRunner::Observer> startup_observer(
+ new AndroidStartupObserver(java_startup_observer));
+ delegate->SetStartupObserver(startup_observer.Pass());
+ }
+ delegate->EnableIncrementalStartup(!immediate_startup);
+
+ g_content_runner.Get()
+ ->Initialize(0, NULL, g_content_main_delegate.Get().get());
return g_content_runner.Get()->Run();
}

Powered by Google App Engine
This is Rietveld 408576698