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

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

Issue 2725133002: Mojo: Armed Watchers (Closed)
Patch Set: . Created 3 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
Index: mojo/edk/system/watcher_set.cc
diff --git a/mojo/edk/system/watcher_set.cc b/mojo/edk/system/watcher_set.cc
index 878f29a54b2987b6bc956820aa7619777d0f33a7..2b10040429fcb1091c79808834c23eab4523f8c5 100644
--- a/mojo/edk/system/watcher_set.cc
+++ b/mojo/edk/system/watcher_set.cc
@@ -14,9 +14,9 @@ WatcherSet::WatcherSet() {}
WatcherSet::~WatcherSet() {}
-void WatcherSet::NotifyForStateChange(const HandleSignalsState& state) {
+void WatcherSet::NotifyState(const HandleSignalsState& state) {
for (const auto& entry : watchers_)
- entry.second->NotifyForStateChange(state);
+ entry.second->NotifyState(state);
}
void WatcherSet::NotifyClosed() {
@@ -38,11 +38,18 @@ MojoResult WatcherSet::Add(MojoHandleSignals signals,
scoped_refptr<Watcher> watcher(new Watcher(signals, callback));
watchers_.insert(std::make_pair(context, watcher));
- watcher->NotifyForStateChange(current_state);
-
return MOJO_RESULT_OK;
}
+MojoResult WatcherSet::Arm(uintptr_t context,
+ const HandleSignalsState& current_state) {
+ auto it = watchers_.find(context);
+ if (it == watchers_.end())
+ return MOJO_RESULT_INVALID_ARGUMENT;
+
+ return it->second->Arm(current_state);
+}
+
MojoResult WatcherSet::Remove(uintptr_t context) {
auto it = watchers_.find(context);
if (it == watchers_.end())

Powered by Google App Engine
This is Rietveld 408576698