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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "mojo/edk/system/configuration.h" | 10 #include "mojo/edk/system/configuration.h" |
11 #include "mojo/edk/system/local_message_pipe_endpoint.h" | 11 #include "mojo/edk/system/local_message_pipe_endpoint.h" |
12 #include "mojo/edk/system/memory.h" | 12 #include "mojo/edk/system/memory.h" |
13 #include "mojo/edk/system/message_pipe.h" | 13 #include "mojo/edk/system/message_pipe.h" |
14 #include "mojo/edk/system/options_validation.h" | 14 #include "mojo/edk/system/options_validation.h" |
15 #include "mojo/edk/system/proxy_message_pipe_endpoint.h" | 15 #include "mojo/edk/system/proxy_message_pipe_endpoint.h" |
16 | 16 |
| 17 using mojo::embedder::ScopedPlatformHandle; |
17 using mojo::util::RefPtr; | 18 using mojo::util::RefPtr; |
18 | 19 |
19 namespace mojo { | 20 namespace mojo { |
20 namespace system { | 21 namespace system { |
21 | 22 |
22 const unsigned kInvalidPort = static_cast<unsigned>(-1); | 23 const unsigned kInvalidPort = static_cast<unsigned>(-1); |
23 | 24 |
24 // MessagePipeDispatcher ------------------------------------------------------- | 25 // MessagePipeDispatcher ------------------------------------------------------- |
25 | 26 |
26 // static | 27 // static |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 size_t* max_platform_handles) { | 198 size_t* max_platform_handles) { |
198 AssertHasOneRef(); // Only one ref => no need to take the lock. | 199 AssertHasOneRef(); // Only one ref => no need to take the lock. |
199 return message_pipe_->StartSerialize(port_, channel, max_size, | 200 return message_pipe_->StartSerialize(port_, channel, max_size, |
200 max_platform_handles); | 201 max_platform_handles); |
201 } | 202 } |
202 | 203 |
203 bool MessagePipeDispatcher::EndSerializeAndCloseImplNoLock( | 204 bool MessagePipeDispatcher::EndSerializeAndCloseImplNoLock( |
204 Channel* channel, | 205 Channel* channel, |
205 void* destination, | 206 void* destination, |
206 size_t* actual_size, | 207 size_t* actual_size, |
207 embedder::PlatformHandleVector* platform_handles) { | 208 std::vector<ScopedPlatformHandle>* platform_handles) { |
208 AssertHasOneRef(); // Only one ref => no need to take the lock. | 209 AssertHasOneRef(); // Only one ref => no need to take the lock. |
209 | 210 |
210 bool rv = message_pipe_->EndSerialize(port_, channel, destination, | 211 bool rv = message_pipe_->EndSerialize(port_, channel, destination, |
211 actual_size, platform_handles); | 212 actual_size, platform_handles); |
212 message_pipe_ = nullptr; | 213 message_pipe_ = nullptr; |
213 port_ = kInvalidPort; | 214 port_ = kInvalidPort; |
214 return rv; | 215 return rv; |
215 } | 216 } |
216 | 217 |
217 // MessagePipeDispatcherTransport ---------------------------------------------- | 218 // MessagePipeDispatcherTransport ---------------------------------------------- |
218 | 219 |
219 MessagePipeDispatcherTransport::MessagePipeDispatcherTransport( | 220 MessagePipeDispatcherTransport::MessagePipeDispatcherTransport( |
220 DispatcherTransport transport) | 221 DispatcherTransport transport) |
221 : DispatcherTransport(transport) { | 222 : DispatcherTransport(transport) { |
222 DCHECK_EQ(message_pipe_dispatcher()->GetType(), | 223 DCHECK_EQ(message_pipe_dispatcher()->GetType(), |
223 Dispatcher::Type::MESSAGE_PIPE); | 224 Dispatcher::Type::MESSAGE_PIPE); |
224 } | 225 } |
225 | 226 |
226 } // namespace system | 227 } // namespace system |
227 } // namespace mojo | 228 } // namespace mojo |
OLD | NEW |