Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(469)

Unified Diff: mojo/shell/android/mojo_main.cc

Issue 420143003: mojo: shell::Context should outlive the shell MessageLoop (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review 2 Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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
« no previous file with comments | « mojo/services/window_manager/window_manager_api_unittest.cc ('k') | mojo/shell/child_process_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698