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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 } | 182 } |
183 | 183 |
184 // Swap task graph. | 184 // Swap task graph. |
185 task_namespace.graph.Swap(graph); | 185 task_namespace.graph.Swap(graph); |
186 | 186 |
187 // Determine what tasks in old graph need to be canceled. | 187 // Determine what tasks in old graph need to be canceled. |
188 for (TaskGraph::Node::Vector::iterator it = graph->nodes.begin(); | 188 for (TaskGraph::Node::Vector::iterator it = graph->nodes.begin(); |
189 it != graph->nodes.end(); ++it) { | 189 it != graph->nodes.end(); ++it) { |
190 TaskGraph::Node& node = *it; | 190 TaskGraph::Node& node = *it; |
191 | 191 |
192 // Skip if already finished running task. | 192 // Skip if already finished or completed. |
193 if (node.task->state().IsFinished()) | 193 if (node.task->state().IsFinished() || node.task->state().IsCompleted()) |
194 continue; | 194 continue; |
195 | 195 |
196 // Skip if already running. | 196 // Skip if already running. |
197 if (std::any_of(task_namespace.running_tasks.begin(), | 197 if (std::any_of(task_namespace.running_tasks.begin(), |
198 task_namespace.running_tasks.end(), | 198 task_namespace.running_tasks.end(), |
199 [&node](const CategorizedTask& task) { | 199 [&node](const CategorizedTask& task) { |
200 return task.second == node.task; | 200 return task.second == node.task; |
201 })) | 201 })) |
202 continue; | 202 continue; |
203 | 203 |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 | 367 |
368 for (const TaskGraph::Node& node : graph->nodes) { | 368 for (const TaskGraph::Node& node : graph->nodes) { |
369 if (dependents[node.task] != node.dependencies) | 369 if (dependents[node.task] != node.dependencies) |
370 return true; | 370 return true; |
371 } | 371 } |
372 | 372 |
373 return false; | 373 return false; |
374 } | 374 } |
375 | 375 |
376 } // namespace cc | 376 } // namespace cc |
OLD | NEW |