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/dispatcher.h" | 5 #include "mojo/edk/system/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/data_pipe_consumer_dispatcher.h" | 9 #include "mojo/edk/system/data_pipe_consumer_dispatcher.h" |
10 #include "mojo/edk/system/data_pipe_producer_dispatcher.h" | 10 #include "mojo/edk/system/data_pipe_producer_dispatcher.h" |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 if (is_closed_) | 201 if (is_closed_) |
202 return MOJO_RESULT_INVALID_ARGUMENT; | 202 return MOJO_RESULT_INVALID_ARGUMENT; |
203 | 203 |
204 return DuplicateBufferHandleImplNoLock(options, new_dispatcher); | 204 return DuplicateBufferHandleImplNoLock(options, new_dispatcher); |
205 } | 205 } |
206 | 206 |
207 MojoResult Dispatcher::MapBuffer( | 207 MojoResult Dispatcher::MapBuffer( |
208 uint64_t offset, | 208 uint64_t offset, |
209 uint64_t num_bytes, | 209 uint64_t num_bytes, |
210 MojoMapBufferFlags flags, | 210 MojoMapBufferFlags flags, |
211 scoped_ptr<embedder::PlatformSharedBufferMapping>* mapping) { | 211 std::unique_ptr<embedder::PlatformSharedBufferMapping>* mapping) { |
212 MutexLocker locker(&mutex_); | 212 MutexLocker locker(&mutex_); |
213 if (is_closed_) | 213 if (is_closed_) |
214 return MOJO_RESULT_INVALID_ARGUMENT; | 214 return MOJO_RESULT_INVALID_ARGUMENT; |
215 | 215 |
216 return MapBufferImplNoLock(offset, num_bytes, flags, mapping); | 216 return MapBufferImplNoLock(offset, num_bytes, flags, mapping); |
217 } | 217 } |
218 | 218 |
219 HandleSignalsState Dispatcher::GetHandleSignalsState() const { | 219 HandleSignalsState Dispatcher::GetHandleSignalsState() const { |
220 MutexLocker locker(&mutex_); | 220 MutexLocker locker(&mutex_); |
221 if (is_closed_) | 221 if (is_closed_) |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 mutex_.AssertHeld(); | 353 mutex_.AssertHeld(); |
354 DCHECK(!is_closed_); | 354 DCHECK(!is_closed_); |
355 // By default, not supported. Only needed for buffer dispatchers. | 355 // By default, not supported. Only needed for buffer dispatchers. |
356 return MOJO_RESULT_INVALID_ARGUMENT; | 356 return MOJO_RESULT_INVALID_ARGUMENT; |
357 } | 357 } |
358 | 358 |
359 MojoResult Dispatcher::MapBufferImplNoLock( | 359 MojoResult Dispatcher::MapBufferImplNoLock( |
360 uint64_t /*offset*/, | 360 uint64_t /*offset*/, |
361 uint64_t /*num_bytes*/, | 361 uint64_t /*num_bytes*/, |
362 MojoMapBufferFlags /*flags*/, | 362 MojoMapBufferFlags /*flags*/, |
363 scoped_ptr<embedder::PlatformSharedBufferMapping>* /*mapping*/) { | 363 std::unique_ptr<embedder::PlatformSharedBufferMapping>* /*mapping*/) { |
364 mutex_.AssertHeld(); | 364 mutex_.AssertHeld(); |
365 DCHECK(!is_closed_); | 365 DCHECK(!is_closed_); |
366 // By default, not supported. Only needed for buffer dispatchers. | 366 // By default, not supported. Only needed for buffer dispatchers. |
367 return MOJO_RESULT_INVALID_ARGUMENT; | 367 return MOJO_RESULT_INVALID_ARGUMENT; |
368 } | 368 } |
369 | 369 |
370 HandleSignalsState Dispatcher::GetHandleSignalsStateImplNoLock() const { | 370 HandleSignalsState Dispatcher::GetHandleSignalsStateImplNoLock() const { |
371 mutex_.AssertHeld(); | 371 mutex_.AssertHeld(); |
372 DCHECK(!is_closed_); | 372 DCHECK(!is_closed_); |
373 // By default, waiting isn't supported. Only dispatchers that can be waited on | 373 // By default, waiting isn't supported. Only dispatchers that can be waited on |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 // DispatcherTransport --------------------------------------------------------- | 487 // DispatcherTransport --------------------------------------------------------- |
488 | 488 |
489 void DispatcherTransport::End() { | 489 void DispatcherTransport::End() { |
490 DCHECK(dispatcher_); | 490 DCHECK(dispatcher_); |
491 dispatcher_->mutex_.Unlock(); | 491 dispatcher_->mutex_.Unlock(); |
492 dispatcher_ = nullptr; | 492 dispatcher_ = nullptr; |
493 } | 493 } |
494 | 494 |
495 } // namespace system | 495 } // namespace system |
496 } // namespace mojo | 496 } // namespace mojo |
OLD | NEW |