Chromium Code Reviews| Index: base/message_loop.h |
| diff --git a/base/message_loop.h b/base/message_loop.h |
| index d78b58addc2019ad46b61e79adf8c918f432a9dd..ccd668fc9172b38a186f518b332655c3e285707a 100644 |
| --- a/base/message_loop.h |
| +++ b/base/message_loop.h |
| @@ -224,23 +224,47 @@ class BASE_EXPORT MessageLoop : public base::MessagePump::Delegate { |
| // Return as soon as all items that can be run are taken care of. |
| void RunAllPending(); |
| - // Signals the Run method to return after it is done processing all pending |
| - // messages. This method may only be called on the same thread that called |
| - // Run, and Run must still be on the call stack. |
| + // TODO(jbates) remove this. crbug.com/131220. See QuitWhenIdle(). |
| + void Quit() { QuitWhenIdle(); } |
| + |
| + // Signals the Run method to return when it becomes idle. It will continue to |
| + // process pending messages and future messages as long as they are enqueued. |
| + // Warning: if the MessageLoop remains busy, it may never quit. Only use this |
| + // Quit method when looping procedures (such as web pages) have been shut |
| + // down. |
| // |
| - // Use QuitClosure if you need to Quit another thread's MessageLoop, but note |
| - // that doing so is fairly dangerous if the target thread makes nested calls |
| - // to MessageLoop::Run. The problem being that you won't know which nested |
| - // run loop you are quitting, so be careful! |
| - void Quit(); |
| + // This method may only be called on the same thread that called Run, and Run |
| + // must still be on the call stack. |
| + // |
| + // Use Quit*Closure variants if you need to Quit another thread's MessageLoop, |
| + // but note that doing so is fairly dangerous if the target thread makes |
| + // nested calls to MessageLoop::Run. The problem being that you won't know |
| + // which nested run loop you are quitting, so be careful! |
| + void QuitWhenIdle(); |
| // This method is a variant of Quit, that does not wait for pending messages |
| // to be processed before returning from Run. |
| void QuitNow(); |
| - // Invokes Quit on the current MessageLoop when run. Useful to schedule an |
| - // arbitrary MessageLoop to Quit. |
| - static base::Closure QuitClosure(); |
| + // This method is a variant of Quit, that only waits for the currently pending |
| + // messages to complete. Any new messages after this call will not be |
| + // processed and will remain enqueued on the MessageLoop. |
| + void QuitAfterPending(); |
|
jar (doing other things)
2012/06/08 01:05:37
nit: I think this is now too terse. I read it as:
jbates
2012/06/13 22:11:20
Removed it since it wasn't adding more than QuitNo
|
| + |
| + // TODO(jbates) remove this. crbug.com/131220. See QuitWhenIdleClosure(). |
| + static base::Closure QuitClosure() { return QuitWhenIdleClosure(); } |
| + |
| + // Invokes QuitWhenIdle on the current MessageLoop when run. Useful to |
|
jar (doing other things)
2012/06/08 01:05:37
nit: I don't think "current MessageLoop" should be
jbates
2012/06/13 22:11:20
Done.
|
| + // schedule an arbitrary MessageLoop to QuitWhenIdle. |
| + static base::Closure QuitWhenIdleClosure(); |
| + |
| + // Invokes QuitNow on the current MessageLoop when run. Useful to schedule an |
| + // arbitrary MessageLoop to QuitNow. |
| + static base::Closure QuitNowClosure(); |
| + |
| + // Invokes QuitAfterPending on the current MessageLoop when run. Useful to |
| + // schedule an arbitrary MessageLoop to QuitAfterPending. |
| + static base::Closure QuitAfterPendingClosure(); |
| // Returns the type passed to the constructor. |
| Type type() const { return type_; } |