Chromium Code Reviews| Index: mojo/shell/android/mojo_main.cc |
| diff --git a/mojo/shell/android/mojo_main.cc b/mojo/shell/android/mojo_main.cc |
| index a892317bde2e3393ae77db40d4fda9af07e92b2d..2d71c6f56b20beaa7e0a59d98f4c462a68dbcd77 100644 |
| --- a/mojo/shell/android/mojo_main.cc |
| +++ b/mojo/shell/android/mojo_main.cc |
| @@ -37,10 +37,7 @@ LazyInstance<scoped_ptr<base::android::JavaHandlerThread> > g_shell_thread = |
| LAZY_INSTANCE_INITIALIZER; |
| void RunShell(std::vector<GURL> app_urls) { |
| - shell::Context* shell_context = new shell::Context(); |
| shell_context->set_ui_loop(g_java_message_loop.Get().get()); |
|
jamesr
2014/07/29 06:17:34
maybe you want g_context.Get()-> here?
tim (not reviewing)
2014/07/29 20:48:43
Yeah; I had verified mojo_shell was working on and
|
| - |
| - g_context.Get().reset(shell_context); |
| shell::Run(shell_context, app_urls); |
| } |
| @@ -54,7 +51,13 @@ static void Init(JNIEnv* env, jclass clazz, jobject context) { |
| base::CommandLine::Init(0, 0); |
| mojo::shell::InitializeLogging(); |
| + // We want ~MessageLoop to happen prior to ~Context. Initializing |
| + // LazyInstances is akin to stack-allocating objects; their destructors |
| + // will be invoked first-in-last-out. |
| + shell::Context* shell_context = new shell::Context(); |
| + g_context.Get().reset(shell_context); |
| g_java_message_loop.Get().reset(new base::MessageLoopForUI); |
| + shell_context->Init(); |
| base::MessageLoopForUI::current()->Start(); |
| // TODO(abarth): At which point should we switch to cross-platform |