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

Unified Diff: mojo/edk/system/simple_dispatcher.cc

Issue 2090763002: AwakableList: For persistent awakables, make Add() call Awake() with reason INITIALIZE. (Closed) Base URL: https://github.com/domokit/mojo.git@work795_wait_set_4.7-x-work794_wait_set_4.6
Patch Set: 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/local_message_pipe_endpoint.cc ('k') | mojo/edk/system/wait_set_dispatcher.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 1d844bbb8ce97b7d52ec2897803c319322c4f350..354ad9d423df0c82a1663ac52bfe759576786bc3 100644
--- a/mojo/edk/system/simple_dispatcher.cc
+++ b/mojo/edk/system/simple_dispatcher.cc
@@ -36,19 +36,18 @@ MojoResult SimpleDispatcher::AddAwakableImplNoLock(
HandleSignalsState state(GetHandleSignalsStateImplNoLock());
if (signals_state)
*signals_state = state;
- if (state.satisfies(signals)) {
- if (persistent)
- awakable_list_.Add(awakable, context, persistent, signals);
- return MOJO_RESULT_ALREADY_EXISTS;
- }
- if (!state.can_satisfy(signals)) {
- if (persistent)
- awakable_list_.Add(awakable, context, persistent, signals);
- return MOJO_RESULT_FAILED_PRECONDITION;
- }
+ MojoResult rv = MOJO_RESULT_OK;
+ bool should_add = persistent;
+ if (state.satisfies(signals))
+ rv = MOJO_RESULT_ALREADY_EXISTS;
+ else if (!state.can_satisfy(signals))
+ rv = MOJO_RESULT_FAILED_PRECONDITION;
+ else
+ should_add = true;
- awakable_list_.Add(awakable, context, persistent, signals);
- return MOJO_RESULT_OK;
+ if (should_add)
+ awakable_list_.Add(awakable, context, persistent, signals, state);
+ return rv;
}
void SimpleDispatcher::RemoveAwakableImplNoLock(
« no previous file with comments | « mojo/edk/system/local_message_pipe_endpoint.cc ('k') | mojo/edk/system/wait_set_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698