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

Unified Diff: mojo/public/cpp/bindings/lib/binding_state.h

Issue 2052963002: Mojo C++ bindings: don't DCEHCK in Binding::Close() when the binding is not bound. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 | « no previous file | no next file » | 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 77a59f5d0edb8cafe95d0be46d0a6124a7e1b45f..4f4185a515c39debcce02079cdeaa4407648a443 100644
--- a/mojo/public/cpp/bindings/lib/binding_state.h
+++ b/mojo/public/cpp/bindings/lib/binding_state.h
@@ -44,10 +44,7 @@ class BindingState<Interface, false> {
stub_.set_sink(impl_);
}
- ~BindingState() {
- if (router_)
- Close();
- }
+ ~BindingState() { Close(); }
void Bind(ScopedMessagePipeHandle handle,
scoped_refptr<base::SingleThreadTaskRunner> runner) {
@@ -82,7 +79,9 @@ class BindingState<Interface, false> {
}
void Close() {
- DCHECK(router_);
+ if (!router_)
+ return;
+
router_->CloseMessagePipe();
DestroyRouter();
}
@@ -140,10 +139,7 @@ class BindingState<Interface, true> {
stub_.set_sink(impl_);
}
- ~BindingState() {
- if (router_)
- Close();
- }
+ ~BindingState() { Close(); }
void Bind(ScopedMessagePipeHandle handle,
scoped_refptr<base::SingleThreadTaskRunner> runner) {
@@ -181,7 +177,9 @@ class BindingState<Interface, true> {
}
void Close() {
- DCHECK(router_);
+ if (!router_)
+ return;
+
endpoint_client_.reset();
router_->CloseMessagePipe();
router_ = nullptr;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698