| 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/shell/android/mojo_main.h" | 5 #include "shell/android/mojo_main.h" |
| 6 | 6 |
| 7 #include "base/android/command_line_android.h" | 7 #include "base/android/command_line_android.h" |
| 8 #include "base/android/java_handler_thread.h" | 8 #include "base/android/java_handler_thread.h" |
| 9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
| 10 #include "base/at_exit.h" | 10 #include "base/at_exit.h" |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/lazy_instance.h" | 13 #include "base/lazy_instance.h" |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/message_loop/message_loop.h" | 16 #include "base/message_loop/message_loop.h" |
| 17 #include "jni/MojoMain_jni.h" | 17 #include "jni/MojoMain_jni.h" |
| 18 #include "mojo/application_manager/application_loader.h" | 18 #include "mojo/application_manager/application_loader.h" |
| 19 #include "mojo/application_manager/application_manager.h" | 19 #include "mojo/application_manager/application_manager.h" |
| 20 #include "mojo/shell/context.h" | 20 #include "shell/context.h" |
| 21 #include "mojo/shell/init.h" | 21 #include "shell/init.h" |
| 22 #include "ui/gl/gl_surface_egl.h" | 22 #include "ui/gl/gl_surface_egl.h" |
| 23 | 23 |
| 24 using base::LazyInstance; | 24 using base::LazyInstance; |
| 25 | 25 |
| 26 namespace mojo { | 26 namespace mojo { |
| 27 | 27 |
| 28 namespace { | 28 namespace { |
| 29 | 29 |
| 30 LazyInstance<scoped_ptr<base::MessageLoop> > g_java_message_loop = | 30 LazyInstance<scoped_ptr<base::MessageLoop>> g_java_message_loop = |
| 31 LAZY_INSTANCE_INITIALIZER; | 31 LAZY_INSTANCE_INITIALIZER; |
| 32 | 32 |
| 33 LazyInstance<scoped_ptr<shell::Context> > g_context = | 33 LazyInstance<scoped_ptr<shell::Context>> g_context = LAZY_INSTANCE_INITIALIZER; |
| 34 LAZY_INSTANCE_INITIALIZER; | |
| 35 | 34 |
| 36 LazyInstance<scoped_ptr<base::android::JavaHandlerThread> > g_shell_thread = | 35 LazyInstance<scoped_ptr<base::android::JavaHandlerThread>> g_shell_thread = |
| 37 LAZY_INSTANCE_INITIALIZER; | 36 LAZY_INSTANCE_INITIALIZER; |
| 38 | 37 |
| 39 void RunShell(std::vector<GURL> app_urls) { | 38 void RunShell(std::vector<GURL> app_urls) { |
| 40 shell::Context* context = g_context.Pointer()->get(); | 39 shell::Context* context = g_context.Pointer()->get(); |
| 41 context->Init(); | 40 context->Init(); |
| 42 context->set_ui_loop(g_java_message_loop.Get().get()); | 41 context->set_ui_loop(g_java_message_loop.Get().get()); |
| 43 for (std::vector<GURL>::const_iterator it = app_urls.begin(); | 42 for (std::vector<GURL>::const_iterator it = app_urls.begin(); |
| 44 it != app_urls.end(); ++it) { | 43 it != app_urls.end(); ++it) { |
| 45 context->Run(*it); | 44 context->Run(*it); |
| 46 } | 45 } |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 g_shell_thread.Get()->Start(); | 88 g_shell_thread.Get()->Start(); |
| 90 g_shell_thread.Get()->message_loop()->PostTask( | 89 g_shell_thread.Get()->message_loop()->PostTask( |
| 91 FROM_HERE, base::Bind(&RunShell, app_urls)); | 90 FROM_HERE, base::Bind(&RunShell, app_urls)); |
| 92 } | 91 } |
| 93 | 92 |
| 94 bool RegisterMojoMain(JNIEnv* env) { | 93 bool RegisterMojoMain(JNIEnv* env) { |
| 95 return RegisterNativesImpl(env); | 94 return RegisterNativesImpl(env); |
| 96 } | 95 } |
| 97 | 96 |
| 98 } // namespace mojo | 97 } // namespace mojo |
| OLD | NEW |