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

Unified Diff: cc/raster/task_graph_work_queue.cc

Issue 1739993004: content: Implement dynamic priorities for raster threads. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Traces corrected. 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
« no previous file with comments | « cc/raster/task_graph_runner.h ('k') | content/renderer/raster_worker_pool.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/raster/task_graph_work_queue.cc
diff --git a/cc/raster/task_graph_work_queue.cc b/cc/raster/task_graph_work_queue.cc
index 98413eee1a668a196f137dd9f4ce0ffbfe59bdff..4d2cb040be420ef9a90fde7bf4a135ff6bf4d6d5 100644
--- a/cc/raster/task_graph_work_queue.cc
+++ b/cc/raster/task_graph_work_queue.cc
@@ -77,6 +77,11 @@ void TaskGraphWorkQueue::ScheduleTasks(NamespaceToken token, TaskGraph* graph) {
for (auto& ready_to_run_tasks_it : task_namespace.ready_to_run_tasks) {
ready_to_run_tasks_it.second.clear();
}
+
+ for (const CategorizedTask& task : task_namespace.running_tasks) {
+ task.second->cancelled = true;
+ }
+
for (const TaskGraph::Node& node : graph->nodes) {
// Remove any old nodes that are associated with this task. The result is
// that the old graph is left with all nodes not present in this graph,
@@ -103,14 +108,45 @@ void TaskGraphWorkQueue::ScheduleTasks(NamespaceToken token, TaskGraph* graph) {
if (std::any_of(task_namespace.running_tasks.begin(),
task_namespace.running_tasks.end(),
[&node](const CategorizedTask& task) {
+ if (task.second == node.task) {
+ if (task.first > node.category) {
+ TRACE_EVENT2("cc, pras", "Task::Rescheduled::Speedup",
+ "Old Category", task.first,
+ "New Category", node.category);
+ } else if (task.first < node.category) {
+ TRACE_EVENT2("cc, pras",
+ "Task::Rescheduled::Slowdown",
+ "Old Category", task.first,
+ "New Category", node.category);
+ } else {
+ TRACE_EVENT2("cc, pras", "Task::Rescheduled::Same",
+ "Old Category", task.first,
+ "New Category", node.category);
+ }
+
+ task.second->cancelled = false;
+ }
+
return task.second == node.task;
}))
continue;
+ {
+ TRACE_EVENT1("cc, pras", "Task::Scheduled::New", "New Category",
+ node.category);
+ }
+
task_namespace.ready_to_run_tasks[node.category].push_back(PrioritizedTask(
node.task, &task_namespace, node.category, node.priority));
}
+ for (const CategorizedTask& task : task_namespace.running_tasks) {
+ if (task.second->cancelled) {
+ TRACE_EVENT1("cc, pras", "Task::Rescheduled::Cancelled", "Old Category",
+ task.first);
+ }
+ }
+
// Rearrange the elements in each vector within |ready_to_run_tasks| in such a
// way that they form a heap.
for (auto& it : task_namespace.ready_to_run_tasks) {
« no previous file with comments | « cc/raster/task_graph_runner.h ('k') | content/renderer/raster_worker_pool.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698