summaryrefslogtreecommitdiffstats
path: root/base/worker_pool.h
diff options
context:
space:
mode:
Diffstat (limited to 'base/worker_pool.h')
-rw-r--r--base/worker_pool.h19
1 files changed, 9 insertions, 10 deletions
diff --git a/base/worker_pool.h b/base/worker_pool.h
index 3b0039f..486bf9a 100644
--- a/base/worker_pool.h
+++ b/base/worker_pool.h
@@ -30,21 +30,20 @@
#ifndef BASE_WORKER_POOL_H_
#define BASE_WORKER_POOL_H_
-#include "base/task.h"
+#include "base/tracked.h"
+
+class Task;
// This is a facility that runs tasks that don't require a specific thread or
// a message loop.
class WorkerPool {
public:
- // This function posts |task| to run on a worker thread. |slow| should be used
- // for tasks that will take a long time to execute. |task| will be recycled
- // even if the function fails.
- static bool Run(Task* task, bool slow);
-
- // Recycles the task.
- static void RecycleTask(Task* task) {
- task->RecycleOrDelete();
- }
+ // This function posts |task| to run on a worker thread. |task_is_slow|
+ // should be used for tasks that will take a long time to execute. Returns
+ // false if |task| could not be posted to a worker thread. Regardless of
+ // return value, ownership of |task| is transferred to the worker pool.
+ static bool PostTask(const tracked_objects::Location& from_here,
+ Task* task, bool task_is_slow);
};
#endif // BASE_WORKER_POOL_H_