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

Unified Diff: mojo/edk/system/simple_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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/edk/system/simple_dispatcher.h ('k') | mojo/edk/system/simple_dispatcher_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/system/simple_dispatcher.cc
diff --git a/mojo/edk/system/simple_dispatcher.cc b/mojo/edk/system/simple_dispatcher.cc
index 0050133e8ca5e837e50a6865d7a2ec8f0d80b13f..25ae5ff04e0861e2b621f8edcef903b862cbb063 100644
--- a/mojo/edk/system/simple_dispatcher.cc
+++ b/mojo/edk/system/simple_dispatcher.cc
@@ -27,9 +27,9 @@ void SimpleDispatcher::CancelAllStateNoLock() {
MojoResult SimpleDispatcher::AddAwakableImplNoLock(
Awakable* awakable,
- MojoHandleSignals signals,
- bool force,
uint64_t context,
+ bool force,
+ MojoHandleSignals signals,
HandleSignalsState* signals_state) {
mutex().AssertHeld();
@@ -38,31 +38,26 @@ MojoResult SimpleDispatcher::AddAwakableImplNoLock(
*signals_state = state;
if (state.satisfies(signals)) {
if (force)
- awakable_list_.Add(awakable, signals, context);
+ awakable_list_.Add(awakable, context, signals);
return MOJO_RESULT_ALREADY_EXISTS;
}
- if (!state.can_satisfy(signals))
+ if (!state.can_satisfy(signals)) {
+ if (force)
+ awakable_list_.Add(awakable, context, signals);
return MOJO_RESULT_FAILED_PRECONDITION;
+ }
- awakable_list_.Add(awakable, signals, context);
+ awakable_list_.Add(awakable, context, signals);
return MOJO_RESULT_OK;
}
void SimpleDispatcher::RemoveAwakableImplNoLock(
- Awakable* awakable,
- HandleSignalsState* signals_state) {
- mutex().AssertHeld();
- awakable_list_.Remove(awakable);
- if (signals_state)
- *signals_state = GetHandleSignalsStateImplNoLock();
-}
-
-void SimpleDispatcher::RemoveAwakableWithContextImplNoLock(
+ bool match_context,
Awakable* awakable,
uint64_t context,
HandleSignalsState* signals_state) {
mutex().AssertHeld();
- awakable_list_.RemoveWithContext(awakable, context);
+ awakable_list_.Remove(match_context, awakable, context);
if (signals_state)
*signals_state = GetHandleSignalsStateImplNoLock();
}
« no previous file with comments | « mojo/edk/system/simple_dispatcher.h ('k') | mojo/edk/system/simple_dispatcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698