diff options
Diffstat (limited to 'mojo/shell/public')
-rw-r--r-- | mojo/shell/public/cpp/lib/application_runner.cc | 6 | ||||
-rw-r--r-- | mojo/shell/public/cpp/lib/shell_client.cc | 2 | ||||
-rw-r--r-- | mojo/shell/public/cpp/lib/shell_connection.cc | 3 | ||||
-rw-r--r-- | mojo/shell/public/cpp/shell_client.h | 9 | ||||
-rw-r--r-- | mojo/shell/public/cpp/shell_connection.h | 9 |
5 files changed, 6 insertions, 23 deletions
diff --git a/mojo/shell/public/cpp/lib/application_runner.cc b/mojo/shell/public/cpp/lib/application_runner.cc index 201aa62..5253053 100644 --- a/mojo/shell/public/cpp/lib/application_runner.cc +++ b/mojo/shell/public/cpp/lib/application_runner.cc @@ -5,12 +5,10 @@ #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" @@ -56,9 +54,7 @@ MojoResult ApplicationRunner::Run(MojoHandle shell_client_request_handle, client_.get(), MakeRequest<shell::mojom::ShellClient>(MakeScopedHandle( MessagePipeHandle(shell_client_request_handle))))); - base::RunLoop run_loop; - connection_->set_connection_lost_closure(run_loop.QuitClosure()); - run_loop.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. diff --git a/mojo/shell/public/cpp/lib/shell_client.cc b/mojo/shell/public/cpp/lib/shell_client.cc index 3ca8cd7..c41999b 100644 --- a/mojo/shell/public/cpp/lib/shell_client.cc +++ b/mojo/shell/public/cpp/lib/shell_client.cc @@ -17,6 +17,6 @@ bool ShellClient::AcceptConnection(Connection* connection) { return false; } -bool ShellClient::ShellConnectionLost() { return true; } +void ShellClient::ShellConnectionLost() {} } // namespace mojo diff --git a/mojo/shell/public/cpp/lib/shell_connection.cc b/mojo/shell/public/cpp/lib/shell_connection.cc index 62ae598..d1cba7e 100644 --- a/mojo/shell/public/cpp/lib/shell_connection.cc +++ b/mojo/shell/public/cpp/lib/shell_connection.cc @@ -86,8 +86,7 @@ void ShellConnection::OnConnectionError() { // Note that the ShellClient doesn't technically have to quit now, it may live // on to service existing connections. All existing Connectors however are // invalid. - if (client_->ShellConnectionLost() && !connection_lost_closure_.is_null()) - connection_lost_closure_.Run(); + client_->ShellConnectionLost(); // We don't reset the connector as clients may have taken a raw pointer to it. // Connect() will return nullptr if they try to connect to anything. } diff --git a/mojo/shell/public/cpp/shell_client.h b/mojo/shell/public/cpp/shell_client.h index aff1aac..d6fca12 100644 --- a/mojo/shell/public/cpp/shell_client.h +++ b/mojo/shell/public/cpp/shell_client.h @@ -43,13 +43,8 @@ class ShellClient { // Called when ShellConnection's ShellClient binding (i.e. the pipe the // Mojo Shell has to talk to us over) is closed. A shell client may use this - // as a signal to terminate. Return true from this method to tell the - // ShellConnection to run its connection lost closure if it has one, false to - // prevent it from being run. The default implementation returns true. - // When used in conjunction with ApplicationRunner, returning true here quits - // the message loop created by ApplicationRunner, which results in the app - // quitting. - virtual bool ShellConnectionLost(); + // as a signal to terminate. + virtual void ShellConnectionLost(); private: DISALLOW_COPY_AND_ASSIGN(ShellClient); diff --git a/mojo/shell/public/cpp/shell_connection.h b/mojo/shell/public/cpp/shell_connection.h index 3e00cd3..a05f6f1 100644 --- a/mojo/shell/public/cpp/shell_connection.h +++ b/mojo/shell/public/cpp/shell_connection.h @@ -61,12 +61,7 @@ class ShellConnection : public shell::mojom::ShellClient { // TODO(rockot): Remove this once we get rid of app tests. void SetAppTestConnectorForTesting(shell::mojom::ConnectorPtr connector); - // Specify a function to be called when the connection to the shell is lost. - void set_connection_lost_closure(const base::Closure& closure) { - connection_lost_closure_ = closure; - } - -private: + private: // shell::mojom::ShellClient: void Initialize(shell::mojom::IdentityPtr identity, uint32_t id, @@ -95,8 +90,6 @@ private: Binding<shell::mojom::ShellClient> binding_; scoped_ptr<Connector> connector_; - base::Closure connection_lost_closure_; - DISALLOW_COPY_AND_ASSIGN(ShellConnection); }; |