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

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

Issue 1748503002: [mojo-edk] Add MojoWatch and MojoCancelWatch APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: revert RequestContext usage, nits Created 4 years, 10 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_list.h ('k') | mojo/edk/system/core.h » ('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 429e691a4c9e51a3d62e838885ff8e376f466dcf..2045f32dffa698984f3ed69148f43d142d5c89cd 100644
--- a/mojo/edk/system/awakable_list.cc
+++ b/mojo/edk/system/awakable_list.cc
@@ -39,6 +39,7 @@ void AwakableList::AwakeForStateChange(const HandleSignalsState& state) {
}
}
awakables_.erase(last, awakables_.end());
+ watchers_.NotifyForStateChange(state);
}
void AwakableList::CancelAll() {
@@ -47,6 +48,7 @@ void AwakableList::CancelAll() {
it->awakable->Awake(MOJO_RESULT_CANCELLED, it->context);
}
awakables_.clear();
+ watchers_.NotifyClosed();
}
void AwakableList::Add(Awakable* awakable,
@@ -70,5 +72,16 @@ void AwakableList::Remove(Awakable* awakable) {
awakables_.erase(last, awakables_.end());
}
+MojoResult AwakableList::AddWatcher(MojoHandleSignals signals,
+ const Watcher::WatchCallback& callback,
+ uintptr_t context,
+ const HandleSignalsState& current_state) {
+ return watchers_.Add(signals, callback, context, current_state);
+}
+
+MojoResult AwakableList::RemoveWatcher(uintptr_t context) {
+ return watchers_.Remove(context);
+}
+
} // namespace edk
} // namespace mojo
« no previous file with comments | « mojo/edk/system/awakable_list.h ('k') | mojo/edk/system/core.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698