| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/shared_buffer_dispatcher.h" | 5 #include "mojo/edk/system/shared_buffer_dispatcher.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 | 212 |
| 213 return MOJO_RESULT_OK; | 213 return MOJO_RESULT_OK; |
| 214 } | 214 } |
| 215 | 215 |
| 216 void SharedBufferDispatcher::CloseImplNoLock() { | 216 void SharedBufferDispatcher::CloseImplNoLock() { |
| 217 mutex().AssertHeld(); | 217 mutex().AssertHeld(); |
| 218 DCHECK(shared_buffer_); | 218 DCHECK(shared_buffer_); |
| 219 shared_buffer_ = nullptr; | 219 shared_buffer_ = nullptr; |
| 220 } | 220 } |
| 221 | 221 |
| 222 MojoResult SharedBufferDispatcher::DuplicateDispatcherImplNoLock( |
| 223 util::RefPtr<Dispatcher>* new_dispatcher) { |
| 224 mutex().AssertHeld(); |
| 225 |
| 226 // Note: Since this is "duplicate", we keep our ref to |shared_buffer_|. |
| 227 *new_dispatcher = CreateInternal(shared_buffer_.Clone()); |
| 228 return MOJO_RESULT_OK; |
| 229 } |
| 230 |
| 222 RefPtr<Dispatcher> | 231 RefPtr<Dispatcher> |
| 223 SharedBufferDispatcher::CreateEquivalentDispatcherAndCloseImplNoLock( | 232 SharedBufferDispatcher::CreateEquivalentDispatcherAndCloseImplNoLock( |
| 224 MessagePipe* /*message_pipe*/, | 233 MessagePipe* /*message_pipe*/, |
| 225 unsigned /*port*/) { | 234 unsigned /*port*/) { |
| 226 mutex().AssertHeld(); | 235 mutex().AssertHeld(); |
| 227 | 236 |
| 228 CancelAllAwakablesNoLock(); | 237 CancelAllAwakablesNoLock(); |
| 229 | 238 |
| 230 DCHECK(shared_buffer_); | 239 DCHECK(shared_buffer_); |
| 231 return CreateInternal(std::move(shared_buffer_)); | 240 return CreateInternal(std::move(shared_buffer_)); |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 platform_handles->push_back(std::move(platform_handle)); | 339 platform_handles->push_back(std::move(platform_handle)); |
| 331 *actual_size = sizeof(SerializedSharedBufferDispatcher); | 340 *actual_size = sizeof(SerializedSharedBufferDispatcher); |
| 332 | 341 |
| 333 shared_buffer_ = nullptr; | 342 shared_buffer_ = nullptr; |
| 334 | 343 |
| 335 return true; | 344 return true; |
| 336 } | 345 } |
| 337 | 346 |
| 338 } // namespace system | 347 } // namespace system |
| 339 } // namespace mojo | 348 } // namespace mojo |
| OLD | NEW |