Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(71)

Side by Side Diff: mojo/edk/system/data_pipe_consumer_dispatcher.cc

Issue 2084593005: Rationalize AddAwakable...() and RemoveAwakable...() methods. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: doh Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 } 187 }
188 188
189 HandleSignalsState DataPipeConsumerDispatcher::GetHandleSignalsStateImplNoLock() 189 HandleSignalsState DataPipeConsumerDispatcher::GetHandleSignalsStateImplNoLock()
190 const { 190 const {
191 mutex().AssertHeld(); 191 mutex().AssertHeld();
192 return data_pipe_->ConsumerGetHandleSignalsState(); 192 return data_pipe_->ConsumerGetHandleSignalsState();
193 } 193 }
194 194
195 MojoResult DataPipeConsumerDispatcher::AddAwakableImplNoLock( 195 MojoResult DataPipeConsumerDispatcher::AddAwakableImplNoLock(
196 Awakable* awakable, 196 Awakable* awakable,
197 uint64_t context,
198 bool force,
197 MojoHandleSignals signals, 199 MojoHandleSignals signals,
198 bool force,
199 uint64_t context,
200 HandleSignalsState* signals_state) { 200 HandleSignalsState* signals_state) {
201 mutex().AssertHeld(); 201 mutex().AssertHeld();
202 return data_pipe_->ConsumerAddAwakable(awakable, signals, force, context, 202 return data_pipe_->ConsumerAddAwakable(awakable, context, force, signals,
203 signals_state); 203 signals_state);
204 } 204 }
205 205
206 void DataPipeConsumerDispatcher::RemoveAwakableImplNoLock( 206 void DataPipeConsumerDispatcher::RemoveAwakableImplNoLock(
207 Awakable* awakable, 207 bool match_context,
208 HandleSignalsState* signals_state) {
209 mutex().AssertHeld();
210 data_pipe_->ConsumerRemoveAwakable(awakable, signals_state);
211 }
212
213 void DataPipeConsumerDispatcher::RemoveAwakableWithContextImplNoLock(
214 Awakable* awakable, 208 Awakable* awakable,
215 uint64_t context, 209 uint64_t context,
216 HandleSignalsState* signals_state) { 210 HandleSignalsState* signals_state) {
217 mutex().AssertHeld(); 211 mutex().AssertHeld();
218 data_pipe_->ConsumerRemoveAwakableWithContext(awakable, context, 212 data_pipe_->ConsumerRemoveAwakable(match_context, awakable, context,
219 signals_state); 213 signals_state);
220 } 214 }
221 215
222 void DataPipeConsumerDispatcher::StartSerializeImplNoLock( 216 void DataPipeConsumerDispatcher::StartSerializeImplNoLock(
223 Channel* channel, 217 Channel* channel,
224 size_t* max_size, 218 size_t* max_size,
225 size_t* max_platform_handles) { 219 size_t* max_platform_handles) {
226 AssertHasOneRef(); // Only one ref => no need to take the lock. 220 AssertHasOneRef(); // Only one ref => no need to take the lock.
227 data_pipe_->ConsumerStartSerialize(channel, max_size, max_platform_handles); 221 data_pipe_->ConsumerStartSerialize(channel, max_size, max_platform_handles);
228 } 222 }
229 223
230 bool DataPipeConsumerDispatcher::EndSerializeAndCloseImplNoLock( 224 bool DataPipeConsumerDispatcher::EndSerializeAndCloseImplNoLock(
231 Channel* channel, 225 Channel* channel,
232 void* destination, 226 void* destination,
233 size_t* actual_size, 227 size_t* actual_size,
234 std::vector<ScopedPlatformHandle>* platform_handles) { 228 std::vector<ScopedPlatformHandle>* platform_handles) {
235 AssertHasOneRef(); // Only one ref => no need to take the lock. 229 AssertHasOneRef(); // Only one ref => no need to take the lock.
236 230
237 bool rv = data_pipe_->ConsumerEndSerialize(channel, destination, actual_size, 231 bool rv = data_pipe_->ConsumerEndSerialize(channel, destination, actual_size,
238 platform_handles); 232 platform_handles);
239 data_pipe_ = nullptr; 233 data_pipe_ = nullptr;
240 return rv; 234 return rv;
241 } 235 }
242 236
243 } // namespace system 237 } // namespace system
244 } // namespace mojo 238 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/system/data_pipe_consumer_dispatcher.h ('k') | mojo/edk/system/data_pipe_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698