diff options
author | darin@google.com <darin@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-09 05:15:56 +0000 |
---|---|---|
committer | darin@google.com <darin@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-09 05:15:56 +0000 |
commit | 166020bd7aade44caeaefd67422b6162172a8956 (patch) | |
tree | 8efb28c81b85111a792a82c28d69f0fd0cdc8c10 /base/message_loop.h | |
parent | 61198eeba940f70a9ecaa36faa9e5b84555011ea (diff) | |
download | chromium_src-166020bd7aade44caeaefd67422b6162172a8956.zip chromium_src-166020bd7aade44caeaefd67422b6162172a8956.tar.gz chromium_src-166020bd7aade44caeaefd67422b6162172a8956.tar.bz2 |
Delete pending tasks that have not run. To do this properly, I found that I cannot clear MessageLoop::current() until all of the tasks have been deleted.
I wrote a loop to make sure that the queues are all empty. This could be abused, obviously. Another approach would be to CHECK that the second loop doesn't do anything. Thoughts?
R=jar
Review URL: http://codereview.chromium.org/1829
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1891 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/message_loop.h')
-rw-r--r-- | base/message_loop.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/base/message_loop.h b/base/message_loop.h index 53c832a..9343c4e 100644 --- a/base/message_loop.h +++ b/base/message_loop.h @@ -322,8 +322,9 @@ class MessageLoop : public base::MessagePump::Delegate { void ReloadWorkQueue(); // Delete tasks that haven't run yet without running them. Used in the - // destructor to make sure all the task's destructors get called. - void DeletePendingTasks(); + // destructor to make sure all the task's destructors get called. Returns + // true if some work was done. + bool DeletePendingTasks(); // Post a task to our incomming queue. void PostTask_Helper(const tracked_objects::Location& from_here, Task* task, @@ -364,6 +365,7 @@ class MessageLoop : public base::MessagePump::Delegate { scoped_refptr<base::MessagePump> pump_; ObserverList<DestructionObserver> destruction_observers_; + // A recursion block that prevents accidentally running additonal tasks when // insider a (accidentally induced?) nested message pump. bool nestable_tasks_allowed_; |