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

Unified Diff: cc/raster/task_graph_work_queue.cc

Issue 1784623005: Test dynamic priorities (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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.cc ('k') | cc/raster/tile_task_runner.h » ('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..2c7a6010805ccc37e370bf00d1de68ef0690c9b2 100644
--- a/cc/raster/task_graph_work_queue.cc
+++ b/cc/raster/task_graph_work_queue.cc
@@ -61,6 +61,28 @@ NamespaceToken TaskGraphWorkQueue::GetNamespaceToken() {
return token;
}
+void AdjustRunnerPriority(Task* task, uint16_t old_cat, uint16_t new_cat) {
+ // Remove or put DCHECK.
+ if (old_cat == new_cat)
+ return;
+
+ // Put DCHECK.
+ if (!task->IsRasterTask())
+ return;
+
+ base::TestSimpleThread* runner = task->GetRunner();
+
+ // Currently take care of only speeding up background threads.
+ if (new_cat == TASK_CATEGORY_NONCONCURRENT_FOREGROUND ||
+ new_cat == TASK_CATEGORY_FOREGROUND) {
+ if (runner->Speedup()) {
+ // LOG(ERROR) << "\nPRAS:: [" << std::hex << runner << "] "
+ // << runner->GetPrioritySetForDebugging()
+ // << ". Runner speeded up ^^^^^^^^^";
+ }
+ }
+}
+
void TaskGraphWorkQueue::ScheduleTasks(NamespaceToken token, TaskGraph* graph) {
TaskNamespace& task_namespace = namespaces_[token];
@@ -100,11 +122,16 @@ void TaskGraphWorkQueue::ScheduleTasks(NamespaceToken token, TaskGraph* graph) {
continue;
// Skip if already running.
- if (std::any_of(task_namespace.running_tasks.begin(),
- task_namespace.running_tasks.end(),
- [&node](const CategorizedTask& task) {
- return task.second == node.task;
- }))
+ if (std::any_of(
+ task_namespace.running_tasks.begin(),
+ task_namespace.running_tasks.end(),
+ [&node](const CategorizedTask& task) {
+ if ((task.second == node.task) && task.first != node.category) {
+ AdjustRunnerPriority(task.second.get(), (uint16_t)task.first,
+ (uint16_t)node.category);
+ }
+ return task.second == node.task;
+ }))
continue;
task_namespace.ready_to_run_tasks[node.category].push_back(PrioritizedTask(
« no previous file with comments | « cc/raster/task_graph_runner.cc ('k') | cc/raster/tile_task_runner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698