OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "cc/raster/task_graph_work_queue.h" | 5 #include "cc/raster/task_graph_work_queue.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 }; | 45 }; |
46 } // namespace | 46 } // namespace |
47 | 47 |
48 TaskGraphWorkQueue::TaskNamespace::TaskNamespace() {} | 48 TaskGraphWorkQueue::TaskNamespace::TaskNamespace() {} |
49 | 49 |
50 TaskGraphWorkQueue::TaskNamespace::TaskNamespace(const TaskNamespace& other) = | 50 TaskGraphWorkQueue::TaskNamespace::TaskNamespace(const TaskNamespace& other) = |
51 default; | 51 default; |
52 | 52 |
53 TaskGraphWorkQueue::TaskNamespace::~TaskNamespace() {} | 53 TaskGraphWorkQueue::TaskNamespace::~TaskNamespace() {} |
54 | 54 |
55 TaskGraphWorkQueue::TaskGraphWorkQueue() : next_namespace_id_(1) {} | 55 TaskGraphWorkQueue::TaskGraphWorkQueue(TaskGraphWorkQueueClient* client) |
| 56 : client_(client), next_namespace_id_(1) {} |
56 TaskGraphWorkQueue::~TaskGraphWorkQueue() {} | 57 TaskGraphWorkQueue::~TaskGraphWorkQueue() {} |
57 | 58 |
58 NamespaceToken TaskGraphWorkQueue::GetNamespaceToken() { | 59 NamespaceToken TaskGraphWorkQueue::GetNamespaceToken() { |
59 NamespaceToken token(next_namespace_id_++); | 60 NamespaceToken token(next_namespace_id_++); |
60 DCHECK(namespaces_.find(token) == namespaces_.end()); | 61 DCHECK(namespaces_.find(token) == namespaces_.end()); |
61 return token; | 62 return token; |
62 } | 63 } |
63 | 64 |
64 void TaskGraphWorkQueue::ScheduleTasks(NamespaceToken token, TaskGraph* graph) { | 65 void TaskGraphWorkQueue::ScheduleTasks(NamespaceToken token, TaskGraph* graph) { |
65 TaskNamespace& task_namespace = namespaces_[token]; | 66 TaskNamespace& task_namespace = namespaces_[token]; |
(...skipping 30 matching lines...) Expand all Loading... |
96 continue; | 97 continue; |
97 | 98 |
98 // Skip if already finished running task. | 99 // Skip if already finished running task. |
99 if (node.task->HasFinishedRunning()) | 100 if (node.task->HasFinishedRunning()) |
100 continue; | 101 continue; |
101 | 102 |
102 // Skip if already running. | 103 // Skip if already running. |
103 if (std::any_of(task_namespace.running_tasks.begin(), | 104 if (std::any_of(task_namespace.running_tasks.begin(), |
104 task_namespace.running_tasks.end(), | 105 task_namespace.running_tasks.end(), |
105 [&node](const CategorizedTask& task) { | 106 [&node](const CategorizedTask& task) { |
| 107 if ((task.second == node.task) && |
| 108 task.first != node.category) { |
| 109 // Fix lambda error. |
| 110 // client_->AdjustWorkerPriorityForTask( |
| 111 // task.second.get(), (uint16_t)task.first, |
| 112 // (uint16_t)node.category); |
| 113 } |
106 return task.second == node.task; | 114 return task.second == node.task; |
107 })) | 115 })) |
108 continue; | 116 continue; |
109 | 117 |
110 task_namespace.ready_to_run_tasks[node.category].push_back(PrioritizedTask( | 118 task_namespace.ready_to_run_tasks[node.category].push_back(PrioritizedTask( |
111 node.task, &task_namespace, node.category, node.priority)); | 119 node.task, &task_namespace, node.category, node.priority)); |
112 } | 120 } |
113 | 121 |
114 // Rearrange the elements in each vector within |ready_to_run_tasks| in such a | 122 // Rearrange the elements in each vector within |ready_to_run_tasks| in such a |
115 // way that they form a heap. | 123 // way that they form a heap. |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 | 309 |
302 for (const TaskGraph::Node& node : graph->nodes) { | 310 for (const TaskGraph::Node& node : graph->nodes) { |
303 if (dependents[node.task] != node.dependencies) | 311 if (dependents[node.task] != node.dependencies) |
304 return true; | 312 return true; |
305 } | 313 } |
306 | 314 |
307 return false; | 315 return false; |
308 } | 316 } |
309 | 317 |
310 } // namespace cc | 318 } // namespace cc |
OLD | NEW |