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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 return MOJO_RESULT_INVALID_ARGUMENT; | 72 return MOJO_RESULT_INVALID_ARGUMENT; |
73 DCHECK(!(flags & MOJO_READ_DATA_FLAG_DISCARD)); // Handled above. | 73 DCHECK(!(flags & MOJO_READ_DATA_FLAG_DISCARD)); // Handled above. |
74 DVLOG_IF(2, !elements.IsNull()) | 74 DVLOG_IF(2, !elements.IsNull()) |
75 << "Query mode: ignoring non-null |elements|"; | 75 << "Query mode: ignoring non-null |elements|"; |
76 return data_pipe_->ConsumerQueryData(num_bytes); | 76 return data_pipe_->ConsumerQueryData(num_bytes); |
77 } | 77 } |
78 | 78 |
79 return data_pipe_->ConsumerReadData( | 79 return data_pipe_->ConsumerReadData( |
80 elements, | 80 elements, |
81 num_bytes, | 81 num_bytes, |
82 (flags & MOJO_READ_DATA_FLAG_ALL_OR_NONE), | 82 !!(flags & MOJO_READ_DATA_FLAG_ALL_OR_NONE), |
83 (flags & MOJO_READ_DATA_FLAG_PEEK)); | 83 !!(flags & MOJO_READ_DATA_FLAG_PEEK)); |
84 } | 84 } |
85 | 85 |
86 MojoResult DataPipeConsumerDispatcher::BeginReadDataImplNoLock( | 86 MojoResult DataPipeConsumerDispatcher::BeginReadDataImplNoLock( |
87 UserPointer<const void*> buffer, | 87 UserPointer<const void*> buffer, |
88 UserPointer<uint32_t> buffer_num_bytes, | 88 UserPointer<uint32_t> buffer_num_bytes, |
89 MojoReadDataFlags flags) { | 89 MojoReadDataFlags flags) { |
90 lock().AssertAcquired(); | 90 lock().AssertAcquired(); |
91 | 91 |
92 // These flags may not be used in two-phase mode. | 92 // These flags may not be used in two-phase mode. |
93 if ((flags & MOJO_READ_DATA_FLAG_DISCARD) || | 93 if ((flags & MOJO_READ_DATA_FLAG_DISCARD) || |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 data_pipe_->ConsumerRemoveWaiter(waiter, signals_state); | 128 data_pipe_->ConsumerRemoveWaiter(waiter, signals_state); |
129 } | 129 } |
130 | 130 |
131 bool DataPipeConsumerDispatcher::IsBusyNoLock() const { | 131 bool DataPipeConsumerDispatcher::IsBusyNoLock() const { |
132 lock().AssertAcquired(); | 132 lock().AssertAcquired(); |
133 return data_pipe_->ConsumerIsBusy(); | 133 return data_pipe_->ConsumerIsBusy(); |
134 } | 134 } |
135 | 135 |
136 } // namespace system | 136 } // namespace system |
137 } // namespace mojo | 137 } // namespace mojo |
OLD | NEW |