| 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/data_pipe_consumer_dispatcher.h" | 5 #include "mojo/edk/system/data_pipe_consumer_dispatcher.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "mojo/edk/system/data_pipe.h" | 8 #include "mojo/edk/system/data_pipe.h" |
| 9 #include "mojo/edk/system/memory.h" | 9 #include "mojo/edk/system/memory.h" |
| 10 | 10 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 UserPointer<uint32_t> buffer_num_bytes, | 105 UserPointer<uint32_t> buffer_num_bytes, |
| 106 MojoReadDataFlags flags) { | 106 MojoReadDataFlags flags) { |
| 107 mutex().AssertHeld(); | 107 mutex().AssertHeld(); |
| 108 | 108 |
| 109 // These flags may not be used in two-phase mode. | 109 // These flags may not be used in two-phase mode. |
| 110 if ((flags & MOJO_READ_DATA_FLAG_ALL_OR_NONE) || | 110 if ((flags & MOJO_READ_DATA_FLAG_ALL_OR_NONE) || |
| 111 (flags & MOJO_READ_DATA_FLAG_DISCARD) || | 111 (flags & MOJO_READ_DATA_FLAG_DISCARD) || |
| 112 (flags & MOJO_READ_DATA_FLAG_QUERY) || (flags & MOJO_READ_DATA_FLAG_PEEK)) | 112 (flags & MOJO_READ_DATA_FLAG_QUERY) || (flags & MOJO_READ_DATA_FLAG_PEEK)) |
| 113 return MOJO_RESULT_INVALID_ARGUMENT; | 113 return MOJO_RESULT_INVALID_ARGUMENT; |
| 114 | 114 |
| 115 // TODO(vtl): Remove all-or-none support at lower levels. | 115 return data_pipe_->ConsumerBeginReadData(buffer, buffer_num_bytes); |
| 116 return data_pipe_->ConsumerBeginReadData(buffer, buffer_num_bytes, false); | |
| 117 } | 116 } |
| 118 | 117 |
| 119 MojoResult DataPipeConsumerDispatcher::EndReadDataImplNoLock( | 118 MojoResult DataPipeConsumerDispatcher::EndReadDataImplNoLock( |
| 120 uint32_t num_bytes_read) { | 119 uint32_t num_bytes_read) { |
| 121 mutex().AssertHeld(); | 120 mutex().AssertHeld(); |
| 122 | 121 |
| 123 return data_pipe_->ConsumerEndReadData(num_bytes_read); | 122 return data_pipe_->ConsumerEndReadData(num_bytes_read); |
| 124 } | 123 } |
| 125 | 124 |
| 126 HandleSignalsState DataPipeConsumerDispatcher::GetHandleSignalsStateImplNoLock() | 125 HandleSignalsState DataPipeConsumerDispatcher::GetHandleSignalsStateImplNoLock() |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 return rv; | 166 return rv; |
| 168 } | 167 } |
| 169 | 168 |
| 170 bool DataPipeConsumerDispatcher::IsBusyNoLock() const { | 169 bool DataPipeConsumerDispatcher::IsBusyNoLock() const { |
| 171 mutex().AssertHeld(); | 170 mutex().AssertHeld(); |
| 172 return data_pipe_->ConsumerIsBusy(); | 171 return data_pipe_->ConsumerIsBusy(); |
| 173 } | 172 } |
| 174 | 173 |
| 175 } // namespace system | 174 } // namespace system |
| 176 } // namespace mojo | 175 } // namespace mojo |
| OLD | NEW |