| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 !!(flags & MOJO_READ_DATA_FLAG_PEEK)); | 100 !!(flags & MOJO_READ_DATA_FLAG_PEEK)); |
| 101 } | 101 } |
| 102 | 102 |
| 103 MojoResult DataPipeConsumerDispatcher::BeginReadDataImplNoLock( | 103 MojoResult DataPipeConsumerDispatcher::BeginReadDataImplNoLock( |
| 104 UserPointer<const void*> buffer, | 104 UserPointer<const void*> buffer, |
| 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_DISCARD) || | 110 if ((flags & MOJO_READ_DATA_FLAG_ALL_OR_NONE) || |
| 111 (flags & MOJO_READ_DATA_FLAG_DISCARD) || |
| 111 (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)) |
| 112 return MOJO_RESULT_INVALID_ARGUMENT; | 113 return MOJO_RESULT_INVALID_ARGUMENT; |
| 113 | 114 |
| 114 return data_pipe_->ConsumerBeginReadData( | 115 // TODO(vtl): Remove all-or-none support at lower levels. |
| 115 buffer, buffer_num_bytes, (flags & MOJO_READ_DATA_FLAG_ALL_OR_NONE)); | 116 return data_pipe_->ConsumerBeginReadData(buffer, buffer_num_bytes, false); |
| 116 } | 117 } |
| 117 | 118 |
| 118 MojoResult DataPipeConsumerDispatcher::EndReadDataImplNoLock( | 119 MojoResult DataPipeConsumerDispatcher::EndReadDataImplNoLock( |
| 119 uint32_t num_bytes_read) { | 120 uint32_t num_bytes_read) { |
| 120 mutex().AssertHeld(); | 121 mutex().AssertHeld(); |
| 121 | 122 |
| 122 return data_pipe_->ConsumerEndReadData(num_bytes_read); | 123 return data_pipe_->ConsumerEndReadData(num_bytes_read); |
| 123 } | 124 } |
| 124 | 125 |
| 125 HandleSignalsState DataPipeConsumerDispatcher::GetHandleSignalsStateImplNoLock() | 126 HandleSignalsState DataPipeConsumerDispatcher::GetHandleSignalsStateImplNoLock() |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 return rv; | 167 return rv; |
| 167 } | 168 } |
| 168 | 169 |
| 169 bool DataPipeConsumerDispatcher::IsBusyNoLock() const { | 170 bool DataPipeConsumerDispatcher::IsBusyNoLock() const { |
| 170 mutex().AssertHeld(); | 171 mutex().AssertHeld(); |
| 171 return data_pipe_->ConsumerIsBusy(); | 172 return data_pipe_->ConsumerIsBusy(); |
| 172 } | 173 } |
| 173 | 174 |
| 174 } // namespace system | 175 } // namespace system |
| 175 } // namespace mojo | 176 } // namespace mojo |
| OLD | NEW |