| 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_producer_dispatcher.h" | 5 #include "mojo/edk/system/data_pipe_producer_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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 return data_pipe_->ProducerWriteData( | 77 return data_pipe_->ProducerWriteData( |
| 78 elements, num_bytes, (flags & MOJO_WRITE_DATA_FLAG_ALL_OR_NONE)); | 78 elements, num_bytes, (flags & MOJO_WRITE_DATA_FLAG_ALL_OR_NONE)); |
| 79 } | 79 } |
| 80 | 80 |
| 81 MojoResult DataPipeProducerDispatcher::BeginWriteDataImplNoLock( | 81 MojoResult DataPipeProducerDispatcher::BeginWriteDataImplNoLock( |
| 82 UserPointer<void*> buffer, | 82 UserPointer<void*> buffer, |
| 83 UserPointer<uint32_t> buffer_num_bytes, | 83 UserPointer<uint32_t> buffer_num_bytes, |
| 84 MojoWriteDataFlags flags) { | 84 MojoWriteDataFlags flags) { |
| 85 mutex().AssertHeld(); | 85 mutex().AssertHeld(); |
| 86 | 86 |
| 87 return data_pipe_->ProducerBeginWriteData( | 87 // This flag may not be used in two-phase mode. |
| 88 buffer, buffer_num_bytes, (flags & MOJO_WRITE_DATA_FLAG_ALL_OR_NONE)); | 88 if ((flags & MOJO_WRITE_DATA_FLAG_ALL_OR_NONE)) |
| 89 return MOJO_RESULT_INVALID_ARGUMENT; |
| 90 |
| 91 // TODO(vtl): Remove all-or-none support at lower levels. |
| 92 return data_pipe_->ProducerBeginWriteData(buffer, buffer_num_bytes, false); |
| 89 } | 93 } |
| 90 | 94 |
| 91 MojoResult DataPipeProducerDispatcher::EndWriteDataImplNoLock( | 95 MojoResult DataPipeProducerDispatcher::EndWriteDataImplNoLock( |
| 92 uint32_t num_bytes_written) { | 96 uint32_t num_bytes_written) { |
| 93 mutex().AssertHeld(); | 97 mutex().AssertHeld(); |
| 94 | 98 |
| 95 return data_pipe_->ProducerEndWriteData(num_bytes_written); | 99 return data_pipe_->ProducerEndWriteData(num_bytes_written); |
| 96 } | 100 } |
| 97 | 101 |
| 98 HandleSignalsState DataPipeProducerDispatcher::GetHandleSignalsStateImplNoLock() | 102 HandleSignalsState DataPipeProducerDispatcher::GetHandleSignalsStateImplNoLock() |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 return rv; | 143 return rv; |
| 140 } | 144 } |
| 141 | 145 |
| 142 bool DataPipeProducerDispatcher::IsBusyNoLock() const { | 146 bool DataPipeProducerDispatcher::IsBusyNoLock() const { |
| 143 mutex().AssertHeld(); | 147 mutex().AssertHeld(); |
| 144 return data_pipe_->ProducerIsBusy(); | 148 return data_pipe_->ProducerIsBusy(); |
| 145 } | 149 } |
| 146 | 150 |
| 147 } // namespace system | 151 } // namespace system |
| 148 } // namespace mojo | 152 } // namespace mojo |
| OLD | NEW |