diff options
author | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-15 23:36:30 +0000 |
---|---|---|
committer | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-15 23:36:30 +0000 |
commit | dd1f9fe143f20d4be760c44c974351e8c9aaca6d (patch) | |
tree | 2cc832d55557cb59e5e8c759033e246681019dee /base/threading/worker_pool_posix.h | |
parent | f371ee77f051996ea398b0076afc8852d4243d04 (diff) | |
download | chromium_src-dd1f9fe143f20d4be760c44c974351e8c9aaca6d.zip chromium_src-dd1f9fe143f20d4be760c44c974351e8c9aaca6d.tar.gz chromium_src-dd1f9fe143f20d4be760c44c974351e8c9aaca6d.tar.bz2 |
base: Refactor PendingTask out of MessageLoop.
Also removes copy/pasted instances of this class.
BUG=none
TEST=none
R=willchan@chromium.org
Review URL: http://codereview.chromium.org/8565024
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@110206 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/threading/worker_pool_posix.h')
-rw-r--r-- | base/threading/worker_pool_posix.h | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/base/threading/worker_pool_posix.h b/base/threading/worker_pool_posix.h index 2cc1150..1b5032b 100644 --- a/base/threading/worker_pool_posix.h +++ b/base/threading/worker_pool_posix.h @@ -34,6 +34,7 @@ #include "base/time.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" +#include "base/pending_task.h" #include "base/synchronization/condition_variable.h" #include "base/synchronization/lock.h" #include "base/threading/platform_thread.h" @@ -48,23 +49,6 @@ class BASE_EXPORT PosixDynamicThreadPool public: class PosixDynamicThreadPoolPeer; - struct PendingTask { - PendingTask(const tracked_objects::Location& posted_from, - const base::Closure& task); - ~PendingTask(); - - // Counter for location where the Closure was posted from. - tracked_objects::Births* birth_tally; - - // Time the task was posted. - tracked_objects::TrackedTime time_posted; - - const tracked_objects::Location posted_from; - - // The task to run. - base::Closure task; - }; - // All worker threads will share the same |name_prefix|. They will exit after // |idle_seconds_before_exit|. PosixDynamicThreadPool(const std::string& name_prefix, @@ -84,7 +68,7 @@ class BASE_EXPORT PosixDynamicThreadPool // Adds |task| to the thread pool. void PostTask(const tracked_objects::Location& from_here, - const base::Closure& task); + const Closure& task); // Worker thread method to wait for up to |idle_seconds_before_exit| for more // work from the thread pool. Returns NULL if no work is available. @@ -107,7 +91,7 @@ class BASE_EXPORT PosixDynamicThreadPool // is being deleted and they can exit. ConditionVariable pending_tasks_available_cv_; int num_idle_threads_; - std::queue<PendingTask> pending_tasks_; + TaskQueue pending_tasks_; bool terminated_; // Only used for tests to ensure correct thread ordering. It will always be // NULL in non-test code. |