| 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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 size_t MessagePipeDispatcher::GetMaximumSerializedSizeImplNoLock( |
| 176 const Channel* /*channel*/) const { | 176 const Channel* /*channel*/) const { |
| 177 lock().AssertAcquired(); | 177 DCHECK(HasOneRef()); // Only one ref => no need to take the lock. |
| 178 return sizeof(SerializedMessagePipeDispatcher); | 178 return sizeof(SerializedMessagePipeDispatcher); |
| 179 } | 179 } |
| 180 | 180 |
| 181 bool MessagePipeDispatcher::SerializeAndCloseImplNoLock(Channel* channel, | 181 bool MessagePipeDispatcher::SerializeAndCloseImplNoLock(Channel* channel, |
| 182 void* destination, | 182 void* destination, |
| 183 size_t* actual_size) { | 183 size_t* actual_size) { |
| 184 lock().AssertAcquired(); | 184 DCHECK(HasOneRef()); // Only one ref => no need to take the lock. |
| 185 | 185 |
| 186 // Convert the local endpoint to a proxy endpoint (moving the message queue). | 186 // Convert the local endpoint to a proxy endpoint (moving the message queue). |
| 187 message_pipe_->ConvertLocalToProxy(port_); | 187 message_pipe_->ConvertLocalToProxy(port_); |
| 188 | 188 |
| 189 // Attach the new proxy endpoint to the channel. | 189 // Attach the new proxy endpoint to the channel. |
| 190 MessageInTransit::EndpointId endpoint_id = | 190 MessageInTransit::EndpointId endpoint_id = |
| 191 channel->AttachMessagePipeEndpoint(message_pipe_, port_); | 191 channel->AttachMessagePipeEndpoint(message_pipe_, port_); |
| 192 DCHECK_NE(endpoint_id, MessageInTransit::kInvalidEndpointId); | 192 DCHECK_NE(endpoint_id, MessageInTransit::kInvalidEndpointId); |
| 193 | 193 |
| 194 DVLOG(2) << "Serializing message pipe dispatcher (local ID = " << endpoint_id | 194 DVLOG(2) << "Serializing message pipe dispatcher (local ID = " << endpoint_id |
| (...skipping 13 matching lines...) Expand all Loading... |
| 208 | 208 |
| 209 // MessagePipeDispatcherTransport ---------------------------------------------- | 209 // MessagePipeDispatcherTransport ---------------------------------------------- |
| 210 | 210 |
| 211 MessagePipeDispatcherTransport::MessagePipeDispatcherTransport( | 211 MessagePipeDispatcherTransport::MessagePipeDispatcherTransport( |
| 212 DispatcherTransport transport) : DispatcherTransport(transport) { | 212 DispatcherTransport transport) : DispatcherTransport(transport) { |
| 213 DCHECK_EQ(message_pipe_dispatcher()->GetType(), Dispatcher::kTypeMessagePipe); | 213 DCHECK_EQ(message_pipe_dispatcher()->GetType(), Dispatcher::kTypeMessagePipe); |
| 214 } | 214 } |
| 215 | 215 |
| 216 } // namespace system | 216 } // namespace system |
| 217 } // namespace mojo | 217 } // namespace mojo |
| OLD | NEW |