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_dispatcher.h" | 5 #include "mojo/system/message_pipe_dispatcher.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/constants.h" | 9 #include "mojo/system/constants.h" |
10 #include "mojo/system/local_message_pipe_endpoint.h" | 10 #include "mojo/system/local_message_pipe_endpoint.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 | 63 |
64 // Checks for fields beyond |flags|: | 64 // Checks for fields beyond |flags|: |
65 | 65 |
66 // (Nothing here yet.) | 66 // (Nothing here yet.) |
67 | 67 |
68 return MOJO_RESULT_OK; | 68 return MOJO_RESULT_OK; |
69 } | 69 } |
70 | 70 |
71 void MessagePipeDispatcher::Init(scoped_refptr<MessagePipe> message_pipe, | 71 void MessagePipeDispatcher::Init(scoped_refptr<MessagePipe> message_pipe, |
72 unsigned port) { | 72 unsigned port) { |
73 DCHECK(message_pipe); | 73 DCHECK(message_pipe.get()); |
74 DCHECK(port == 0 || port == 1); | 74 DCHECK(port == 0 || port == 1); |
75 | 75 |
76 message_pipe_ = message_pipe; | 76 message_pipe_ = message_pipe; |
77 port_ = port; | 77 port_ = port; |
78 } | 78 } |
79 | 79 |
80 Dispatcher::Type MessagePipeDispatcher::GetType() const { | 80 Dispatcher::Type MessagePipeDispatcher::GetType() const { |
81 return kTypeMessagePipe; | 81 return kTypeMessagePipe; |
82 } | 82 } |
83 | 83 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 return scoped_refptr<MessagePipeDispatcher>(); | 133 return scoped_refptr<MessagePipeDispatcher>(); |
134 } | 134 } |
135 | 135 |
136 // TODO(vtl): FIXME -- Need some error handling here. | 136 // TODO(vtl): FIXME -- Need some error handling here. |
137 channel->RunRemoteMessagePipeEndpoint(local_id, remote_id); | 137 channel->RunRemoteMessagePipeEndpoint(local_id, remote_id); |
138 return remote_message_pipe.first; | 138 return remote_message_pipe.first; |
139 } | 139 } |
140 | 140 |
141 MessagePipeDispatcher::~MessagePipeDispatcher() { | 141 MessagePipeDispatcher::~MessagePipeDispatcher() { |
142 // |Close()|/|CloseImplNoLock()| should have taken care of the pipe. | 142 // |Close()|/|CloseImplNoLock()| should have taken care of the pipe. |
143 DCHECK(!message_pipe_); | 143 DCHECK(!message_pipe_.get()); |
144 } | 144 } |
145 | 145 |
146 MessagePipe* MessagePipeDispatcher::GetMessagePipeNoLock() const { | 146 MessagePipe* MessagePipeDispatcher::GetMessagePipeNoLock() const { |
147 lock().AssertAcquired(); | 147 lock().AssertAcquired(); |
148 return message_pipe_.get(); | 148 return message_pipe_.get(); |
149 } | 149 } |
150 | 150 |
151 unsigned MessagePipeDispatcher::GetPortNoLock() const { | 151 unsigned MessagePipeDispatcher::GetPortNoLock() const { |
152 lock().AssertAcquired(); | 152 lock().AssertAcquired(); |
153 return port_; | 153 return port_; |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 // MessagePipeDispatcherTransport ---------------------------------------------- | 276 // MessagePipeDispatcherTransport ---------------------------------------------- |
277 | 277 |
278 MessagePipeDispatcherTransport::MessagePipeDispatcherTransport( | 278 MessagePipeDispatcherTransport::MessagePipeDispatcherTransport( |
279 DispatcherTransport transport) | 279 DispatcherTransport transport) |
280 : DispatcherTransport(transport) { | 280 : DispatcherTransport(transport) { |
281 DCHECK_EQ(message_pipe_dispatcher()->GetType(), Dispatcher::kTypeMessagePipe); | 281 DCHECK_EQ(message_pipe_dispatcher()->GetType(), Dispatcher::kTypeMessagePipe); |
282 } | 282 } |
283 | 283 |
284 } // namespace system | 284 } // namespace system |
285 } // namespace mojo | 285 } // namespace mojo |
OLD | NEW |