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

Unified Diff: mojo/public/utility/run_loop.h

Issue 134253004: Mojo: AsyncWaiter and mojo/public/environment (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add missing files Created 6 years, 11 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/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_;

Powered by Google App Engine
This is Rietveld 408576698