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

Unified Diff: mojo/public/cpp/bindings/lib/router.cc

Issue 2274743002: Mojo C++ bindings: clean up pending callbacks when connection error occurs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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/public/cpp/bindings/lib/interface_endpoint_client.cc ('k') | 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/router.cc
diff --git a/mojo/public/cpp/bindings/lib/router.cc b/mojo/public/cpp/bindings/lib/router.cc
index 756c459fa5b56ca846ad8320e37fedae22a013b7..7c610eeff571f0d3111d35ebaa3413e6908823c4 100644
--- a/mojo/public/cpp/bindings/lib/router.cc
+++ b/mojo/public/cpp/bindings/lib/router.cc
@@ -246,6 +246,8 @@ void Router::HandleQueuedMessages() {
}
bool Router::HandleMessageInternal(Message* message) {
+ DCHECK(!encountered_error_);
+
if (message->has_flag(Message::kFlagExpectsResponse)) {
if (!incoming_receiver_)
return false;
@@ -308,6 +310,11 @@ void Router::OnConnectionError() {
}
encountered_error_ = true;
+
+ // The callbacks may hold on to resources. There is no need to keep them any
+ // longer.
+ async_responders_.clear();
+
if (!error_handler_.is_null())
error_handler_.Run();
}
« no previous file with comments | « mojo/public/cpp/bindings/lib/interface_endpoint_client.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698