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

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

Issue 566783002: Mojo: Remove DCHECK disallowing passing of a remote message pipe. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 | « no previous file | mojo/system/remote_message_pipe_unittest.cc » ('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.h" 8 #include "mojo/system/channel.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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 148
149 void MessagePipe::ConvertLocalToProxy(unsigned port) { 149 void MessagePipe::ConvertLocalToProxy(unsigned port) {
150 DCHECK(port == 0 || port == 1); 150 DCHECK(port == 0 || port == 1);
151 151
152 base::AutoLock locker(lock_); 152 base::AutoLock locker(lock_);
153 DCHECK(endpoints_[port]); 153 DCHECK(endpoints_[port]);
154 DCHECK_EQ(endpoints_[port]->GetType(), MessagePipeEndpoint::kTypeLocal); 154 DCHECK_EQ(endpoints_[port]->GetType(), MessagePipeEndpoint::kTypeLocal);
155 155
156 bool is_peer_open = !!endpoints_[GetPeerPort(port)]; 156 bool is_peer_open = !!endpoints_[GetPeerPort(port)];
157 157
158 // TODO(vtl): Hopefully this will work if the peer has been closed and when 158 // TODO(vtl): Allowing this case is a temporary hack. It'll set up a
159 // the peer is local. If the peer is remote, we should do something more 159 // |MessagePipe| with two proxy endpoints, which will then act as a proxy
160 // sophisticated. 160 // (rather than trying to connect the two ends directly).
161 DCHECK(!is_peer_open || 161 DLOG_IF(WARNING,
162 endpoints_[GetPeerPort(port)]->GetType() == 162 is_peer_open &&
163 MessagePipeEndpoint::kTypeLocal); 163 endpoints_[GetPeerPort(port)]->GetType() !=
164 MessagePipeEndpoint::kTypeLocal)
165 << "Direct message pipe passing across multiple channels not yet "
166 "implemented; will proxy";
164 167
165 scoped_ptr<MessagePipeEndpoint> replacement_endpoint( 168 scoped_ptr<MessagePipeEndpoint> replacement_endpoint(
166 new ProxyMessagePipeEndpoint( 169 new ProxyMessagePipeEndpoint(
167 static_cast<LocalMessagePipeEndpoint*>(endpoints_[port].get()), 170 static_cast<LocalMessagePipeEndpoint*>(endpoints_[port].get()),
168 is_peer_open)); 171 is_peer_open));
169 endpoints_[port].swap(replacement_endpoint); 172 endpoints_[port].swap(replacement_endpoint);
170 } 173 }
171 174
172 MojoResult MessagePipe::EnqueueMessage(unsigned port, 175 MojoResult MessagePipe::EnqueueMessage(unsigned port,
173 scoped_ptr<MessageInTransit> message) { 176 scoped_ptr<MessageInTransit> message) {
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 MojoResult MessagePipe::HandleControlMessage( 306 MojoResult MessagePipe::HandleControlMessage(
304 unsigned /*port*/, 307 unsigned /*port*/,
305 scoped_ptr<MessageInTransit> message) { 308 scoped_ptr<MessageInTransit> message) {
306 LOG(WARNING) << "Unrecognized MessagePipe control message subtype " 309 LOG(WARNING) << "Unrecognized MessagePipe control message subtype "
307 << message->subtype(); 310 << message->subtype();
308 return MOJO_RESULT_UNKNOWN; 311 return MOJO_RESULT_UNKNOWN;
309 } 312 }
310 313
311 } // namespace system 314 } // namespace system
312 } // namespace mojo 315 } // namespace mojo
OLDNEW
« no previous file with comments | « no previous file | mojo/system/remote_message_pipe_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698