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

Unified Diff: mojo/edk/system/wait_set_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/simple_dispatcher.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/system/wait_set_dispatcher.cc
diff --git a/mojo/edk/system/wait_set_dispatcher.cc b/mojo/edk/system/wait_set_dispatcher.cc
index 5af8b93a3c98c611e417c3ebb11566ca099e950d..e957c51356881c623bb31ab4efae83a877f0b7f5 100644
--- a/mojo/edk/system/wait_set_dispatcher.cc
+++ b/mojo/edk/system/wait_set_dispatcher.cc
@@ -276,11 +276,23 @@ void WaitSetDispatcher::Awake(uint64_t context,
DCHECK_NE(static_cast<int>(entry->trigger_state),
static_cast<int>(Entry::TriggerState::CLOSED));
switch (reason) {
+ case AwakeReason::CANCELLED:
+ if (entry->trigger_state == Entry::TriggerState::NOT_TRIGGERED) {
+ AddPossiblyTriggeredNoLock(entry.get(), Entry::TriggerState::CLOSED);
+ } else {
+ entry->trigger_state = Entry::TriggerState::CLOSED;
+ }
+ entry->dispatcher = nullptr;
+ break;
case AwakeReason::SATISFIED:
case AwakeReason::UNSATISFIABLE:
// We shouldn't see these since we're used as a persistent |Awakable|.
NOTREACHED();
- // Fall through.
+ break;
+ case AwakeReason::INITIALIZE:
+ // TODO(vtl): Save the initial state here (and maybe add to the triggered
+ // list), and then update state on CHANGED.
+ break;
case AwakeReason::CHANGED:
if (signals_state.satisfies(entry->signals)) {
if (entry->trigger_state == Entry::TriggerState::NOT_TRIGGERED) {
@@ -301,14 +313,6 @@ void WaitSetDispatcher::Awake(uint64_t context,
RemovePossiblyTriggeredNoLock(entry.get());
}
break;
- case AwakeReason::CANCELLED:
- if (entry->trigger_state == Entry::TriggerState::NOT_TRIGGERED) {
- AddPossiblyTriggeredNoLock(entry.get(), Entry::TriggerState::CLOSED);
- } else {
- entry->trigger_state = Entry::TriggerState::CLOSED;
- }
- entry->dispatcher = nullptr;
- break;
}
}
« no previous file with comments | « mojo/edk/system/simple_dispatcher.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698