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/public/cpp/bindings/lib/binding_state.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 | « mojo/public/cpp/bindings/binding.h ('k') | mojo/public/cpp/bindings/strong_binding.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/bindings/lib/binding_state.h
diff --git a/mojo/public/cpp/bindings/lib/binding_state.h b/mojo/public/cpp/bindings/lib/binding_state.h
index 82b1a327b21a13d318f9bf82d3de6e4c473472d0..1950289644860ccddb63a2a7749b70609775521c 100644
--- a/mojo/public/cpp/bindings/lib/binding_state.h
+++ b/mojo/public/cpp/bindings/lib/binding_state.h
@@ -89,6 +89,7 @@ class BindingState<Interface, false> {
}
void set_connection_error_handler(const Closure& error_handler) {
+ DCHECK(is_bound());
connection_error_handler_ = error_handler;
}
@@ -113,6 +114,7 @@ class BindingState<Interface, false> {
router_->set_connection_error_handler(Closure());
delete router_;
router_ = nullptr;
+ connection_error_handler_.reset();
}
internal::Router* router_ = nullptr;
@@ -175,6 +177,7 @@ class BindingState<Interface, true> {
endpoint_client_.reset();
router_->CloseMessagePipe();
router_ = nullptr;
+ connection_error_handler_.reset();
}
InterfaceRequest<Interface> Unbind() {
@@ -182,10 +185,12 @@ class BindingState<Interface, true> {
InterfaceRequest<Interface> request =
MakeRequest<Interface>(router_->PassMessagePipe());
router_ = nullptr;
+ connection_error_handler_.reset();
return request.Pass();
}
void set_connection_error_handler(const Closure& error_handler) {
+ DCHECK(is_bound());
connection_error_handler_ = error_handler;
}
« no previous file with comments | « mojo/public/cpp/bindings/binding.h ('k') | mojo/public/cpp/bindings/strong_binding.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698