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(); |
} |