OLD | NEW |
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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 | 155 |
156 MojoResult MessagePipe::EnqueueMessage(unsigned port, | 156 MojoResult MessagePipe::EnqueueMessage(unsigned port, |
157 scoped_ptr<MessageInTransit> message) { | 157 scoped_ptr<MessageInTransit> message) { |
158 return EnqueueMessageInternal(port, message.Pass(), NULL); | 158 return EnqueueMessageInternal(port, message.Pass(), NULL); |
159 } | 159 } |
160 | 160 |
161 bool MessagePipe::Attach(unsigned port, | 161 bool MessagePipe::Attach(unsigned port, |
162 scoped_refptr<Channel> channel, | 162 scoped_refptr<Channel> channel, |
163 MessageInTransit::EndpointId local_id) { | 163 MessageInTransit::EndpointId local_id) { |
164 DCHECK(port == 0 || port == 1); | 164 DCHECK(port == 0 || port == 1); |
165 DCHECK(channel); | 165 DCHECK(channel.get()); |
166 DCHECK_NE(local_id, MessageInTransit::kInvalidEndpointId); | 166 DCHECK_NE(local_id, MessageInTransit::kInvalidEndpointId); |
167 | 167 |
168 base::AutoLock locker(lock_); | 168 base::AutoLock locker(lock_); |
169 if (!endpoints_[port]) | 169 if (!endpoints_[port]) |
170 return false; | 170 return false; |
171 | 171 |
172 DCHECK_EQ(endpoints_[port]->GetType(), MessagePipeEndpoint::kTypeProxy); | 172 DCHECK_EQ(endpoints_[port]->GetType(), MessagePipeEndpoint::kTypeProxy); |
173 endpoints_[port]->Attach(channel, local_id); | 173 endpoints_[port]->Attach(channel, local_id); |
174 return true; | 174 return true; |
175 } | 175 } |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 MojoResult MessagePipe::HandleControlMessage( | 287 MojoResult MessagePipe::HandleControlMessage( |
288 unsigned /*port*/, | 288 unsigned /*port*/, |
289 scoped_ptr<MessageInTransit> message) { | 289 scoped_ptr<MessageInTransit> message) { |
290 LOG(WARNING) << "Unrecognized MessagePipe control message subtype " | 290 LOG(WARNING) << "Unrecognized MessagePipe control message subtype " |
291 << message->subtype(); | 291 << message->subtype(); |
292 return MOJO_RESULT_UNKNOWN; | 292 return MOJO_RESULT_UNKNOWN; |
293 } | 293 } |
294 | 294 |
295 } // namespace system | 295 } // namespace system |
296 } // namespace mojo | 296 } // namespace mojo |
OLD | NEW |