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

Unified Diff: mojo/message_pump/message_pump_mojo.h

Issue 1467953002: Implement MessagePumpMojo using WaitSet. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mojo-waitset-implementation
Patch Set: Fix component builds. Created 5 years 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 | « no previous file | mojo/message_pump/message_pump_mojo.cc » ('j') | mojo/message_pump/message_pump_mojo.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/message_pump/message_pump_mojo.h
diff --git a/mojo/message_pump/message_pump_mojo.h b/mojo/message_pump/message_pump_mojo.h
index 4dc0c2238f6e1d0f195f52f79f3210f05ea5447f..0b4b8f646328a7e5884dc6e85f739bb4b8266cc6 100644
--- a/mojo/message_pump/message_pump_mojo.h
+++ b/mojo/message_pump/message_pump_mojo.h
@@ -69,7 +69,6 @@ class MOJO_MESSAGE_PUMP_EXPORT MessagePumpMojo : public base::MessagePump {
private:
struct RunState;
- struct WaitState;
// Contains the data needed to track a request to AddHandler().
struct Handler {
@@ -92,19 +91,34 @@ class MOJO_MESSAGE_PUMP_EXPORT MessagePumpMojo : public base::MessagePump {
// handle has become ready, |false| otherwise.
bool DoInternalWork(const RunState& run_state, bool block);
+ // Waits for handles in the wait set to become ready. Returns |true| if ready
+ // handles may be available, or |false| if the wait's deadline was exceeded.
+ // Note, ready handles may be unavailable, even though |true| was returned.
+ bool WaitForReadyHandles(const RunState& run_state) const;
+
+ // Retrieves any 'ready' handles from the wait set, and runs the handler's
+ // OnHandleReady() or OnHandleError() functions as necessary. Returns |true|
+ // if any handles were ready and processed.
+ bool ProcessReadyHandles();
+
// Removes the given invalid handle. This is called if MojoWaitMany finds an
yzshen1 2016/01/05 17:41:05 nit: please update the comment.
Anand Mistry (off Chromium) 2016/01/05 23:29:52 Done.
// invalid handle.
- void RemoveInvalidHandle(const WaitState& wait_state,
- MojoResult result,
- uint32_t result_index);
+ void RemoveInvalidHandle(MojoResult result, Handle handle);
- void SignalControlPipe();
+ // Removes any handles that have expired their deadline. Runs the handler's
+ // OnHandleError() function with |MOJO_RESULT_DEADLINE_EXCEEDED| as the
+ // result. Returns |true| if any handles were removed.
+ bool RemoveExpiredHandles();
- WaitState GetWaitState() const;
+ void SignalControlPipe();
- // Returns the deadline for the call to MojoWaitMany().
+ // Returns the deadline for the call to MojoWait().
MojoDeadline GetDeadlineForWait(const RunState& run_state) const;
+ // Run |OnHandleReady()| for the handler registered with |handle|. |handle|
+ // must be registered.
+ void SignalHandleReady(Handle handle);
+
void WillSignalHandler();
void DidSignalHandler();
@@ -132,6 +146,8 @@ class MOJO_MESSAGE_PUMP_EXPORT MessagePumpMojo : public base::MessagePump {
base::ObserverList<Observer> observers_;
+ // Mojo handle for the wait set.
+ ScopedHandle wait_set_handle_;
// Used to wake up run loop from |SignalControlPipe()|.
ScopedMessagePipeHandle read_handle_;
ScopedMessagePipeHandle write_handle_;
« no previous file with comments | « no previous file | mojo/message_pump/message_pump_mojo.cc » ('j') | mojo/message_pump/message_pump_mojo.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698