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

Side by Side Diff: mojo/system/message_pipe.cc

Issue 587153003: Mojo: Move the paused message queue from ProxyMessagePipeEndpoint to ChannelEndpoint. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@del_pmpe_attach
Patch Set: rebased 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 unified diff | Download patch
« no previous file with comments | « mojo/system/local_message_pipe_endpoint.h ('k') | mojo/system/proxy_message_pipe_endpoint.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "mojo/system/message_pipe.h" 5 #include "mojo/system/message_pipe.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "mojo/system/channel_endpoint.h" 8 #include "mojo/system/channel_endpoint.h"
9 #include "mojo/system/local_message_pipe_endpoint.h" 9 #include "mojo/system/local_message_pipe_endpoint.h"
10 #include "mojo/system/message_in_transit.h" 10 #include "mojo/system/message_in_transit.h"
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 // TODO(vtl): Allowing this case is a temporary hack. It'll set up a 163 // TODO(vtl): Allowing this case is a temporary hack. It'll set up a
164 // |MessagePipe| with two proxy endpoints, which will then act as a proxy 164 // |MessagePipe| with two proxy endpoints, which will then act as a proxy
165 // (rather than trying to connect the two ends directly). 165 // (rather than trying to connect the two ends directly).
166 DLOG_IF(WARNING, 166 DLOG_IF(WARNING,
167 is_peer_open && 167 is_peer_open &&
168 endpoints_[GetPeerPort(port)]->GetType() != 168 endpoints_[GetPeerPort(port)]->GetType() !=
169 MessagePipeEndpoint::kTypeLocal) 169 MessagePipeEndpoint::kTypeLocal)
170 << "Direct message pipe passing across multiple channels not yet " 170 << "Direct message pipe passing across multiple channels not yet "
171 "implemented; will proxy"; 171 "implemented; will proxy";
172 172
173 scoped_ptr<MessagePipeEndpoint> old_endpoint(endpoints_[port].Pass());
173 scoped_refptr<ChannelEndpoint> channel_endpoint( 174 scoped_refptr<ChannelEndpoint> channel_endpoint(
174 new ChannelEndpoint(this, port)); 175 new ChannelEndpoint(this, port));
175 scoped_ptr<MessagePipeEndpoint> replacement_endpoint( 176 endpoints_[port].reset(
176 new ProxyMessagePipeEndpoint( 177 new ProxyMessagePipeEndpoint(channel_endpoint.get(), is_peer_open));
177 channel_endpoint.get(), 178 channel_endpoint->TakeMessages(static_cast<LocalMessagePipeEndpoint*>(
178 static_cast<LocalMessagePipeEndpoint*>(endpoints_[port].get()), 179 old_endpoint.get())->message_queue());
179 is_peer_open)); 180 old_endpoint->Close();
180 endpoints_[port].swap(replacement_endpoint);
181 181
182 return channel_endpoint; 182 return channel_endpoint;
183 } 183 }
184 184
185 MojoResult MessagePipe::EnqueueMessage(unsigned port, 185 MojoResult MessagePipe::EnqueueMessage(unsigned port,
186 scoped_ptr<MessageInTransit> message) { 186 scoped_ptr<MessageInTransit> message) {
187 return EnqueueMessageInternal(port, message.Pass(), nullptr); 187 return EnqueueMessageInternal(port, message.Pass(), nullptr);
188 } 188 }
189 189
190 bool MessagePipe::Attach(unsigned port, ChannelEndpoint* channel_endpoint) { 190 bool MessagePipe::Attach(unsigned port, ChannelEndpoint* channel_endpoint) {
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 MojoResult MessagePipe::HandleControlMessage( 314 MojoResult MessagePipe::HandleControlMessage(
315 unsigned /*port*/, 315 unsigned /*port*/,
316 scoped_ptr<MessageInTransit> message) { 316 scoped_ptr<MessageInTransit> message) {
317 LOG(WARNING) << "Unrecognized MessagePipe control message subtype " 317 LOG(WARNING) << "Unrecognized MessagePipe control message subtype "
318 << message->subtype(); 318 << message->subtype();
319 return MOJO_RESULT_UNKNOWN; 319 return MOJO_RESULT_UNKNOWN;
320 } 320 }
321 321
322 } // namespace system 322 } // namespace system
323 } // namespace mojo 323 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/system/local_message_pipe_endpoint.h ('k') | mojo/system/proxy_message_pipe_endpoint.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698