OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/app/android/content_main.h" | 5 #include "content/app/android/content_main.h" |
6 | 6 |
7 #include "base/at_exit.h" | 7 #include "base/at_exit.h" |
8 #include "base/base_switches.h" | 8 #include "base/base_switches.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 17 matching lines...) Expand all Loading... | |
28 | 28 |
29 } // namespace | 29 } // namespace |
30 | 30 |
31 namespace content { | 31 namespace content { |
32 | 32 |
33 static void InitApplicationContext(JNIEnv* env, jclass clazz, jobject context) { | 33 static void InitApplicationContext(JNIEnv* env, jclass clazz, jobject context) { |
34 base::android::ScopedJavaLocalRef<jobject> scoped_context(env, context); | 34 base::android::ScopedJavaLocalRef<jobject> scoped_context(env, context); |
35 base::android::InitApplicationContext(scoped_context); | 35 base::android::InitApplicationContext(scoped_context); |
36 } | 36 } |
37 | 37 |
38 static jint Start(JNIEnv* env, jclass clazz) { | 38 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
| |
39 TRACE_EVENT0("startup", "content::Start"); | 39 TRACE_EVENT0("startup", "content::Start"); |
40 | 40 |
41 DCHECK(!g_content_runner.Get().get()); | 41 // On Android we can have multiple requests to start the browser in process |
42 g_content_runner.Get().reset(ContentMainRunner::Create()); | 42 // simultaneously. If we get an asynchonous request followed by a synchronous |
43 g_content_runner.Get()->Initialize(0, NULL, | 43 // request then we have to call this a second time to finish starting the |
44 g_content_main_delegate.Get().get()); | 44 // browser synchronously. |
45 return g_content_runner.Get()->Run(); | 45 if (!g_content_runner.Get().get()) { |
46 g_content_runner.Get().reset(ContentMainRunner::Create()); | |
47 g_content_runner.Get()->Initialize( | |
48 0, NULL, g_content_main_delegate.Get().get()); | |
49 } | |
50 g_content_runner.Get()->Run(); | |
46 } | 51 } |
47 | 52 |
48 void SetContentMainDelegate(ContentMainDelegate* delegate) { | 53 void SetContentMainDelegate(ContentMainDelegate* delegate) { |
49 DCHECK(!g_content_main_delegate.Get().get()); | 54 DCHECK(!g_content_main_delegate.Get().get()); |
50 g_content_main_delegate.Get().reset(delegate); | 55 g_content_main_delegate.Get().reset(delegate); |
51 } | 56 } |
52 | 57 |
53 bool RegisterContentMain(JNIEnv* env) { | 58 bool RegisterContentMain(JNIEnv* env) { |
54 return RegisterNativesImpl(env); | 59 return RegisterNativesImpl(env); |
55 } | 60 } |
56 | 61 |
57 } // namespace content | 62 } // namespace content |
OLD | NEW |