| Index: cc/worker_pool.h
|
| diff --git a/cc/worker_pool.h b/cc/worker_pool.h
|
| index 26bce7aedd726c56ffa616a947d6986b67e34909..c7478f37435ddd20ffe7cc316196150d3d8d95e3 100644
|
| --- a/cc/worker_pool.h
|
| +++ b/cc/worker_pool.h
|
| @@ -24,6 +24,7 @@ class WorkerPoolTask {
|
| virtual ~WorkerPoolTask();
|
|
|
| virtual void Run(RenderingStats* rendering_stats) = 0;
|
| + virtual void DeferToThread(base::Thread* thread) = 0;
|
|
|
| bool HasCompleted();
|
| void DidComplete();
|
| @@ -121,6 +122,8 @@ class WorkerPool {
|
| WorkerPool(WorkerPoolClient* client, size_t num_threads);
|
|
|
| WorkerPool::Worker* GetWorkerForNextTask();
|
| + bool CanPostCheapTask() const;
|
| + void PostCheapTask(scoped_ptr<internal::WorkerPoolTask> task);
|
|
|
| private:
|
| class NumPendingTasksComparator {
|
| @@ -151,6 +154,9 @@ class WorkerPool {
|
| // Ensure workers are sorted by number of pending tasks.
|
| void SortWorkersIfNeeded();
|
|
|
| + // Run pending cheap tasks on origin thread.
|
| + void RunCheapTasks();
|
| +
|
| typedef std::vector<Worker*> WorkerVector;
|
| WorkerVector workers_;
|
| WorkerPoolClient* client_;
|
| @@ -161,9 +167,15 @@ class WorkerPool {
|
| base::CancelableClosure check_for_completed_tasks_callback_;
|
| bool check_for_completed_tasks_pending_;
|
| base::Closure idle_callback_;
|
| + base::Closure cheap_task_callback_;
|
| // Accessed from multiple threads. 0 when worker pool is idle.
|
| base::subtle::Atomic32 pending_task_count_;
|
|
|
| + bool cheap_tasks_allowed_;
|
| + bool run_cheap_tasks_pending_;
|
| + ScopedPtrDeque<internal::WorkerPoolTask> pending_cheap_tasks_;
|
| + scoped_ptr<RenderingStats> cheap_rendering_stats_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(WorkerPool);
|
| };
|
|
|
|
|