Chromium Code Reviews| Index: content/common/mojo/mojo_shell_connection_impl.cc |
| diff --git a/content/common/mojo/mojo_shell_connection_impl.cc b/content/common/mojo/mojo_shell_connection_impl.cc |
| index 90ad7002f00a484e9c2c48f64676cf031f492b05..6c856f680f1bfef1199227a526b4aad532b5ae2c 100644 |
| --- a/content/common/mojo/mojo_shell_connection_impl.cc |
| +++ b/content/common/mojo/mojo_shell_connection_impl.cc |
| @@ -89,7 +89,7 @@ void MojoShellConnectionImpl::BindToRequestFromCommandLine() { |
| } |
| MojoShellConnectionImpl::MojoShellConnectionImpl(bool external) |
| - : external_(external) {} |
| + : external_(external), connection_lost_(false) {} |
| MojoShellConnectionImpl::~MojoShellConnectionImpl() { |
| STLDeleteElements(&listeners_); |
| @@ -106,6 +106,12 @@ bool MojoShellConnectionImpl::AcceptConnection(shell::Connection* connection) { |
| return found; |
| } |
| +bool MojoShellConnectionImpl::ShellConnectionLost() { |
| + connection_lost_ = true; |
| + // Allow termination to proceed. |
| + return true; |
| +} |
| + |
| shell::Connector* MojoShellConnectionImpl::GetConnector() { |
| DCHECK(shell_connection_); |
| return shell_connection_->connector(); |
| @@ -122,7 +128,10 @@ bool MojoShellConnectionImpl::UsingExternalShell() const { |
| void MojoShellConnectionImpl::SetConnectionLostClosure( |
| const base::Closure& closure) { |
| - shell_connection_->set_connection_lost_closure(closure); |
| + if (connection_lost_) |
| + closure.Run(); |
| + else |
| + shell_connection_->set_connection_lost_closure(closure); |
|
sadrul
2016/04/27 20:00:38
Alternatively, ShellConnection::set_connection_los
sky
2016/04/27 21:18:56
I would add this to ShellConnection as it seems ea
sadrul
2016/04/27 22:11:18
Done.
|
| } |
| void MojoShellConnectionImpl::AddListener(std::unique_ptr<Listener> listener) { |