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

Unified Diff: mojo/edk/system/message_pipe.cc

Issue 694923002: Update mojo sdk to rev 91d94d6993c9b0c4135a95687a7d541ce90629b (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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/edk/system/channel_endpoint.cc ('k') | mojo/edk/system/remote_message_pipe_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/system/message_pipe.cc
diff --git a/mojo/edk/system/message_pipe.cc b/mojo/edk/system/message_pipe.cc
index 55f12853a4a3e88fbae500f6e9594028f90b26db..e2157302cbc8e46555bc4b1c3dfdf5c6b7f25154 100644
--- a/mojo/edk/system/message_pipe.cc
+++ b/mojo/edk/system/message_pipe.cc
@@ -161,22 +161,35 @@ scoped_refptr<ChannelEndpoint> MessagePipe::ConvertLocalToProxy(unsigned port) {
DCHECK(endpoints_[port]);
DCHECK_EQ(endpoints_[port]->GetType(), MessagePipeEndpoint::kTypeLocal);
+ // The local peer is already closed, so just make a |ChannelEndpoint| that'll
+ // send the already-queued messages.
+ if (!endpoints_[GetPeerPort(port)]) {
+ scoped_refptr<ChannelEndpoint> channel_endpoint(new ChannelEndpoint(
+ nullptr,
+ 0,
+ static_cast<LocalMessagePipeEndpoint*>(endpoints_[port].get())
+ ->message_queue()));
+ endpoints_[port]->Close();
+ endpoints_[port].reset();
+ return channel_endpoint;
+ }
+
// TODO(vtl): Allowing this case is a temporary hack. It'll set up a
// |MessagePipe| with two proxy endpoints, which will then act as a proxy
// (rather than trying to connect the two ends directly).
DLOG_IF(WARNING,
- !!endpoints_[GetPeerPort(port)] &&
- endpoints_[GetPeerPort(port)]->GetType() !=
- MessagePipeEndpoint::kTypeLocal)
+ endpoints_[GetPeerPort(port)]->GetType() !=
+ MessagePipeEndpoint::kTypeLocal)
<< "Direct message pipe passing across multiple channels not yet "
"implemented; will proxy";
scoped_ptr<MessagePipeEndpoint> old_endpoint(endpoints_[port].Pass());
- scoped_refptr<ChannelEndpoint> channel_endpoint(
- new ChannelEndpoint(this, port));
+ scoped_refptr<ChannelEndpoint> channel_endpoint(new ChannelEndpoint(
+ this,
+ port,
+ static_cast<LocalMessagePipeEndpoint*>(old_endpoint.get())
+ ->message_queue()));
endpoints_[port].reset(new ProxyMessagePipeEndpoint(channel_endpoint.get()));
- channel_endpoint->TakeMessages(static_cast<LocalMessagePipeEndpoint*>(
- old_endpoint.get())->message_queue());
old_endpoint->Close();
return channel_endpoint;
« no previous file with comments | « mojo/edk/system/channel_endpoint.cc ('k') | mojo/edk/system/remote_message_pipe_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698