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

Unified Diff: cc/worker_pool.h

Issue 12194015: cc: Rasterize cheap tiles immediately (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Schedule cheap tasks in worker pool. Created 7 years, 10 months 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
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);
};

Powered by Google App Engine
This is Rietveld 408576698