Index: mojo/public/utility/run_loop.h |
diff --git a/mojo/public/utility/run_loop.h b/mojo/public/utility/run_loop.h |
index 49c8c2d108d9a00aa9a7587c66867276c9eef7b6..be39edb2d54416700fd9bb7b05284ddd9ce4d353 100644 |
--- a/mojo/public/utility/run_loop.h |
+++ b/mojo/public/utility/run_loop.h |
@@ -41,6 +41,12 @@ class RunLoop { |
// Runs the loop servicing handles as they are ready. This returns when Quit() |
// is invoked, or there no more handles. |
void Run(); |
+ |
+ // Runs the loop servicing any handles that are ready. Does not wait for |
+ // handles to become ready before returning. Returns early if Quit() is |
+ // invoked. |
+ void RunUntilIdle(); |
+ |
void Quit(); |
private: |
@@ -65,18 +71,21 @@ class RunLoop { |
typedef std::map<Handle, HandlerData> HandleToHandlerData; |
// Waits for a handle to be ready. Returns after servicing at least one |
- // handle (or there are no more handles). |
- void Wait(); |
+ // handle (or there are no more handles) unless |non_blocking| is true, |
+ // in which case it will also return if servicing at least one handle |
+ // would require blocking. Returns true if a RunLoopHandler was notified. |
+ bool Wait(bool non_blocking); |
- // Notifies any handlers whose deadline has expired. |
- void NotifyDeadlineExceeded(); |
+ // Notifies any handlers whose deadline has expired. Returns true if a |
+ // RunLoopHandler was notified. |
+ bool NotifyDeadlineExceeded(); |
// Removes the first invalid handle. This is called if MojoWaitMany() finds an |
- // invalid handle. |
- void RemoveFirstInvalidHandle(const WaitState& wait_state); |
+ // invalid handle. Returns true if a RunLoopHandler was notified. |
+ bool RemoveFirstInvalidHandle(const WaitState& wait_state); |
// Returns the state needed to pass to WaitMany(). |
- WaitState GetWaitState() const; |
+ WaitState GetWaitState(bool non_blocking) const; |
HandleToHandlerData handler_data_; |