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

Unified Diff: mojo/public/cpp/bindings/lib/interface_endpoint_client.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 | « no previous file | mojo/public/cpp/bindings/lib/router.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/bindings/lib/interface_endpoint_client.cc
diff --git a/mojo/public/cpp/bindings/lib/interface_endpoint_client.cc b/mojo/public/cpp/bindings/lib/interface_endpoint_client.cc
index 1970e9c8e550c485636fc89f739dcf3ceeba484c..5e1978d2086eb445415d517379438ee9e8ceed43 100644
--- a/mojo/public/cpp/bindings/lib/interface_endpoint_client.cc
+++ b/mojo/public/cpp/bindings/lib/interface_endpoint_client.cc
@@ -266,12 +266,18 @@ void InterfaceEndpointClient::NotifyError() {
if (encountered_error_)
return;
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();
}
bool InterfaceEndpointClient::HandleValidatedMessage(Message* message) {
DCHECK_EQ(handle_.id(), message->interface_id());
+ DCHECK(!encountered_error_);
if (message->has_flag(Message::kFlagExpectsResponse)) {
if (!incoming_receiver_)
« no previous file with comments | « no previous file | mojo/public/cpp/bindings/lib/router.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698