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

Unified Diff: content/renderer/raster_worker_pool.cc

Issue 1489233003: TaskGraphRunner Group support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@refactor
Patch Set: feedback Created 5 years 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
« cc/raster/task_category.h ('K') | « cc/tiles/tile_manager.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/raster_worker_pool.cc
diff --git a/content/renderer/raster_worker_pool.cc b/content/renderer/raster_worker_pool.cc
index 89ed6d62b91c65a83fe32912336df4cdf8ebd4d4..f2cb62f18c473360a33dd25f266d242443965be6 100644
--- a/content/renderer/raster_worker_pool.cc
+++ b/content/renderer/raster_worker_pool.cc
@@ -7,6 +7,7 @@
#include "base/strings/stringprintf.h"
#include "base/threading/thread_restrictions.h"
#include "base/trace_event/trace_event.h"
+#include "cc/raster/task_category.h"
namespace content {
@@ -47,7 +48,9 @@ class RasterWorkerPool::RasterWorkerPoolSequencedTaskRunner
if (!graph_.nodes.empty())
dependencies = 1;
- cc::TaskGraph::Node node(graph_task.get(), 0, dependencies);
+ cc::TaskGraph::Node node(graph_task.get(),
+ cc::TASK_CATEGORY_HIGH_PRIORITY,
+ 0u /* priority */, dependencies);
if (dependencies) {
graph_.edges.push_back(
cc::TaskGraph::Edge(graph_.nodes.back().task, node.task));
@@ -148,7 +151,9 @@ bool RasterWorkerPool::PostDelayedTask(
tasks_.push_back(make_scoped_refptr(new ClosureTask(task)));
graph_.Reset();
for (const auto& graph_task : tasks_)
- graph_.nodes.push_back(cc::TaskGraph::Node(graph_task.get(), 0, 0));
+ graph_.nodes.push_back(
+ cc::TaskGraph::Node(graph_task.get(), cc::TASK_CATEGORY_HIGH_PRIORITY,
+ 0u /* priority */, 0u /* dependencies */));
ScheduleTasksWithLockAcquired(namespace_token_, &graph_);
completed_tasks_.clear();
@@ -263,7 +268,17 @@ void RasterWorkerPool::RunTaskWithLockAcquired() {
lock_.AssertAcquired();
- auto prioritized_task = work_queue_.GetNextTaskToRun();
+ // Find the first category with any tasks to run. Categories used by this task
+ // graph runner are ordered by priority.
+ // TODO(ericrk): Add more category/thread logic.
+ uint16_t category;
+ for (category = 0u; category < cc::kNumTaskCategories; ++category) {
+ if (work_queue_.HasReadyToRunTasksForCategory(category))
+ break;
+ }
+ DCHECK(category < cc::kNumTaskCategories);
+
+ auto prioritized_task = work_queue_.GetNextTaskToRun(category);
cc::Task* task = prioritized_task.task;
// There may be more work available, so wake up another worker thread.
« cc/raster/task_category.h ('K') | « cc/tiles/tile_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698