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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 MojoResult wake_result) { | 165 MojoResult wake_result) { |
166 lock().AssertAcquired(); | 166 lock().AssertAcquired(); |
167 return message_pipe_->AddWaiter(port_, waiter, flags, wake_result); | 167 return message_pipe_->AddWaiter(port_, waiter, flags, wake_result); |
168 } | 168 } |
169 | 169 |
170 void MessagePipeDispatcher::RemoveWaiterImplNoLock(Waiter* waiter) { | 170 void MessagePipeDispatcher::RemoveWaiterImplNoLock(Waiter* waiter) { |
171 lock().AssertAcquired(); | 171 lock().AssertAcquired(); |
172 message_pipe_->RemoveWaiter(port_, waiter); | 172 message_pipe_->RemoveWaiter(port_, waiter); |
173 } | 173 } |
174 | 174 |
175 size_t MessagePipeDispatcher::GetMaximumSerializedSizeImplNoLock( | 175 void MessagePipeDispatcher::StartSerializeImplNoLock( |
176 const Channel* /*channel*/) const { | 176 Channel* /*channel*/, |
| 177 size_t* max_size, |
| 178 size_t* max_platform_handles) { |
177 DCHECK(HasOneRef()); // Only one ref => no need to take the lock. | 179 DCHECK(HasOneRef()); // Only one ref => no need to take the lock. |
178 return sizeof(SerializedMessagePipeDispatcher); | 180 *max_size = sizeof(SerializedMessagePipeDispatcher); |
| 181 *max_platform_handles = 0; |
179 } | 182 } |
180 | 183 |
181 bool MessagePipeDispatcher::SerializeAndCloseImplNoLock(Channel* channel, | 184 bool MessagePipeDispatcher::EndSerializeAndCloseImplNoLock( |
182 void* destination, | 185 Channel* channel, |
183 size_t* actual_size) { | 186 void* destination, |
| 187 size_t* actual_size, |
| 188 std::vector<embedder::PlatformHandle>* platform_handles) { |
184 DCHECK(HasOneRef()); // Only one ref => no need to take the lock. | 189 DCHECK(HasOneRef()); // Only one ref => no need to take the lock. |
185 | 190 |
186 // Convert the local endpoint to a proxy endpoint (moving the message queue). | 191 // Convert the local endpoint to a proxy endpoint (moving the message queue). |
187 message_pipe_->ConvertLocalToProxy(port_); | 192 message_pipe_->ConvertLocalToProxy(port_); |
188 | 193 |
189 // Attach the new proxy endpoint to the channel. | 194 // Attach the new proxy endpoint to the channel. |
190 MessageInTransit::EndpointId endpoint_id = | 195 MessageInTransit::EndpointId endpoint_id = |
191 channel->AttachMessagePipeEndpoint(message_pipe_, port_); | 196 channel->AttachMessagePipeEndpoint(message_pipe_, port_); |
192 DCHECK_NE(endpoint_id, MessageInTransit::kInvalidEndpointId); | 197 DCHECK_NE(endpoint_id, MessageInTransit::kInvalidEndpointId); |
193 | 198 |
(...skipping 14 matching lines...) Expand all Loading... |
208 | 213 |
209 // MessagePipeDispatcherTransport ---------------------------------------------- | 214 // MessagePipeDispatcherTransport ---------------------------------------------- |
210 | 215 |
211 MessagePipeDispatcherTransport::MessagePipeDispatcherTransport( | 216 MessagePipeDispatcherTransport::MessagePipeDispatcherTransport( |
212 DispatcherTransport transport) : DispatcherTransport(transport) { | 217 DispatcherTransport transport) : DispatcherTransport(transport) { |
213 DCHECK_EQ(message_pipe_dispatcher()->GetType(), Dispatcher::kTypeMessagePipe); | 218 DCHECK_EQ(message_pipe_dispatcher()->GetType(), Dispatcher::kTypeMessagePipe); |
214 } | 219 } |
215 | 220 |
216 } // namespace system | 221 } // namespace system |
217 } // namespace mojo | 222 } // namespace mojo |
OLD | NEW |