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

Unified Diff: content/app/android/content_main.cc

Issue 22691002: Allow overlapping sync and async startup requests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Allow multiple overlapping startup requests - update to merge with nyquist@'s patch Created 7 years, 4 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..08a21bfa562cb0a969e74fed0c082d7422a7c9e6 100644
--- a/content/app/android/content_main.cc
+++ b/content/app/android/content_main.cc
@@ -35,14 +35,19 @@ static void InitApplicationContext(JNIEnv* env, jclass clazz, jobject context) {
base::android::InitApplicationContext(scoped_context);
}
-static jint Start(JNIEnv* env, jclass clazz) {
+static void Start(JNIEnv* env, jclass clazz) {
Yaron 2013/08/22 06:00:26 Doesn't this hide potential errors? I thought we h
aberent 2013/08/23 11:40:21 Not any more. The only places such errors can come
TRACE_EVENT0("startup", "content::Start");
- 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());
- return g_content_runner.Get()->Run();
+ // On Android we can have multiple requests to start the browser in process
+ // simultaneously. If we get an asynchonous request followed by a synchronous
+ // request then we have to call this a second time to finish starting the
+ // browser synchronously.
+ if (!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());
+ }
+ g_content_runner.Get()->Run();
}
void SetContentMainDelegate(ContentMainDelegate* delegate) {

Powered by Google App Engine
This is Rietveld 408576698