Chromium Code Reviews| Index: cc/worker_pool.h |
| diff --git a/cc/worker_pool.h b/cc/worker_pool.h |
| index f47dd70b9981b23af18184c6c3f0ea911b051c12..599ea590aa59a1917908e297f75a5dad8e7272e8 100644 |
| --- a/cc/worker_pool.h |
| +++ b/cc/worker_pool.h |
| @@ -24,6 +24,8 @@ class WorkerPoolTask { |
| virtual void Run(RenderingStats* rendering_stats) = 0; |
| + virtual void DeferToThread(base::Thread* thread) = 0; |
| + |
| void Completed(); |
| protected: |
| @@ -64,6 +66,15 @@ class WorkerPool { |
| // Collect rendering stats all completed tasks. |
| void GetRenderingStats(RenderingStats* stats); |
| + // Run cheap, low latency tasks on the main thread. If the pending cheap tasks |
| + // take too long to run, the remaining ones are deferred to the worker |
| + // threads. Returns true if any cheap tasks were run. |
| + bool RunCheapTasks(); |
| + |
| + // Control whether cheap (main thread) tasks are allowed to be queued for |
| + // execution. |
| + void SetCheapTasksAllowed(bool allowed); |
|
reveman
2013/02/13 22:17:36
would it be possible to leave this in the tile man
|
| + |
| protected: |
| class Worker : public base::Thread { |
| public: |
| @@ -103,6 +114,8 @@ class WorkerPool { |
| explicit WorkerPool(size_t num_threads); |
| WorkerPool::Worker* GetWorkerForNextTask(); |
| + bool CanPostCheapTask() const; |
| + void PostCheapTask(scoped_ptr<internal::WorkerPoolTask> task); |
| private: |
| class NumPendingTasksComparator { |
| @@ -120,6 +133,11 @@ class WorkerPool { |
| bool workers_need_sorting_; |
| bool shutdown_; |
| + bool cheap_tasks_allowed_; |
| + bool running_cheap_tasks_; |
| + ScopedPtrDeque<internal::WorkerPoolTask> pending_cheap_tasks_; |
| + scoped_ptr<RenderingStats> cheap_rendering_stats_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(WorkerPool); |
| }; |