summaryrefslogtreecommitdiffstats
path: root/mojo/shell/public/cpp/lib/application_runner.cc
diff options
context:
space:
mode:
authorsky <sky@chromium.org>2016-03-21 14:12:35 -0700
committerCommit bot <commit-bot@chromium.org>2016-03-21 21:14:00 +0000
commita50f9840749052fbdec087a304548217cc6fd00b (patch)
tree97a63d4c0af4422d58f5a56ac9d0895dfba8d547 /mojo/shell/public/cpp/lib/application_runner.cc
parentd1b5f3a6dc60c0d00e9eca6476e0c3bc0a773b3b (diff)
downloadchromium_src-a50f9840749052fbdec087a304548217cc6fd00b.zip
chromium_src-a50f9840749052fbdec087a304548217cc6fd00b.tar.gz
chromium_src-a50f9840749052fbdec087a304548217cc6fd00b.tar.bz2
Quit the message loop by default in ShellConnectionLost when ApplicationRunner is used
This was originally at https://codereview.chromium.org/1814223002/ , but Ben is out and I need this for tests, so I'm taking over. BUG=none TEST=covered by tests TBR=ben@chromium.org R=ben@chromium.org Review URL: https://codereview.chromium.org/1819063002 Cr-Commit-Position: refs/heads/master@{#382389}
Diffstat (limited to 'mojo/shell/public/cpp/lib/application_runner.cc')
-rw-r--r--mojo/shell/public/cpp/lib/application_runner.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/mojo/shell/public/cpp/lib/application_runner.cc b/mojo/shell/public/cpp/lib/application_runner.cc
index 5253053..201aa62 100644
--- a/mojo/shell/public/cpp/lib/application_runner.cc
+++ b/mojo/shell/public/cpp/lib/application_runner.cc
@@ -5,10 +5,12 @@
#include "mojo/shell/public/cpp/application_runner.h"
#include "base/at_exit.h"
+#include "base/bind.h"
#include "base/command_line.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/process/launch.h"
+#include "base/run_loop.h"
#include "mojo/shell/public/cpp/shell_client.h"
#include "mojo/shell/public/cpp/shell_connection.h"
@@ -54,7 +56,9 @@ MojoResult ApplicationRunner::Run(MojoHandle shell_client_request_handle,
client_.get(),
MakeRequest<shell::mojom::ShellClient>(MakeScopedHandle(
MessagePipeHandle(shell_client_request_handle)))));
- loop->Run();
+ base::RunLoop run_loop;
+ connection_->set_connection_lost_closure(run_loop.QuitClosure());
+ run_loop.Run();
// It's very common for the client to cache the app and terminate on errors.
// If we don't delete the client before the app we run the risk of the
// client having a stale reference to the app and trying to use it.