| 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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 | 186 |
| 187 MojoResult Dispatcher::EndReadData(uint32_t num_bytes_read) { | 187 MojoResult Dispatcher::EndReadData(uint32_t num_bytes_read) { |
| 188 base::AutoLock locker(lock_); | 188 base::AutoLock locker(lock_); |
| 189 if (is_closed_) | 189 if (is_closed_) |
| 190 return MOJO_RESULT_INVALID_ARGUMENT; | 190 return MOJO_RESULT_INVALID_ARGUMENT; |
| 191 | 191 |
| 192 return EndReadDataImplNoLock(num_bytes_read); | 192 return EndReadDataImplNoLock(num_bytes_read); |
| 193 } | 193 } |
| 194 | 194 |
| 195 MojoResult Dispatcher::DuplicateBufferHandle( | 195 MojoResult Dispatcher::DuplicateBufferHandle( |
| 196 const MojoDuplicateBufferHandleOptions* options, | 196 UserPointer<const MojoDuplicateBufferHandleOptions> options, |
| 197 scoped_refptr<Dispatcher>* new_dispatcher) { | 197 scoped_refptr<Dispatcher>* new_dispatcher) { |
| 198 base::AutoLock locker(lock_); | 198 base::AutoLock locker(lock_); |
| 199 if (is_closed_) | 199 if (is_closed_) |
| 200 return MOJO_RESULT_INVALID_ARGUMENT; | 200 return MOJO_RESULT_INVALID_ARGUMENT; |
| 201 | 201 |
| 202 return DuplicateBufferHandleImplNoLock(options, new_dispatcher); | 202 return DuplicateBufferHandleImplNoLock(options, new_dispatcher); |
| 203 } | 203 } |
| 204 | 204 |
| 205 MojoResult Dispatcher::MapBuffer( | 205 MojoResult Dispatcher::MapBuffer( |
| 206 uint64_t offset, | 206 uint64_t offset, |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 } | 323 } |
| 324 | 324 |
| 325 MojoResult Dispatcher::EndReadDataImplNoLock(uint32_t /*num_bytes_read*/) { | 325 MojoResult Dispatcher::EndReadDataImplNoLock(uint32_t /*num_bytes_read*/) { |
| 326 lock_.AssertAcquired(); | 326 lock_.AssertAcquired(); |
| 327 DCHECK(!is_closed_); | 327 DCHECK(!is_closed_); |
| 328 // By default, not supported. Only needed for data pipe dispatchers. | 328 // By default, not supported. Only needed for data pipe dispatchers. |
| 329 return MOJO_RESULT_INVALID_ARGUMENT; | 329 return MOJO_RESULT_INVALID_ARGUMENT; |
| 330 } | 330 } |
| 331 | 331 |
| 332 MojoResult Dispatcher::DuplicateBufferHandleImplNoLock( | 332 MojoResult Dispatcher::DuplicateBufferHandleImplNoLock( |
| 333 const MojoDuplicateBufferHandleOptions* /*options*/, | 333 UserPointer<const MojoDuplicateBufferHandleOptions> /*options*/, |
| 334 scoped_refptr<Dispatcher>* /*new_dispatcher*/) { | 334 scoped_refptr<Dispatcher>* /*new_dispatcher*/) { |
| 335 lock_.AssertAcquired(); | 335 lock_.AssertAcquired(); |
| 336 DCHECK(!is_closed_); | 336 DCHECK(!is_closed_); |
| 337 // By default, not supported. Only needed for buffer dispatchers. | 337 // By default, not supported. Only needed for buffer dispatchers. |
| 338 return MOJO_RESULT_INVALID_ARGUMENT; | 338 return MOJO_RESULT_INVALID_ARGUMENT; |
| 339 } | 339 } |
| 340 | 340 |
| 341 MojoResult Dispatcher::MapBufferImplNoLock( | 341 MojoResult Dispatcher::MapBufferImplNoLock( |
| 342 uint64_t /*offset*/, | 342 uint64_t /*offset*/, |
| 343 uint64_t /*num_bytes*/, | 343 uint64_t /*num_bytes*/, |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 // DispatcherTransport --------------------------------------------------------- | 455 // DispatcherTransport --------------------------------------------------------- |
| 456 | 456 |
| 457 void DispatcherTransport::End() { | 457 void DispatcherTransport::End() { |
| 458 DCHECK(dispatcher_); | 458 DCHECK(dispatcher_); |
| 459 dispatcher_->lock_.Release(); | 459 dispatcher_->lock_.Release(); |
| 460 dispatcher_ = NULL; | 460 dispatcher_ = NULL; |
| 461 } | 461 } |
| 462 | 462 |
| 463 } // namespace system | 463 } // namespace system |
| 464 } // namespace mojo | 464 } // namespace mojo |
| OLD | NEW |