| 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/edk/system/message_pipe_dispatcher.h" | 5 #include "mojo/edk/system/message_pipe_dispatcher.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "mojo/edk/system/configuration.h" | 8 #include "mojo/edk/system/configuration.h" |
| 9 #include "mojo/edk/system/local_message_pipe_endpoint.h" | 9 #include "mojo/edk/system/local_message_pipe_endpoint.h" |
| 10 #include "mojo/edk/system/memory.h" | 10 #include "mojo/edk/system/memory.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 void MessagePipeDispatcher::Init(scoped_refptr<MessagePipe> message_pipe, | 61 void MessagePipeDispatcher::Init(scoped_refptr<MessagePipe> message_pipe, |
| 62 unsigned port) { | 62 unsigned port) { |
| 63 DCHECK(message_pipe); | 63 DCHECK(message_pipe); |
| 64 DCHECK(port == 0 || port == 1); | 64 DCHECK(port == 0 || port == 1); |
| 65 | 65 |
| 66 message_pipe_ = message_pipe; | 66 message_pipe_ = message_pipe; |
| 67 port_ = port; | 67 port_ = port; |
| 68 } | 68 } |
| 69 | 69 |
| 70 Dispatcher::Type MessagePipeDispatcher::GetType() const { | 70 Dispatcher::Type MessagePipeDispatcher::GetType() const { |
| 71 return kTypeMessagePipe; | 71 return Type::MESSAGE_PIPE; |
| 72 } | 72 } |
| 73 | 73 |
| 74 // static | 74 // static |
| 75 scoped_refptr<MessagePipeDispatcher> | 75 scoped_refptr<MessagePipeDispatcher> |
| 76 MessagePipeDispatcher::CreateRemoteMessagePipe( | 76 MessagePipeDispatcher::CreateRemoteMessagePipe( |
| 77 scoped_refptr<ChannelEndpoint>* channel_endpoint) { | 77 scoped_refptr<ChannelEndpoint>* channel_endpoint) { |
| 78 scoped_refptr<MessagePipe> message_pipe( | 78 scoped_refptr<MessagePipe> message_pipe( |
| 79 MessagePipe::CreateLocalProxy(channel_endpoint)); | 79 MessagePipe::CreateLocalProxy(channel_endpoint)); |
| 80 scoped_refptr<MessagePipeDispatcher> dispatcher( | 80 scoped_refptr<MessagePipeDispatcher> dispatcher( |
| 81 new MessagePipeDispatcher(MessagePipeDispatcher::kDefaultCreateOptions)); | 81 new MessagePipeDispatcher(MessagePipeDispatcher::kDefaultCreateOptions)); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 message_pipe_ = nullptr; | 216 message_pipe_ = nullptr; |
| 217 port_ = kInvalidPort; | 217 port_ = kInvalidPort; |
| 218 return rv; | 218 return rv; |
| 219 } | 219 } |
| 220 | 220 |
| 221 // MessagePipeDispatcherTransport ---------------------------------------------- | 221 // MessagePipeDispatcherTransport ---------------------------------------------- |
| 222 | 222 |
| 223 MessagePipeDispatcherTransport::MessagePipeDispatcherTransport( | 223 MessagePipeDispatcherTransport::MessagePipeDispatcherTransport( |
| 224 DispatcherTransport transport) | 224 DispatcherTransport transport) |
| 225 : DispatcherTransport(transport) { | 225 : DispatcherTransport(transport) { |
| 226 DCHECK_EQ(message_pipe_dispatcher()->GetType(), Dispatcher::kTypeMessagePipe); | 226 DCHECK_EQ(message_pipe_dispatcher()->GetType(), |
| 227 Dispatcher::Type::MESSAGE_PIPE); |
| 227 } | 228 } |
| 228 | 229 |
| 229 } // namespace system | 230 } // namespace system |
| 230 } // namespace mojo | 231 } // namespace mojo |
| OLD | NEW |