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

Unified Diff: mojo/shell/public/cpp/lib/connector_impl.cc

Issue 1761113002: Monitor the ShellClient binding for pipe closure as a signal to shut down the ShellConnection, rath… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@28lifecycle2
Patch Set: Created 4 years, 10 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 | « mojo/shell/public/cpp/lib/connector_impl.h ('k') | mojo/shell/public/cpp/lib/shell_client.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/shell/public/cpp/lib/connector_impl.cc
diff --git a/mojo/shell/public/cpp/lib/connector_impl.cc b/mojo/shell/public/cpp/lib/connector_impl.cc
index 2244fef820352d67712e87646d44ac0af36f1cc2..675017d4985f745da44b0cdc21712a3a78f8f617 100644
--- a/mojo/shell/public/cpp/lib/connector_impl.cc
+++ b/mojo/shell/public/cpp/lib/connector_impl.cc
@@ -16,10 +16,8 @@ Connector::ConnectParams::~ConnectParams() {}
ConnectorImpl::ConnectorImpl(shell::mojom::ConnectorPtrInfo unbound_state)
: unbound_state_(std::move(unbound_state)) {}
-ConnectorImpl::ConnectorImpl(shell::mojom::ConnectorPtr connector,
- const base::Closure& connection_error_closure)
+ConnectorImpl::ConnectorImpl(shell::mojom::ConnectorPtr connector)
: connector_(std::move(connector)) {
- connector_.set_connection_error_handler(connection_error_closure);
thread_checker_.reset(new base::ThreadChecker);
}
ConnectorImpl::~ConnectorImpl() {}
@@ -33,8 +31,12 @@ scoped_ptr<Connection> ConnectorImpl::Connect(ConnectParams* params) {
// Bind this object to the current thread the first time it is used to
// connect.
if (!connector_.is_bound()) {
- if (!unbound_state_.is_valid())
+ if (!unbound_state_.is_valid()) {
+ // It's possible to get here when the link to the shell has been severed
+ // (and so the connector pipe has been closed) but the app has chosen not
+ // to quit.
return nullptr;
+ }
connector_.Bind(std::move(unbound_state_));
thread_checker_.reset(new base::ThreadChecker);
}
« no previous file with comments | « mojo/shell/public/cpp/lib/connector_impl.h ('k') | mojo/shell/public/cpp/lib/shell_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698