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

Unified Diff: content/common/mojo/mojo_shell_connection_impl.cc

Issue 1920033005: services/shell: Fix running the connection-lost callback. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 | « content/common/mojo/mojo_shell_connection_impl.h ('k') | content/public/common/mojo_shell_connection.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « content/common/mojo/mojo_shell_connection_impl.h ('k') | content/public/common/mojo_shell_connection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698