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

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

Issue 2076263003: Plumb the handle signals state to Awakable::Awake(). (Closed) Base URL: https://github.com/domokit/mojo.git@work794_wait_set_4.2
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/wait_set_dispatcher.h ('k') | mojo/edk/system/waiter.h » ('j') | 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 3107bb6b8acdf9725ed53071dbaa1932dde6ea10..7525a21ddbfe7f7148e072d0fa5aee44dc09ce5c 100644
--- a/mojo/edk/system/wait_set_dispatcher.cc
+++ b/mojo/edk/system/wait_set_dispatcher.cc
@@ -261,7 +261,9 @@ MojoResult WaitSetDispatcher::WaitSetWaitImpl(
return MOJO_RESULT_UNIMPLEMENTED;
}
-bool WaitSetDispatcher::Awake(MojoResult result, uint64_t context) {
+bool WaitSetDispatcher::Awake(uint64_t context,
+ AwakeReason reason,
+ const HandleSignalsState& signals_state) {
MutexLocker locker(&mutex());
if (is_closed_no_lock()) {
@@ -277,25 +279,14 @@ bool WaitSetDispatcher::Awake(MojoResult result, uint64_t context) {
auto it = entries_.find(context);
DCHECK(it != entries_.end());
const auto& entry = it->second;
- switch (result) {
- case MOJO_RESULT_OK:
+ switch (reason) {
+ case AwakeReason::SATISFIED:
if (entry->trigger_state == Entry::TriggerState::NOT_TRIGGERED) {
AddPossiblyTriggeredNoLock(entry.get(),
Entry::TriggerState::POSSIBLY_SATISFIED);
}
return true;
- case MOJO_RESULT_CANCELLED:
- if (entry->trigger_state == Entry::TriggerState::NOT_TRIGGERED) {
- AddPossiblyTriggeredNoLock(entry.get(), Entry::TriggerState::CLOSED);
- } else {
- // We should only ever get at most one "closed".
- DCHECK_NE(static_cast<int>(entry->trigger_state),
- static_cast<int>(Entry::TriggerState::CLOSED));
- entry->trigger_state = Entry::TriggerState::CLOSED;
- }
- entry->dispatcher = nullptr;
- return false;
- case MOJO_RESULT_FAILED_PRECONDITION:
+ case AwakeReason::UNSATISFIABLE:
// Never satisfiable.
if (entry->trigger_state == Entry::TriggerState::NOT_TRIGGERED) {
AddPossiblyTriggeredNoLock(entry.get(),
@@ -313,9 +304,17 @@ bool WaitSetDispatcher::Awake(MojoResult result, uint64_t context) {
// Due to some action on some other thread, it may become satisfiable
// again, so continue to be awoken.
return true;
- default:
- NOTREACHED();
- break;
+ case AwakeReason::CANCELLED:
+ if (entry->trigger_state == Entry::TriggerState::NOT_TRIGGERED) {
+ AddPossiblyTriggeredNoLock(entry.get(), Entry::TriggerState::CLOSED);
+ } else {
+ // We should only ever get at most one "closed".
+ DCHECK_NE(static_cast<int>(entry->trigger_state),
+ static_cast<int>(Entry::TriggerState::CLOSED));
+ entry->trigger_state = Entry::TriggerState::CLOSED;
+ }
+ entry->dispatcher = nullptr;
+ return false;
}
return false;
}
« no previous file with comments | « mojo/edk/system/wait_set_dispatcher.h ('k') | mojo/edk/system/waiter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698