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

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

Issue 2487803002: Mojo C++ Bindings: Allow callbacks to own their InterfacePtr (Closed)
Patch Set: . Created 4 years, 1 month 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 2a02ef202f47455b80875d4a423da1648e7b1614..a6a9c0686bb839f27869ce80a2533e751a749c2c 100644
--- a/mojo/public/cpp/bindings/lib/interface_endpoint_client.cc
+++ b/mojo/public/cpp/bindings/lib/interface_endpoint_client.cc
@@ -280,9 +280,11 @@ void InterfaceEndpointClient::NotifyError() {
return;
encountered_error_ = true;
- // The callbacks may hold on to resources. There is no need to keep them any
- // longer.
- async_responders_.clear();
+ // Response callbacks may hold on to resource, and there's no need to keep
+ // them alive any longer. Note that it's allowed that a pending response
+ // callback may own this endpoint, so we simply move the responders onto the
+ // stack here and let them be destroyed when the stack unwinds.
+ AsyncResponderMap responders = std::move(async_responders_);
control_message_proxy_.OnConnectionError();
« 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