Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / mojo / shell / run.cc
index 5e0f214..ec92311 100644 (file)
@@ -8,6 +8,7 @@
 #include "base/logging.h"
 #include "base/message_loop/message_loop.h"
 #include "mojo/shell/context.h"
+#include "mojo/shell/keep_alive.h"
 #include "mojo/shell/service_manager.h"
 #include "mojo/shell/switches.h"
 #include "url/gurl.h"
@@ -16,12 +17,13 @@ namespace mojo {
 namespace shell {
 
 void Run(Context* context) {
+  KeepAlive keep_alive(context);
+
   const CommandLine& command_line = *CommandLine::ForCurrentProcess();
   CommandLine::StringVector args = command_line.GetArgs();
 
   if (args.empty()) {
     LOG(ERROR) << "No app path specified.";
-    base::MessageLoop::current()->Quit();
     return;
   }
 
@@ -30,7 +32,6 @@ void Run(Context* context) {
     GURL url(*it);
     if (url.scheme() == "mojo" && !command_line.HasSwitch(switches::kOrigin)) {
       LOG(ERROR) << "mojo: url passed with no --origin specified.";
-      base::MessageLoop::current()->Quit();
       return;
     }
     ScopedMessagePipeHandle no_handle;