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

Side by Side Diff: mojo/edk/system/message_pipe_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/message_pipe_dispatcher.h" 5 #include "mojo/edk/system/message_pipe_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/configuration.h" 10 #include "mojo/edk/system/configuration.h"
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 } 195 }
196 196
197 HandleSignalsState MessagePipeDispatcher::GetHandleSignalsStateImplNoLock() 197 HandleSignalsState MessagePipeDispatcher::GetHandleSignalsStateImplNoLock()
198 const { 198 const {
199 mutex().AssertHeld(); 199 mutex().AssertHeld();
200 return message_pipe_->GetHandleSignalsState(port_); 200 return message_pipe_->GetHandleSignalsState(port_);
201 } 201 }
202 202
203 MojoResult MessagePipeDispatcher::AddAwakableImplNoLock( 203 MojoResult MessagePipeDispatcher::AddAwakableImplNoLock(
204 Awakable* awakable, 204 Awakable* awakable,
205 uint64_t context,
206 bool force,
205 MojoHandleSignals signals, 207 MojoHandleSignals signals,
206 bool force,
207 uint64_t context,
208 HandleSignalsState* signals_state) { 208 HandleSignalsState* signals_state) {
209 mutex().AssertHeld(); 209 mutex().AssertHeld();
210 return message_pipe_->AddAwakable(port_, awakable, signals, force, context, 210 return message_pipe_->AddAwakable(port_, awakable, context, force, signals,
211 signals_state); 211 signals_state);
212 } 212 }
213 213
214 void MessagePipeDispatcher::RemoveAwakableImplNoLock( 214 void MessagePipeDispatcher::RemoveAwakableImplNoLock(
215 Awakable* awakable, 215 bool match_context,
216 HandleSignalsState* signals_state) {
217 mutex().AssertHeld();
218 message_pipe_->RemoveAwakable(port_, awakable, signals_state);
219 }
220
221 void MessagePipeDispatcher::RemoveAwakableWithContextImplNoLock(
222 Awakable* awakable, 216 Awakable* awakable,
223 uint64_t context, 217 uint64_t context,
224 HandleSignalsState* signals_state) { 218 HandleSignalsState* signals_state) {
225 mutex().AssertHeld(); 219 mutex().AssertHeld();
226 message_pipe_->RemoveAwakableWithContext(port_, awakable, context, 220 message_pipe_->RemoveAwakable(port_, match_context, awakable, context,
227 signals_state); 221 signals_state);
228 } 222 }
229 223
230 void MessagePipeDispatcher::StartSerializeImplNoLock( 224 void MessagePipeDispatcher::StartSerializeImplNoLock(
231 Channel* channel, 225 Channel* channel,
232 size_t* max_size, 226 size_t* max_size,
233 size_t* max_platform_handles) { 227 size_t* max_platform_handles) {
234 AssertHasOneRef(); // Only one ref => no need to take the lock. 228 AssertHasOneRef(); // Only one ref => no need to take the lock.
235 return message_pipe_->StartSerialize(port_, channel, max_size, 229 return message_pipe_->StartSerialize(port_, channel, max_size,
236 max_platform_handles); 230 max_platform_handles);
237 } 231 }
238 232
239 bool MessagePipeDispatcher::EndSerializeAndCloseImplNoLock( 233 bool MessagePipeDispatcher::EndSerializeAndCloseImplNoLock(
240 Channel* channel, 234 Channel* channel,
241 void* destination, 235 void* destination,
242 size_t* actual_size, 236 size_t* actual_size,
243 std::vector<ScopedPlatformHandle>* platform_handles) { 237 std::vector<ScopedPlatformHandle>* platform_handles) {
244 AssertHasOneRef(); // Only one ref => no need to take the lock. 238 AssertHasOneRef(); // Only one ref => no need to take the lock.
245 239
246 bool rv = message_pipe_->EndSerialize(port_, channel, destination, 240 bool rv = message_pipe_->EndSerialize(port_, channel, destination,
247 actual_size, platform_handles); 241 actual_size, platform_handles);
248 message_pipe_ = nullptr; 242 message_pipe_ = nullptr;
249 port_ = kInvalidPort; 243 port_ = kInvalidPort;
250 return rv; 244 return rv;
251 } 245 }
252 246
253 } // namespace system 247 } // namespace system
254 } // namespace mojo 248 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/system/message_pipe_dispatcher.h ('k') | mojo/edk/system/message_pipe_dispatcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698