| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/test/task_graph_runner_test_template.h" | 5 #include "cc/test/task_graph_runner_test_template.h" |
| 6 | 6 |
| 7 namespace cc { | 7 namespace cc { |
| 8 | 8 |
| 9 const int TaskGraphRunnerTestBase::kNamespaceCount; | 9 const int TaskGraphRunnerTestBase::kNamespaceCount; |
| 10 | 10 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 const std::vector<TaskInfo>& tasks) { | 58 const std::vector<TaskInfo>& tasks) { |
| 59 Task::Vector new_tasks; | 59 Task::Vector new_tasks; |
| 60 Task::Vector new_dependents; | 60 Task::Vector new_dependents; |
| 61 TaskGraph new_graph; | 61 TaskGraph new_graph; |
| 62 | 62 |
| 63 for (std::vector<TaskInfo>::const_iterator it = tasks.begin(); | 63 for (std::vector<TaskInfo>::const_iterator it = tasks.begin(); |
| 64 it != tasks.end(); ++it) { | 64 it != tasks.end(); ++it) { |
| 65 scoped_refptr<FakeTaskImpl> new_task( | 65 scoped_refptr<FakeTaskImpl> new_task( |
| 66 new FakeTaskImpl(this, it->namespace_index, it->id)); | 66 new FakeTaskImpl(this, it->namespace_index, it->id)); |
| 67 new_graph.nodes.push_back( | 67 new_graph.nodes.push_back( |
| 68 TaskGraph::Node(new_task.get(), it->category, it->priority, 0u)); | 68 TaskGraph::Node(new_task.get(), it->priority, 0u)); |
| 69 for (unsigned i = 0; i < it->dependent_count; ++i) { | 69 for (unsigned i = 0; i < it->dependent_count; ++i) { |
| 70 scoped_refptr<FakeDependentTaskImpl> new_dependent_task( | 70 scoped_refptr<FakeDependentTaskImpl> new_dependent_task( |
| 71 new FakeDependentTaskImpl(this, it->namespace_index, | 71 new FakeDependentTaskImpl(this, it->namespace_index, |
| 72 it->dependent_id)); | 72 it->dependent_id)); |
| 73 new_graph.nodes.push_back(TaskGraph::Node( | 73 new_graph.nodes.push_back( |
| 74 new_dependent_task.get(), it->category, it->priority, 1u)); | 74 TaskGraph::Node(new_dependent_task.get(), it->priority, 1u)); |
| 75 new_graph.edges.push_back( | 75 new_graph.edges.push_back( |
| 76 TaskGraph::Edge(new_task.get(), new_dependent_task.get())); | 76 TaskGraph::Edge(new_task.get(), new_dependent_task.get())); |
| 77 | 77 |
| 78 new_dependents.push_back(new_dependent_task.get()); | 78 new_dependents.push_back(new_dependent_task.get()); |
| 79 } | 79 } |
| 80 | 80 |
| 81 new_tasks.push_back(new_task.get()); | 81 new_tasks.push_back(new_task.get()); |
| 82 } | 82 } |
| 83 | 83 |
| 84 task_graph_runner_->ScheduleTasks(namespace_token_[namespace_index], | 84 task_graph_runner_->ScheduleTasks(namespace_token_[namespace_index], |
| 85 &new_graph); | 85 &new_graph); |
| 86 | 86 |
| 87 dependents_[namespace_index].swap(new_dependents); | 87 dependents_[namespace_index].swap(new_dependents); |
| 88 tasks_[namespace_index].swap(new_tasks); | 88 tasks_[namespace_index].swap(new_tasks); |
| 89 } | 89 } |
| 90 | 90 |
| 91 void TaskGraphRunnerTestBase::FakeTaskImpl::RunOnWorkerThread() { | 91 void TaskGraphRunnerTestBase::FakeTaskImpl::RunOnWorkerThread() { |
| 92 test_->RunTaskOnWorkerThread(namespace_index_, id_); | 92 test_->RunTaskOnWorkerThread(namespace_index_, id_); |
| 93 } | 93 } |
| 94 | 94 |
| 95 void TaskGraphRunnerTestBase::FakeTaskImpl::CompleteOnOriginThread() { | 95 void TaskGraphRunnerTestBase::FakeTaskImpl::CompleteOnOriginThread() { |
| 96 test_->OnTaskCompleted(namespace_index_, id_); | 96 test_->OnTaskCompleted(namespace_index_, id_); |
| 97 } | 97 } |
| 98 | 98 |
| 99 } // namespace cc | 99 } // namespace cc |
| OLD | NEW |