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

Unified Diff: mojo/public/cpp/bindings/associated_binding.h

Issue 1531543003: Modify bindings to enforce that an error handler callback is only set after binding to a msg pipe. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mojo-binding-error-handler
Patch Set: Add error handler comment. Created 5 years 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 | « no previous file | mojo/public/cpp/bindings/binding.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/bindings/associated_binding.h
diff --git a/mojo/public/cpp/bindings/associated_binding.h b/mojo/public/cpp/bindings/associated_binding.h
index b6b7cd1098cf55bf19dea7a2ca4fd4648f217443..1971af18e242da434b0595054f357b44583ba4a1 100644
--- a/mojo/public/cpp/bindings/associated_binding.h
+++ b/mojo/public/cpp/bindings/associated_binding.h
@@ -90,6 +90,7 @@ class AssociatedBinding {
void Close() {
DCHECK(endpoint_client_);
endpoint_client_.reset();
+ connection_error_handler_.reset();
}
// Unbinds and returns the associated interface request so it can be
@@ -103,12 +104,18 @@ class AssociatedBinding {
&request, endpoint_client_->PassHandle());
endpoint_client_.reset();
+ connection_error_handler_.reset();
return request.Pass();
}
// Sets an error handler that will be called if a connection error occurs.
+ //
+ // This method may only be called after this AssociatedBinding has been bound
+ // to a message pipe. The error handler will be reset when this
+ // AssociatedBinding is unbound or closed.
void set_connection_error_handler(const Closure& error_handler) {
+ DCHECK(is_bound());
connection_error_handler_ = error_handler;
}
« no previous file with comments | « no previous file | mojo/public/cpp/bindings/binding.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698