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

Unified Diff: mojo/edk/system/awakable_list.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/awakable.cc ('k') | mojo/edk/system/awakable_list_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/system/awakable_list.cc
diff --git a/mojo/edk/system/awakable_list.cc b/mojo/edk/system/awakable_list.cc
index 2c2b466b508a4d4829310562df3653fe1738b440..b3e2763823ef811b2d58aba986649e8118e5270c 100644
--- a/mojo/edk/system/awakable_list.cc
+++ b/mojo/edk/system/awakable_list.cc
@@ -13,8 +13,7 @@
namespace mojo {
namespace system {
-AwakableList::AwakableList() {
-}
+AwakableList::AwakableList() {}
AwakableList::~AwakableList() {
DCHECK(awakables_.empty());
@@ -27,11 +26,14 @@ void AwakableList::OnStateChange(const HandleSignalsState& old_state,
auto last = awakables_.end();
for (AwakeInfoList::iterator it = awakables_.begin(); it != last;) {
bool keep = true;
- if (new_state.satisfies(it->signals) && !old_state.satisfies(it->signals))
- keep = it->awakable->Awake(MOJO_RESULT_OK, it->context);
- else if (!new_state.can_satisfy(it->signals) &&
- old_state.can_satisfy(it->signals))
- keep = it->awakable->Awake(MOJO_RESULT_FAILED_PRECONDITION, it->context);
+ if (new_state.satisfies(it->signals) && !old_state.satisfies(it->signals)) {
+ keep = it->awakable->Awake(it->context, Awakable::AwakeReason::SATISFIED,
+ new_state);
+ } else if (!new_state.can_satisfy(it->signals) &&
+ old_state.can_satisfy(it->signals)) {
+ keep = it->awakable->Awake(
+ it->context, Awakable::AwakeReason::UNSATISFIABLE, new_state);
+ }
if (!keep) {
--last;
@@ -46,7 +48,8 @@ void AwakableList::OnStateChange(const HandleSignalsState& old_state,
void AwakableList::CancelAll() {
for (AwakeInfoList::iterator it = awakables_.begin(); it != awakables_.end();
++it) {
- it->awakable->Awake(MOJO_RESULT_CANCELLED, it->context);
+ it->awakable->Awake(it->context, Awakable::AwakeReason::CANCELLED,
+ HandleSignalsState());
}
awakables_.clear();
}
« no previous file with comments | « mojo/edk/system/awakable.cc ('k') | mojo/edk/system/awakable_list_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698