| 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/dispatcher.h" | 5 #include "mojo/system/dispatcher.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "mojo/system/constants.h" | 8 #include "mojo/system/constants.h" |
| 9 #include "mojo/system/message_pipe_dispatcher.h" | 9 #include "mojo/system/message_pipe_dispatcher.h" |
| 10 #include "mojo/system/platform_handle_dispatcher.h" | 10 #include "mojo/system/platform_handle_dispatcher.h" |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 MojoResult Dispatcher::DuplicateBufferHandle( | 192 MojoResult Dispatcher::DuplicateBufferHandle( |
| 193 UserPointer<const MojoDuplicateBufferHandleOptions> options, | 193 UserPointer<const MojoDuplicateBufferHandleOptions> options, |
| 194 scoped_refptr<Dispatcher>* new_dispatcher) { | 194 scoped_refptr<Dispatcher>* new_dispatcher) { |
| 195 base::AutoLock locker(lock_); | 195 base::AutoLock locker(lock_); |
| 196 if (is_closed_) | 196 if (is_closed_) |
| 197 return MOJO_RESULT_INVALID_ARGUMENT; | 197 return MOJO_RESULT_INVALID_ARGUMENT; |
| 198 | 198 |
| 199 return DuplicateBufferHandleImplNoLock(options, new_dispatcher); | 199 return DuplicateBufferHandleImplNoLock(options, new_dispatcher); |
| 200 } | 200 } |
| 201 | 201 |
| 202 MojoResult Dispatcher::MapBuffer(uint64_t offset, | 202 MojoResult Dispatcher::MapBuffer( |
| 203 uint64_t num_bytes, | 203 uint64_t offset, |
| 204 MojoMapBufferFlags flags, | 204 uint64_t num_bytes, |
| 205 scoped_ptr<RawSharedBufferMapping>* mapping) { | 205 MojoMapBufferFlags flags, |
| 206 scoped_ptr<embedder::PlatformSharedBufferMapping>* mapping) { |
| 206 base::AutoLock locker(lock_); | 207 base::AutoLock locker(lock_); |
| 207 if (is_closed_) | 208 if (is_closed_) |
| 208 return MOJO_RESULT_INVALID_ARGUMENT; | 209 return MOJO_RESULT_INVALID_ARGUMENT; |
| 209 | 210 |
| 210 return MapBufferImplNoLock(offset, num_bytes, flags, mapping); | 211 return MapBufferImplNoLock(offset, num_bytes, flags, mapping); |
| 211 } | 212 } |
| 212 | 213 |
| 213 HandleSignalsState Dispatcher::GetHandleSignalsState() const { | 214 HandleSignalsState Dispatcher::GetHandleSignalsState() const { |
| 214 base::AutoLock locker(lock_); | 215 base::AutoLock locker(lock_); |
| 215 if (is_closed_) | 216 if (is_closed_) |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 lock_.AssertAcquired(); | 347 lock_.AssertAcquired(); |
| 347 DCHECK(!is_closed_); | 348 DCHECK(!is_closed_); |
| 348 // By default, not supported. Only needed for buffer dispatchers. | 349 // By default, not supported. Only needed for buffer dispatchers. |
| 349 return MOJO_RESULT_INVALID_ARGUMENT; | 350 return MOJO_RESULT_INVALID_ARGUMENT; |
| 350 } | 351 } |
| 351 | 352 |
| 352 MojoResult Dispatcher::MapBufferImplNoLock( | 353 MojoResult Dispatcher::MapBufferImplNoLock( |
| 353 uint64_t /*offset*/, | 354 uint64_t /*offset*/, |
| 354 uint64_t /*num_bytes*/, | 355 uint64_t /*num_bytes*/, |
| 355 MojoMapBufferFlags /*flags*/, | 356 MojoMapBufferFlags /*flags*/, |
| 356 scoped_ptr<RawSharedBufferMapping>* /*mapping*/) { | 357 scoped_ptr<embedder::PlatformSharedBufferMapping>* /*mapping*/) { |
| 357 lock_.AssertAcquired(); | 358 lock_.AssertAcquired(); |
| 358 DCHECK(!is_closed_); | 359 DCHECK(!is_closed_); |
| 359 // By default, not supported. Only needed for buffer dispatchers. | 360 // By default, not supported. Only needed for buffer dispatchers. |
| 360 return MOJO_RESULT_INVALID_ARGUMENT; | 361 return MOJO_RESULT_INVALID_ARGUMENT; |
| 361 } | 362 } |
| 362 | 363 |
| 363 HandleSignalsState Dispatcher::GetHandleSignalsStateImplNoLock() const { | 364 HandleSignalsState Dispatcher::GetHandleSignalsStateImplNoLock() const { |
| 364 lock_.AssertAcquired(); | 365 lock_.AssertAcquired(); |
| 365 DCHECK(!is_closed_); | 366 DCHECK(!is_closed_); |
| 366 // By default, waiting isn't supported. Only dispatchers that can be waited on | 367 // By default, waiting isn't supported. Only dispatchers that can be waited on |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 // DispatcherTransport --------------------------------------------------------- | 480 // DispatcherTransport --------------------------------------------------------- |
| 480 | 481 |
| 481 void DispatcherTransport::End() { | 482 void DispatcherTransport::End() { |
| 482 DCHECK(dispatcher_); | 483 DCHECK(dispatcher_); |
| 483 dispatcher_->lock_.Release(); | 484 dispatcher_->lock_.Release(); |
| 484 dispatcher_ = NULL; | 485 dispatcher_ = NULL; |
| 485 } | 486 } |
| 486 | 487 |
| 487 } // namespace system | 488 } // namespace system |
| 488 } // namespace mojo | 489 } // namespace mojo |
| OLD | NEW |