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

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

Issue 2025053002: Mojo C++ bindings: fix a DCHECK in multiplex_router.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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/pipe_control_message_proxy.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/bindings/lib/multiplex_router.cc
diff --git a/mojo/public/cpp/bindings/lib/multiplex_router.cc b/mojo/public/cpp/bindings/lib/multiplex_router.cc
index d081b0155ba480edf20fd4357b00f4d49f7ecb62..2f547bc2e52cf81ae0b7b6315b17e52278bdcab2 100644
--- a/mojo/public/cpp/bindings/lib/multiplex_router.cc
+++ b/mojo/public/cpp/bindings/lib/multiplex_router.cc
@@ -702,8 +702,6 @@ bool MultiplexRouter::ProcessIncomingMessage(
bool inserted = false;
InterfaceEndpoint* endpoint = FindOrInsertEndpoint(id, &inserted);
if (inserted) {
- DCHECK(!IsMasterInterfaceId(id));
-
// Currently, it is legitimate to receive messages for an endpoint
// that is not registered. For example, the endpoint is transferred in
// a message that is discarded. Once we add support to specify all
@@ -711,7 +709,16 @@ bool MultiplexRouter::ProcessIncomingMessage(
// this.
UpdateEndpointStateMayRemove(endpoint, ENDPOINT_CLOSED);
- control_message_proxy_.NotifyPeerEndpointClosed(id);
+ // It is also possible that this newly-inserted endpoint is the master
+ // endpoint. When the master InterfacePtr/Binding goes away, the message
+ // pipe is closed and we explicitly trigger a pipe connection error. The
+ // error updates all the endpoints, including the master endpoint, with
+ // PEER_ENDPOINT_CLOSED and removes the master endpoint from the
+ // registration. We continue to process remaining tasks in the queue, as
+ // long as there are refs keeping the router alive. If there are remaining
+ // messages for the master endpoint, we will get here.
+ if (!IsMasterInterfaceId(id))
+ control_message_proxy_.NotifyPeerEndpointClosed(id);
return true;
}
« no previous file with comments | « no previous file | mojo/public/cpp/bindings/lib/pipe_control_message_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698