| 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 MessagePipe* MessagePipeDispatcher::GetMessagePipeNoLock() const { | 109 MessagePipe* MessagePipeDispatcher::GetMessagePipeNoLock() const { |
| 110 lock().AssertAcquired(); | 110 lock().AssertAcquired(); |
| 111 return message_pipe_.get(); | 111 return message_pipe_.get(); |
| 112 } | 112 } |
| 113 | 113 |
| 114 unsigned MessagePipeDispatcher::GetPortNoLock() const { | 114 unsigned MessagePipeDispatcher::GetPortNoLock() const { |
| 115 lock().AssertAcquired(); | 115 lock().AssertAcquired(); |
| 116 return port_; | 116 return port_; |
| 117 } | 117 } |
| 118 | 118 |
| 119 void MessagePipeDispatcher::CancelAllWaitersNoLock() { | 119 void MessagePipeDispatcher::CancelAllAwakablesNoLock() { |
| 120 lock().AssertAcquired(); | 120 lock().AssertAcquired(); |
| 121 message_pipe_->CancelAllWaiters(port_); | 121 message_pipe_->CancelAllAwakables(port_); |
| 122 } | 122 } |
| 123 | 123 |
| 124 void MessagePipeDispatcher::CloseImplNoLock() { | 124 void MessagePipeDispatcher::CloseImplNoLock() { |
| 125 lock().AssertAcquired(); | 125 lock().AssertAcquired(); |
| 126 message_pipe_->Close(port_); | 126 message_pipe_->Close(port_); |
| 127 message_pipe_ = nullptr; | 127 message_pipe_ = nullptr; |
| 128 port_ = kInvalidPort; | 128 port_ = kInvalidPort; |
| 129 } | 129 } |
| 130 | 130 |
| 131 scoped_refptr<Dispatcher> | 131 scoped_refptr<Dispatcher> |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 return message_pipe_->ReadMessage(port_, bytes, num_bytes, dispatchers, | 171 return message_pipe_->ReadMessage(port_, bytes, num_bytes, dispatchers, |
| 172 num_dispatchers, flags); | 172 num_dispatchers, flags); |
| 173 } | 173 } |
| 174 | 174 |
| 175 HandleSignalsState MessagePipeDispatcher::GetHandleSignalsStateImplNoLock() | 175 HandleSignalsState MessagePipeDispatcher::GetHandleSignalsStateImplNoLock() |
| 176 const { | 176 const { |
| 177 lock().AssertAcquired(); | 177 lock().AssertAcquired(); |
| 178 return message_pipe_->GetHandleSignalsState(port_); | 178 return message_pipe_->GetHandleSignalsState(port_); |
| 179 } | 179 } |
| 180 | 180 |
| 181 MojoResult MessagePipeDispatcher::AddWaiterImplNoLock( | 181 MojoResult MessagePipeDispatcher::AddAwakableImplNoLock( |
| 182 Waiter* waiter, | 182 Awakable* awakable, |
| 183 MojoHandleSignals signals, | 183 MojoHandleSignals signals, |
| 184 uint32_t context, | 184 uint32_t context, |
| 185 HandleSignalsState* signals_state) { | 185 HandleSignalsState* signals_state) { |
| 186 lock().AssertAcquired(); | 186 lock().AssertAcquired(); |
| 187 return message_pipe_->AddWaiter(port_, waiter, signals, context, | 187 return message_pipe_->AddAwakable(port_, awakable, signals, context, |
| 188 signals_state); | 188 signals_state); |
| 189 } | 189 } |
| 190 | 190 |
| 191 void MessagePipeDispatcher::RemoveWaiterImplNoLock( | 191 void MessagePipeDispatcher::RemoveAwakableImplNoLock( |
| 192 Waiter* waiter, | 192 Awakable* awakable, |
| 193 HandleSignalsState* signals_state) { | 193 HandleSignalsState* signals_state) { |
| 194 lock().AssertAcquired(); | 194 lock().AssertAcquired(); |
| 195 message_pipe_->RemoveWaiter(port_, waiter, signals_state); | 195 message_pipe_->RemoveAwakable(port_, awakable, signals_state); |
| 196 } | 196 } |
| 197 | 197 |
| 198 void MessagePipeDispatcher::StartSerializeImplNoLock( | 198 void MessagePipeDispatcher::StartSerializeImplNoLock( |
| 199 Channel* channel, | 199 Channel* channel, |
| 200 size_t* max_size, | 200 size_t* max_size, |
| 201 size_t* max_platform_handles) { | 201 size_t* max_platform_handles) { |
| 202 DCHECK(HasOneRef()); // Only one ref => no need to take the lock. | 202 DCHECK(HasOneRef()); // Only one ref => no need to take the lock. |
| 203 return message_pipe_->StartSerialize(port_, channel, max_size, | 203 return message_pipe_->StartSerialize(port_, channel, max_size, |
| 204 max_platform_handles); | 204 max_platform_handles); |
| 205 } | 205 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 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(), Dispatcher::kTypeMessagePipe); |
| 227 } | 227 } |
| 228 | 228 |
| 229 } // namespace system | 229 } // namespace system |
| 230 } // namespace mojo | 230 } // namespace mojo |
| OLD | NEW |