| 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 } | 157 } |
| 158 | 158 |
| 159 MojoResult Dispatcher::EndWriteData(uint32_t num_bytes_written) { | 159 MojoResult Dispatcher::EndWriteData(uint32_t num_bytes_written) { |
| 160 base::AutoLock locker(lock_); | 160 base::AutoLock locker(lock_); |
| 161 if (is_closed_) | 161 if (is_closed_) |
| 162 return MOJO_RESULT_INVALID_ARGUMENT; | 162 return MOJO_RESULT_INVALID_ARGUMENT; |
| 163 | 163 |
| 164 return EndWriteDataImplNoLock(num_bytes_written); | 164 return EndWriteDataImplNoLock(num_bytes_written); |
| 165 } | 165 } |
| 166 | 166 |
| 167 MojoResult Dispatcher::ReadData(void* elements, | 167 MojoResult Dispatcher::ReadData(UserPointer<void> elements, |
| 168 uint32_t* num_bytes, | 168 UserPointer<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(UserPointer<const void*> buffer, | 177 MojoResult Dispatcher::BeginReadData(UserPointer<const void*> buffer, |
| 178 UserPointer<uint32_t> buffer_num_bytes, | 178 UserPointer<uint32_t> buffer_num_bytes, |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 return MOJO_RESULT_INVALID_ARGUMENT; | 296 return MOJO_RESULT_INVALID_ARGUMENT; |
| 297 } | 297 } |
| 298 | 298 |
| 299 MojoResult Dispatcher::EndWriteDataImplNoLock(uint32_t /*num_bytes_written*/) { | 299 MojoResult Dispatcher::EndWriteDataImplNoLock(uint32_t /*num_bytes_written*/) { |
| 300 lock_.AssertAcquired(); | 300 lock_.AssertAcquired(); |
| 301 DCHECK(!is_closed_); | 301 DCHECK(!is_closed_); |
| 302 // By default, not supported. Only needed for data pipe dispatchers. | 302 // By default, not supported. Only needed for data pipe dispatchers. |
| 303 return MOJO_RESULT_INVALID_ARGUMENT; | 303 return MOJO_RESULT_INVALID_ARGUMENT; |
| 304 } | 304 } |
| 305 | 305 |
| 306 MojoResult Dispatcher::ReadDataImplNoLock(void* /*elements*/, | 306 MojoResult Dispatcher::ReadDataImplNoLock(UserPointer<void> /*elements*/, |
| 307 uint32_t* /*num_bytes*/, | 307 UserPointer<uint32_t> /*num_bytes*/, |
| 308 MojoReadDataFlags /*flags*/) { | 308 MojoReadDataFlags /*flags*/) { |
| 309 lock_.AssertAcquired(); | 309 lock_.AssertAcquired(); |
| 310 DCHECK(!is_closed_); | 310 DCHECK(!is_closed_); |
| 311 // By default, not supported. Only needed for data pipe dispatchers. | 311 // By default, not supported. Only needed for data pipe dispatchers. |
| 312 return MOJO_RESULT_INVALID_ARGUMENT; | 312 return MOJO_RESULT_INVALID_ARGUMENT; |
| 313 } | 313 } |
| 314 | 314 |
| 315 MojoResult Dispatcher::BeginReadDataImplNoLock( | 315 MojoResult Dispatcher::BeginReadDataImplNoLock( |
| 316 UserPointer<const void*> /*buffer*/, | 316 UserPointer<const void*> /*buffer*/, |
| 317 UserPointer<uint32_t> /*buffer_num_bytes*/, | 317 UserPointer<uint32_t> /*buffer_num_bytes*/, |
| (...skipping 137 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 |