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

Unified Diff: mojo/edk/system/dispatcher.h

Issue 2725133002: Mojo: Armed Watchers (Closed)
Patch Set: . Created 3 years, 9 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/dispatcher.h
diff --git a/mojo/edk/system/dispatcher.h b/mojo/edk/system/dispatcher.h
index 9dca67fa45f800d45231cb7a3c1e1718c0261c5e..88a9de7c8509dda9969bb8bc8fe49fd4ff10aa17 100644
--- a/mojo/edk/system/dispatcher.h
+++ b/mojo/edk/system/dispatcher.h
@@ -20,7 +20,7 @@
#include "mojo/edk/system/handle_signals_state.h"
#include "mojo/edk/system/ports/name.h"
#include "mojo/edk/system/system_impl_export.h"
-#include "mojo/edk/system/watcher.h"
+#include "mojo/edk/system/watch.h"
#include "mojo/public/c/system/buffer.h"
#include "mojo/public/c/system/data_pipe.h"
#include "mojo/public/c/system/message_pipe.h"
@@ -57,6 +57,7 @@ class MOJO_SYSTEM_IMPL_EXPORT Dispatcher
DATA_PIPE_CONSUMER,
SHARED_BUFFER,
WAIT_SET,
+ WATCHER,
// "Private" types (not exposed via the public interface):
PLATFORM_HANDLE = -1,
@@ -67,13 +68,16 @@ class MOJO_SYSTEM_IMPL_EXPORT Dispatcher
virtual Type GetType() const = 0;
virtual MojoResult Close() = 0;
- ///////////// Watch API ////////////////////
-
- virtual MojoResult Watch(MojoHandleSignals signals,
- const Watcher::WatchCallback& callback,
- uintptr_t context);
+ ///////////// Watcher API ////////////////////
+ virtual MojoResult WatchDispatcher(scoped_refptr<Dispatcher> dispatcher,
+ MojoHandleSignals signals,
+ uintptr_t context);
virtual MojoResult CancelWatch(uintptr_t context);
+ virtual MojoResult Arm(uint32_t* num_ready_contexts,
+ uintptr_t* ready_contexts,
+ MojoResult* ready_results,
+ MojoHandleSignalsState* ready_signals_states);
///////////// Message pipe API /////////////
@@ -158,6 +162,18 @@ class MOJO_SYSTEM_IMPL_EXPORT Dispatcher
// threads.
virtual HandleSignalsState GetHandleSignalsState() const;
+ // Adds a WatcherDispatcher reference to this dispatcher, to be notified of
+ // all subsequent changes to handle state including signal changes or closure.
+ // The reference is associated with a |context| for disambiguation of
+ // removals.
+ virtual MojoResult AddWatcherRef(
+ const scoped_refptr<WatcherDispatcher>& watcher,
+ uintptr_t context);
+
+ // Removes a WatcherDispatcher reference from this dispatcher.
+ virtual MojoResult RemoveWatcherRef(WatcherDispatcher* watcher,
+ uintptr_t context);
+
// Adds an awakable to this dispatcher, which will be woken up when this
// object changes state to satisfy |signals| with context |context|. It will
// also be woken up when it becomes impossible for the object to ever satisfy

Powered by Google App Engine
This is Rietveld 408576698