| 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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 MojoResult Dispatcher::ReadData(void* elements, | 167 MojoResult Dispatcher::ReadData(void* elements, |
| 168 uint32_t* num_bytes, | 168 uint32_t* num_bytes, |
| 169 MojoReadDataFlags flags) { | 169 MojoReadDataFlags flags) { |
| 170 base::AutoLock locker(lock_); | 170 base::AutoLock locker(lock_); |
| 171 if (is_closed_) | 171 if (is_closed_) |
| 172 return MOJO_RESULT_INVALID_ARGUMENT; | 172 return MOJO_RESULT_INVALID_ARGUMENT; |
| 173 | 173 |
| 174 return ReadDataImplNoLock(elements, num_bytes, flags); | 174 return ReadDataImplNoLock(elements, num_bytes, flags); |
| 175 } | 175 } |
| 176 | 176 |
| 177 MojoResult Dispatcher::BeginReadData(const void** buffer, | 177 MojoResult Dispatcher::BeginReadData(UserPointer<const void*> buffer, |
| 178 uint32_t* buffer_num_bytes, | 178 UserPointer<uint32_t> buffer_num_bytes, |
| 179 MojoReadDataFlags flags) { | 179 MojoReadDataFlags flags) { |
| 180 base::AutoLock locker(lock_); | 180 base::AutoLock locker(lock_); |
| 181 if (is_closed_) | 181 if (is_closed_) |
| 182 return MOJO_RESULT_INVALID_ARGUMENT; | 182 return MOJO_RESULT_INVALID_ARGUMENT; |
| 183 | 183 |
| 184 return BeginReadDataImplNoLock(buffer, buffer_num_bytes, flags); | 184 return BeginReadDataImplNoLock(buffer, buffer_num_bytes, flags); |
| 185 } | 185 } |
| 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_); |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 | 304 |
| 305 MojoResult Dispatcher::ReadDataImplNoLock(void* /*elements*/, | 305 MojoResult Dispatcher::ReadDataImplNoLock(void* /*elements*/, |
| 306 uint32_t* /*num_bytes*/, | 306 uint32_t* /*num_bytes*/, |
| 307 MojoReadDataFlags /*flags*/) { | 307 MojoReadDataFlags /*flags*/) { |
| 308 lock_.AssertAcquired(); | 308 lock_.AssertAcquired(); |
| 309 DCHECK(!is_closed_); | 309 DCHECK(!is_closed_); |
| 310 // By default, not supported. Only needed for data pipe dispatchers. | 310 // By default, not supported. Only needed for data pipe dispatchers. |
| 311 return MOJO_RESULT_INVALID_ARGUMENT; | 311 return MOJO_RESULT_INVALID_ARGUMENT; |
| 312 } | 312 } |
| 313 | 313 |
| 314 MojoResult Dispatcher::BeginReadDataImplNoLock(const void** /*buffer*/, | 314 MojoResult Dispatcher::BeginReadDataImplNoLock( |
| 315 uint32_t* /*buffer_num_bytes*/, | 315 UserPointer<const void*> /*buffer*/, |
| 316 MojoReadDataFlags /*flags*/) { | 316 UserPointer<uint32_t> /*buffer_num_bytes*/, |
| 317 MojoReadDataFlags /*flags*/) { |
| 317 lock_.AssertAcquired(); | 318 lock_.AssertAcquired(); |
| 318 DCHECK(!is_closed_); | 319 DCHECK(!is_closed_); |
| 319 // By default, not supported. Only needed for data pipe dispatchers. | 320 // By default, not supported. Only needed for data pipe dispatchers. |
| 320 return MOJO_RESULT_INVALID_ARGUMENT; | 321 return MOJO_RESULT_INVALID_ARGUMENT; |
| 321 } | 322 } |
| 322 | 323 |
| 323 MojoResult Dispatcher::EndReadDataImplNoLock(uint32_t /*num_bytes_read*/) { | 324 MojoResult Dispatcher::EndReadDataImplNoLock(uint32_t /*num_bytes_read*/) { |
| 324 lock_.AssertAcquired(); | 325 lock_.AssertAcquired(); |
| 325 DCHECK(!is_closed_); | 326 DCHECK(!is_closed_); |
| 326 // By default, not supported. Only needed for data pipe dispatchers. | 327 // By default, not supported. Only needed for data pipe dispatchers. |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 // DispatcherTransport --------------------------------------------------------- | 454 // DispatcherTransport --------------------------------------------------------- |
| 454 | 455 |
| 455 void DispatcherTransport::End() { | 456 void DispatcherTransport::End() { |
| 456 DCHECK(dispatcher_); | 457 DCHECK(dispatcher_); |
| 457 dispatcher_->lock_.Release(); | 458 dispatcher_->lock_.Release(); |
| 458 dispatcher_ = NULL; | 459 dispatcher_ = NULL; |
| 459 } | 460 } |
| 460 | 461 |
| 461 } // namespace system | 462 } // namespace system |
| 462 } // namespace mojo | 463 } // namespace mojo |
| OLD | NEW |