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

Unified Diff: content/renderer/raster_worker_pool.h

Issue 1739993004: content: Implement dynamic priorities for raster threads. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: preparing for checkin. Created 4 years, 9 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: content/renderer/raster_worker_pool.h
diff --git a/content/renderer/raster_worker_pool.h b/content/renderer/raster_worker_pool.h
index b4ddf9a61c251e6f759400ccff94266941a2f604..e26d6ed5cccc482450da6dfbf85a14e06abdc6d5 100644
--- a/content/renderer/raster_worker_pool.h
+++ b/content/renderer/raster_worker_pool.h
@@ -29,7 +29,8 @@ namespace content {
// It's also possible to get the underlying TaskGraphRunner to schedule a graph
// of tasks with their dependencies.
class CONTENT_EXPORT RasterWorkerPool : public base::TaskRunner,
- public cc::TaskGraphRunner {
+ public cc::TaskGraphRunner,
+ public cc::TaskGraphWorkQueueClient {
public:
RasterWorkerPool();
@@ -46,9 +47,17 @@ class CONTENT_EXPORT RasterWorkerPool : public base::TaskRunner,
void CollectCompletedTasks(cc::NamespaceToken token,
cc::Task::Vector* completed_tasks) override;
+ // TODO(prashant.n): Move this to separate class to control workers
+ // efficiently.
+ // Overridden from cc::TaskGraphWorkQueueClient:
+ void AdjustWorkerPriorityForTask(cc::Task* task,
+ uint16_t old_category,
+ uint16_t new_category) override;
+
// Runs a task from one of the provided categories. Categories listed first
// have higher priority.
- void Run(const std::vector<cc::TaskCategory>& categories,
+ void Run(cc::TaskWorker* worker,
+ const std::vector<cc::TaskCategory>& categories,
base::ConditionVariable* has_ready_to_run_tasks_cv);
void FlushForTesting();
@@ -101,11 +110,13 @@ class CONTENT_EXPORT RasterWorkerPool : public base::TaskRunner,
// Runs a task from one of the provided categories. Categories listed first
// have higher priority. Returns false if there were no tasks to run.
- bool RunTaskWithLockAcquired(const std::vector<cc::TaskCategory>& categories);
+ bool RunTaskWithLockAcquired(cc::TaskWorker* worker,
+ const std::vector<cc::TaskCategory>& categories);
// Run next task for the given category. Caller must acquire |lock_| prior to
// calling this function and make sure at least one task is ready to run.
- void RunTaskInCategoryWithLockAcquired(cc::TaskCategory category);
+ void RunTaskInCategoryWithLockAcquired(cc::TaskWorker* worker,
+ cc::TaskCategory category);
// Helper function which signals worker threads if tasks are ready to run.
void SignalHasReadyToRunTasksWithLockAcquired();
@@ -116,7 +127,7 @@ class CONTENT_EXPORT RasterWorkerPool : public base::TaskRunner,
bool ShouldRunTaskForCategoryWithLockAcquired(cc::TaskCategory category);
// The actual threads where work is done.
- std::vector<scoped_ptr<base::SimpleThread>> threads_;
+ std::vector<scoped_ptr<base::DynamicPriorityThread>> threads_;
// Lock to exclusively access all the following members that are used to
// implement the TaskRunner and TaskGraphRunner interfaces.

Powered by Google App Engine
This is Rietveld 408576698