Chromium Code Reviews| 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_; |