| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "mojo/edk/system/data_pipe.h" | 10 #include "mojo/edk/system/data_pipe.h" |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 } | 162 } |
| 163 | 163 |
| 164 HandleSignalsState DataPipeProducerDispatcher::GetHandleSignalsStateImplNoLock() | 164 HandleSignalsState DataPipeProducerDispatcher::GetHandleSignalsStateImplNoLock() |
| 165 const { | 165 const { |
| 166 mutex().AssertHeld(); | 166 mutex().AssertHeld(); |
| 167 return data_pipe_->ProducerGetHandleSignalsState(); | 167 return data_pipe_->ProducerGetHandleSignalsState(); |
| 168 } | 168 } |
| 169 | 169 |
| 170 MojoResult DataPipeProducerDispatcher::AddAwakableImplNoLock( | 170 MojoResult DataPipeProducerDispatcher::AddAwakableImplNoLock( |
| 171 Awakable* awakable, | 171 Awakable* awakable, |
| 172 uint64_t context, |
| 173 bool force, |
| 172 MojoHandleSignals signals, | 174 MojoHandleSignals signals, |
| 173 bool force, | |
| 174 uint64_t context, | |
| 175 HandleSignalsState* signals_state) { | 175 HandleSignalsState* signals_state) { |
| 176 mutex().AssertHeld(); | 176 mutex().AssertHeld(); |
| 177 return data_pipe_->ProducerAddAwakable(awakable, signals, force, context, | 177 return data_pipe_->ProducerAddAwakable(awakable, context, force, signals, |
| 178 signals_state); | 178 signals_state); |
| 179 } | 179 } |
| 180 | 180 |
| 181 void DataPipeProducerDispatcher::RemoveAwakableImplNoLock( | 181 void DataPipeProducerDispatcher::RemoveAwakableImplNoLock( |
| 182 Awakable* awakable, | 182 bool match_context, |
| 183 HandleSignalsState* signals_state) { | |
| 184 mutex().AssertHeld(); | |
| 185 data_pipe_->ProducerRemoveAwakable(awakable, signals_state); | |
| 186 } | |
| 187 | |
| 188 void DataPipeProducerDispatcher::RemoveAwakableWithContextImplNoLock( | |
| 189 Awakable* awakable, | 183 Awakable* awakable, |
| 190 uint64_t context, | 184 uint64_t context, |
| 191 HandleSignalsState* signals_state) { | 185 HandleSignalsState* signals_state) { |
| 192 mutex().AssertHeld(); | 186 mutex().AssertHeld(); |
| 193 data_pipe_->ProducerRemoveAwakableWithContext(awakable, context, | 187 data_pipe_->ProducerRemoveAwakable(match_context, awakable, context, |
| 194 signals_state); | 188 signals_state); |
| 195 } | 189 } |
| 196 | 190 |
| 197 void DataPipeProducerDispatcher::StartSerializeImplNoLock( | 191 void DataPipeProducerDispatcher::StartSerializeImplNoLock( |
| 198 Channel* channel, | 192 Channel* channel, |
| 199 size_t* max_size, | 193 size_t* max_size, |
| 200 size_t* max_platform_handles) { | 194 size_t* max_platform_handles) { |
| 201 AssertHasOneRef(); // Only one ref => no need to take the lock. | 195 AssertHasOneRef(); // Only one ref => no need to take the lock. |
| 202 data_pipe_->ProducerStartSerialize(channel, max_size, max_platform_handles); | 196 data_pipe_->ProducerStartSerialize(channel, max_size, max_platform_handles); |
| 203 } | 197 } |
| 204 | 198 |
| 205 bool DataPipeProducerDispatcher::EndSerializeAndCloseImplNoLock( | 199 bool DataPipeProducerDispatcher::EndSerializeAndCloseImplNoLock( |
| 206 Channel* channel, | 200 Channel* channel, |
| 207 void* destination, | 201 void* destination, |
| 208 size_t* actual_size, | 202 size_t* actual_size, |
| 209 std::vector<ScopedPlatformHandle>* platform_handles) { | 203 std::vector<ScopedPlatformHandle>* platform_handles) { |
| 210 AssertHasOneRef(); // Only one ref => no need to take the lock. | 204 AssertHasOneRef(); // Only one ref => no need to take the lock. |
| 211 | 205 |
| 212 bool rv = data_pipe_->ProducerEndSerialize(channel, destination, actual_size, | 206 bool rv = data_pipe_->ProducerEndSerialize(channel, destination, actual_size, |
| 213 platform_handles); | 207 platform_handles); |
| 214 data_pipe_ = nullptr; | 208 data_pipe_ = nullptr; |
| 215 return rv; | 209 return rv; |
| 216 } | 210 } |
| 217 | 211 |
| 218 } // namespace system | 212 } // namespace system |
| 219 } // namespace mojo | 213 } // namespace mojo |
| OLD | NEW |