summaryrefslogtreecommitdiffstats
path: root/content/app
diff options
context:
space:
mode:
authoraberent@chromium.org <aberent@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-27 15:29:56 +0000
committeraberent@chromium.org <aberent@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-27 15:29:56 +0000
commit232e09d18fa339b9dcb49f30d2e919fe673da1c5 (patch)
treed1a7e8698c6a7fab8f3f7925a81760f18504d5f7 /content/app
parentdc0fd43f60f29a9167f90cf1559ce1adc17d9969 (diff)
downloadchromium_src-232e09d18fa339b9dcb49f30d2e919fe673da1c5.zip
chromium_src-232e09d18fa339b9dcb49f30d2e919fe673da1c5.tar.gz
chromium_src-232e09d18fa339b9dcb49f30d2e919fe673da1c5.tar.bz2
Allow overlapping sync and async startup requests
On Android we can get a second request to start the browser while the an asynchronous request is in progress. Since the second request may be synchronous, we may have switch to completing initialization synchronously. This patch handles this by tracking which initialization tasks have been run, and running the remaining initialization tasks. BUG=260574 Review URL: https://chromiumcodereview.appspot.com/22691002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@219795 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/app')
-rw-r--r--content/app/android/content_main.cc13
1 files changed, 9 insertions, 4 deletions
diff --git a/content/app/android/content_main.cc b/content/app/android/content_main.cc
index d89d4f2..bfc372f 100644
--- a/content/app/android/content_main.cc
+++ b/content/app/android/content_main.cc
@@ -38,10 +38,15 @@ static void InitApplicationContext(JNIEnv* env, jclass clazz, jobject context) {
static jint Start(JNIEnv* env, jclass clazz) {
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());
+ // 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());
+ }
return g_content_runner.Get()->Run();
}