OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "mojo/runner/android/main.h" | 5 #include "mojo/runner/android/main.h" |
6 | 6 |
7 #include "base/android/fifo_utils.h" | 7 #include "base/android/fifo_utils.h" |
8 #include "base/android/jni_android.h" | 8 #include "base/android/jni_android.h" |
9 #include "base/android/jni_array.h" | 9 #include "base/android/jni_array.h" |
10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
11 #include "base/at_exit.h" | 11 #include "base/at_exit.h" |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
14 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
15 #include "base/files/file_util.h" | 15 #include "base/files/file_util.h" |
16 #include "base/lazy_instance.h" | 16 #include "base/lazy_instance.h" |
17 #include "base/logging.h" | 17 #include "base/logging.h" |
18 #include "base/macros.h" | 18 #include "base/macros.h" |
19 #include "base/message_loop/message_loop.h" | 19 #include "base/message_loop/message_loop.h" |
20 #include "base/run_loop.h" | 20 #include "base/run_loop.h" |
21 #include "base/threading/simple_thread.h" | 21 #include "base/threading/simple_thread.h" |
22 #include "jni/ShellMain_jni.h" | 22 #include "jni/ShellMain_jni.h" |
23 #include "mojo/common/message_pump_mojo.h" | 23 #include "mojo/common/message_pump_mojo.h" |
24 #include "mojo/runner/android/android_handler_loader.h" | 24 #include "mojo/runner/android/android_handler_loader.h" |
25 #include "mojo/runner/android/background_application_loader.h" | 25 #include "mojo/runner/android/background_application_loader.h" |
| 26 #include "mojo/runner/android/context_init.h" |
26 #include "mojo/runner/android/native_viewport_application_loader.h" | 27 #include "mojo/runner/android/native_viewport_application_loader.h" |
27 #include "mojo/runner/android/ui_application_loader_android.h" | 28 #include "mojo/runner/android/ui_application_loader_android.h" |
28 #include "mojo/runner/context.h" | 29 #include "mojo/runner/context.h" |
29 #include "mojo/runner/init.h" | 30 #include "mojo/runner/init.h" |
30 #include "mojo/shell/application_loader.h" | 31 #include "mojo/shell/application_loader.h" |
31 #include "ui/gl/gl_surface_egl.h" | 32 #include "ui/gl/gl_surface_egl.h" |
32 | 33 |
33 using base::LazyInstance; | 34 using base::LazyInstance; |
34 | 35 |
35 namespace mojo { | 36 namespace mojo { |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 InitializeLogging(); | 159 InitializeLogging(); |
159 | 160 |
160 InitializeRedirection(); | 161 InitializeRedirection(); |
161 | 162 |
162 // We want ~MessageLoop to happen prior to ~Context. Initializing | 163 // We want ~MessageLoop to happen prior to ~Context. Initializing |
163 // LazyInstances is akin to stack-allocating objects; their destructors | 164 // LazyInstances is akin to stack-allocating objects; their destructors |
164 // will be invoked first-in-last-out. | 165 // will be invoked first-in-last-out. |
165 Context* shell_context = new Context(); | 166 Context* shell_context = new Context(); |
166 shell_context->SetShellFileRoot(base::FilePath( | 167 shell_context->SetShellFileRoot(base::FilePath( |
167 base::android::ConvertJavaStringToUTF8(env, j_local_apps_directory))); | 168 base::android::ConvertJavaStringToUTF8(env, j_local_apps_directory))); |
| 169 InitContext(shell_context); |
168 g_context.Get().reset(shell_context); | 170 g_context.Get().reset(shell_context); |
169 | 171 |
170 g_java_message_loop.Get().reset(new base::MessageLoopForUI); | 172 g_java_message_loop.Get().reset(new base::MessageLoopForUI); |
171 base::MessageLoopForUI::current()->Start(); | 173 base::MessageLoopForUI::current()->Start(); |
172 | 174 |
173 // TODO(abarth): At which point should we switch to cross-platform | 175 // TODO(abarth): At which point should we switch to cross-platform |
174 // initialization? | 176 // initialization? |
175 | 177 |
176 gfx::GLSurface::InitializeOneOff(); | 178 gfx::GLSurface::InitializeOneOff(); |
177 } | 179 } |
(...skipping 24 matching lines...) Expand all Loading... |
202 } | 204 } |
203 | 205 |
204 } // namespace runner | 206 } // namespace runner |
205 } // namespace mojo | 207 } // namespace mojo |
206 | 208 |
207 // TODO(vtl): Even though main() should never be called, mojo_shell fails to | 209 // TODO(vtl): Even though main() should never be called, mojo_shell fails to |
208 // link without it. Figure out if we can avoid this. | 210 // link without it. Figure out if we can avoid this. |
209 int main(int argc, char** argv) { | 211 int main(int argc, char** argv) { |
210 NOTREACHED(); | 212 NOTREACHED(); |
211 } | 213 } |
OLD | NEW |