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

Side by Side Diff: cc/raster/task_graph_work_queue.cc

Issue 1666283002: Reland - Refactor signaling in RWP (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 unified diff | Download patch
OLDNEW
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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 // taking top priority task. 188 // taking top priority task.
189 if (!ready_to_run_tasks.empty()) { 189 if (!ready_to_run_tasks.empty()) {
190 ready_to_run_namespaces.push_back(task_namespace); 190 ready_to_run_namespaces.push_back(task_namespace);
191 std::push_heap(ready_to_run_namespaces.begin(), 191 std::push_heap(ready_to_run_namespaces.begin(),
192 ready_to_run_namespaces.end(), 192 ready_to_run_namespaces.end(),
193 CompareTaskNamespacePriority(category)); 193 CompareTaskNamespacePriority(category));
194 } 194 }
195 195
196 // Add task to |running_tasks|. 196 // Add task to |running_tasks|.
197 task_namespace->running_tasks.push_back(task.task); 197 task_namespace->running_tasks.push_back(task.task);
198 running_task_count_[category]++;
198 199
199 return task; 200 return task;
200 } 201 }
201 202
202 void TaskGraphWorkQueue::CompleteTask(const PrioritizedTask& completed_task) { 203 void TaskGraphWorkQueue::CompleteTask(const PrioritizedTask& completed_task) {
203 TaskNamespace* task_namespace = completed_task.task_namespace; 204 TaskNamespace* task_namespace = completed_task.task_namespace;
204 scoped_refptr<Task> task(completed_task.task); 205 scoped_refptr<Task> task(completed_task.task);
205 206
206 // Remove task from |running_tasks|. 207 // Remove task from |running_tasks|.
207 auto it = std::find(task_namespace->running_tasks.begin(), 208 auto it = std::find(task_namespace->running_tasks.begin(),
208 task_namespace->running_tasks.end(), task); 209 task_namespace->running_tasks.end(), task);
209 DCHECK(it != task_namespace->running_tasks.end()); 210 DCHECK(it != task_namespace->running_tasks.end());
210 std::swap(*it, task_namespace->running_tasks.back()); 211 std::swap(*it, task_namespace->running_tasks.back());
211 task_namespace->running_tasks.pop_back(); 212 task_namespace->running_tasks.pop_back();
213 running_task_count_[completed_task.category]--;
212 214
213 // Now iterate over all dependents to decrement dependencies and check if they 215 // Now iterate over all dependents to decrement dependencies and check if they
214 // are ready to run. 216 // are ready to run.
215 bool ready_to_run_namespaces_has_heap_properties = true; 217 bool ready_to_run_namespaces_has_heap_properties = true;
216 for (DependentIterator it(&task_namespace->graph, task.get()); it; ++it) { 218 for (DependentIterator it(&task_namespace->graph, task.get()); it; ++it) {
217 TaskGraph::Node& dependent_node = *it; 219 TaskGraph::Node& dependent_node = *it;
218 220
219 DCHECK_LT(0u, dependent_node.dependencies); 221 DCHECK_LT(0u, dependent_node.dependencies);
220 dependent_node.dependencies--; 222 dependent_node.dependencies--;
221 // Task is ready if it has no dependencies. Add it to |ready_to_run_tasks_|. 223 // Task is ready if it has no dependencies. Add it to |ready_to_run_tasks_|.
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 291
290 for (const TaskGraph::Node& node : graph->nodes) { 292 for (const TaskGraph::Node& node : graph->nodes) {
291 if (dependents[node.task] != node.dependencies) 293 if (dependents[node.task] != node.dependencies)
292 return true; 294 return true;
293 } 295 }
294 296
295 return false; 297 return false;
296 } 298 }
297 299
298 } // namespace cc 300 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698