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

Unified Diff: base/threading/worker_pool_posix.h

Issue 8565024: base: Refactor PendingTask out of MessageLoop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review fixes. Created 9 years, 1 month 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
« no previous file with comments | « base/pending_task.cc ('k') | base/threading/worker_pool_posix.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/threading/worker_pool_posix.h
diff --git a/base/threading/worker_pool_posix.h b/base/threading/worker_pool_posix.h
index 2cc1150e1612a4b5748bd27b0a1b1974ab792775..1b5032b569c9a8f1c9cd61156d1e26ef504f5c54 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.
« no previous file with comments | « base/pending_task.cc ('k') | base/threading/worker_pool_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698