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

Unified Diff: mojo/shell/desktop/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: fix + verify android 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
« no previous file with comments | « mojo/shell/context.cc ('k') | mojo/shell/dynamic_service_loader_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/shell/desktop/mojo_main.cc
diff --git a/mojo/shell/desktop/mojo_main.cc b/mojo/shell/desktop/mojo_main.cc
index 938b95e85a28de08c766f048090989c5392cf3f4..38017cbcd5b54b93552d7fdbddaf7632ed2da1f0 100644
--- a/mojo/shell/desktop/mojo_main.cc
+++ b/mojo/shell/desktop/mojo_main.cc
@@ -27,30 +27,33 @@ int main(int argc, char** argv) {
} else {
gfx::GLSurface::InitializeOneOff();
- base::MessageLoop message_loop;
+ // We want the shell::Context to outlive the MessageLoop so that pipes are
+ // all gracefully closed / error-out before we try to shut the Context down.
mojo::shell::Context shell_context;
-
- const base::CommandLine& command_line =
- *base::CommandLine::ForCurrentProcess();
- if (command_line.HasSwitch(switches::kOrigin)) {
- shell_context.mojo_url_resolver()->SetBaseURL(
- GURL(command_line.GetSwitchValueASCII(switches::kOrigin)));
+ {
+ base::MessageLoop message_loop;
+ shell_context.Init();
+
+ const base::CommandLine& command_line =
+ *base::CommandLine::ForCurrentProcess();
+ if (command_line.HasSwitch(switches::kOrigin)) {
+ shell_context.mojo_url_resolver()->SetBaseURL(
+ GURL(command_line.GetSwitchValueASCII(switches::kOrigin)));
+ }
+
+ std::vector<GURL> app_urls;
+ base::CommandLine::StringVector args = command_line.GetArgs();
+ for (base::CommandLine::StringVector::const_iterator it = args.begin();
+ it != args.end();
+ ++it)
+ app_urls.push_back(GURL(*it));
+
+ message_loop.PostTask(FROM_HERE,
+ base::Bind(mojo::shell::Run,
+ &shell_context,
+ app_urls));
+ message_loop.Run();
}
-
- std::vector<GURL> app_urls;
- base::CommandLine::StringVector args = command_line.GetArgs();
- for (base::CommandLine::StringVector::const_iterator it = args.begin();
- it != args.end();
- ++it)
- app_urls.push_back(GURL(*it));
-
- message_loop.PostTask(FROM_HERE,
- base::Bind(mojo::shell::Run,
- &shell_context,
- app_urls));
-
- message_loop.Run();
}
-
return 0;
}
« no previous file with comments | « mojo/shell/context.cc ('k') | mojo/shell/dynamic_service_loader_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698