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) { |