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) { | |
vmpstr
2016/05/18 19:08:34
nit: auto* task
prashant.n
2016/05/19 14:32:30
It is scoped_refptr class object, so it would not
ericrk
2016/05/19 23:19:37
In that case, would auto& be more appropriate - th
prashant.n
2016/05/20 11:48:52
Now I understood why vmpstr added comment. Thank y
| |
276 // Instead of calling DidComplete(), call Reset() as same task would be | |
277 // reused as if new. | |
278 task->state().Reset(); | |
279 } | |
280 | |
275 return completed_tasks->size(); | 281 return completed_tasks->size(); |
276 } | 282 } |
277 | 283 |
278 // Test uses SynchronousTaskGraphRunner, as this implementation introduces | 284 // Test uses SynchronousTaskGraphRunner, as this implementation introduces |
279 // minimal additional complexity over the TaskGraphWorkQueue helpers. | 285 // minimal additional complexity over the TaskGraphWorkQueue helpers. |
280 std::unique_ptr<SynchronousTaskGraphRunner> task_graph_runner_; | 286 std::unique_ptr<SynchronousTaskGraphRunner> task_graph_runner_; |
281 NamespaceToken namespace_token_; | 287 NamespaceToken namespace_token_; |
282 LapTimer timer_; | 288 LapTimer timer_; |
283 }; | 289 }; |
284 | 290 |
(...skipping 28 matching lines...) Expand all Loading... | |
313 RunScheduleAndExecuteTasksTest("0_1_0", 0, 1, 0); | 319 RunScheduleAndExecuteTasksTest("0_1_0", 0, 1, 0); |
314 RunScheduleAndExecuteTasksTest("0_32_0", 0, 32, 0); | 320 RunScheduleAndExecuteTasksTest("0_32_0", 0, 32, 0); |
315 RunScheduleAndExecuteTasksTest("2_1_0", 2, 1, 0); | 321 RunScheduleAndExecuteTasksTest("2_1_0", 2, 1, 0); |
316 RunScheduleAndExecuteTasksTest("2_32_0", 2, 32, 0); | 322 RunScheduleAndExecuteTasksTest("2_32_0", 2, 32, 0); |
317 RunScheduleAndExecuteTasksTest("2_1_1", 2, 1, 1); | 323 RunScheduleAndExecuteTasksTest("2_1_1", 2, 1, 1); |
318 RunScheduleAndExecuteTasksTest("2_32_1", 2, 32, 1); | 324 RunScheduleAndExecuteTasksTest("2_32_1", 2, 32, 1); |
319 } | 325 } |
320 | 326 |
321 } // namespace | 327 } // namespace |
322 } // namespace cc | 328 } // namespace cc |
OLD | NEW |