| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 it != top_level_tasks.end(); ++it) { | 265 it != top_level_tasks.end(); ++it) { |
| 266 graph->nodes.push_back(TaskGraph::Node( | 266 graph->nodes.push_back(TaskGraph::Node( |
| 267 it->get(), 0u, 0u, static_cast<uint32_t>(tasks.size()))); | 267 it->get(), 0u, 0u, static_cast<uint32_t>(tasks.size()))); |
| 268 } | 268 } |
| 269 } | 269 } |
| 270 | 270 |
| 271 size_t CollectCompletedTasks(Task::Vector* completed_tasks) { | 271 size_t CollectCompletedTasks(Task::Vector* completed_tasks) { |
| 272 DCHECK(completed_tasks->empty()); | 272 DCHECK(completed_tasks->empty()); |
| 273 task_graph_runner_->CollectCompletedTasks(namespace_token_, | 273 task_graph_runner_->CollectCompletedTasks(namespace_token_, |
| 274 completed_tasks); | 274 completed_tasks); |
| 275 for (auto& task : *completed_tasks) { |
| 276 // Reset task state as same task would be reused as if new. |
| 277 task->state().Reset(); |
| 278 } |
| 279 |
| 275 return completed_tasks->size(); | 280 return completed_tasks->size(); |
| 276 } | 281 } |
| 277 | 282 |
| 278 // Test uses SynchronousTaskGraphRunner, as this implementation introduces | 283 // Test uses SynchronousTaskGraphRunner, as this implementation introduces |
| 279 // minimal additional complexity over the TaskGraphWorkQueue helpers. | 284 // minimal additional complexity over the TaskGraphWorkQueue helpers. |
| 280 std::unique_ptr<SynchronousTaskGraphRunner> task_graph_runner_; | 285 std::unique_ptr<SynchronousTaskGraphRunner> task_graph_runner_; |
| 281 NamespaceToken namespace_token_; | 286 NamespaceToken namespace_token_; |
| 282 LapTimer timer_; | 287 LapTimer timer_; |
| 283 }; | 288 }; |
| 284 | 289 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 313 RunScheduleAndExecuteTasksTest("0_1_0", 0, 1, 0); | 318 RunScheduleAndExecuteTasksTest("0_1_0", 0, 1, 0); |
| 314 RunScheduleAndExecuteTasksTest("0_32_0", 0, 32, 0); | 319 RunScheduleAndExecuteTasksTest("0_32_0", 0, 32, 0); |
| 315 RunScheduleAndExecuteTasksTest("2_1_0", 2, 1, 0); | 320 RunScheduleAndExecuteTasksTest("2_1_0", 2, 1, 0); |
| 316 RunScheduleAndExecuteTasksTest("2_32_0", 2, 32, 0); | 321 RunScheduleAndExecuteTasksTest("2_32_0", 2, 32, 0); |
| 317 RunScheduleAndExecuteTasksTest("2_1_1", 2, 1, 1); | 322 RunScheduleAndExecuteTasksTest("2_1_1", 2, 1, 1); |
| 318 RunScheduleAndExecuteTasksTest("2_32_1", 2, 32, 1); | 323 RunScheduleAndExecuteTasksTest("2_32_1", 2, 32, 1); |
| 319 } | 324 } |
| 320 | 325 |
| 321 } // namespace | 326 } // namespace |
| 322 } // namespace cc | 327 } // namespace cc |
| OLD | NEW |