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

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

Issue 600523002: Mojo: Remove MessagePipe::Attach(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move_paused_message_queue-x-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/message_pipe.h ('k') | no next file » | 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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 old_endpoint->Close(); 180 old_endpoint->Close();
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) {
191 DCHECK(port == 0 || port == 1);
192 DCHECK(channel_endpoint);
193
194 base::AutoLock locker(lock_);
195 if (!endpoints_[port])
196 return false;
197
198 DCHECK_EQ(endpoints_[port]->GetType(), MessagePipeEndpoint::kTypeProxy);
199 return true;
200 }
201
202 void MessagePipe::Run(unsigned port) { 190 void MessagePipe::Run(unsigned port) {
203 DCHECK(port == 0 || port == 1); 191 DCHECK(port == 0 || port == 1);
204 192
205 base::AutoLock locker(lock_); 193 base::AutoLock locker(lock_);
206 DCHECK(endpoints_[port]); 194 DCHECK(endpoints_[port]);
207 if (!endpoints_[port]->Run()) 195 if (!endpoints_[port]->Run())
208 endpoints_[port].reset(); 196 endpoints_[port].reset();
209 } 197 }
210 198
211 void MessagePipe::OnRemove(unsigned port) { 199 void MessagePipe::OnRemove(unsigned port) {
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 MojoResult MessagePipe::HandleControlMessage( 302 MojoResult MessagePipe::HandleControlMessage(
315 unsigned /*port*/, 303 unsigned /*port*/,
316 scoped_ptr<MessageInTransit> message) { 304 scoped_ptr<MessageInTransit> message) {
317 LOG(WARNING) << "Unrecognized MessagePipe control message subtype " 305 LOG(WARNING) << "Unrecognized MessagePipe control message subtype "
318 << message->subtype(); 306 << message->subtype();
319 return MOJO_RESULT_UNKNOWN; 307 return MOJO_RESULT_UNKNOWN;
320 } 308 }
321 309
322 } // namespace system 310 } // namespace system
323 } // namespace mojo 311 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/system/message_pipe.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698