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

Unified Diff: cc/resources/task_graph_runner_unittest.cc

Issue 154003006: cc: Switch to vector based TaskGraph implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 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 side-by-side diff with in-line comments
Download patch
Index: cc/resources/task_graph_runner_unittest.cc
diff --git a/cc/resources/task_graph_runner_unittest.cc b/cc/resources/task_graph_runner_unittest.cc
index 6539a1bb45f836caec8e3b02d19c7767d7d4444c..866ac17a148183d13644bd8e44a667d0159d0541 100644
--- a/cc/resources/task_graph_runner_unittest.cc
+++ b/cc/resources/task_graph_runner_unittest.cc
@@ -74,29 +74,27 @@ class TaskGraphRunnerTestBase {
void ScheduleTasks(int namespace_index, const std::vector<Task>& tasks) {
internal::Task::Vector new_tasks;
internal::Task::Vector new_dependents;
- internal::GraphNode::Map new_graph;
+ internal::TaskGraph new_graph;
for (std::vector<Task>::const_iterator it = tasks.begin();
it != tasks.end();
++it) {
scoped_refptr<FakeTaskImpl> new_task(
new FakeTaskImpl(this, it->namespace_index, it->id));
- scoped_ptr<internal::GraphNode> node(
- new internal::GraphNode(new_task.get(), it->priority));
-
+ new_graph.nodes.push_back(
+ internal::TaskGraph::Node(new_task.get(), it->priority, 0u));
for (unsigned i = 0; i < it->dependent_count; ++i) {
scoped_refptr<FakeDependentTaskImpl> new_dependent_task(
new FakeDependentTaskImpl(
this, it->namespace_index, it->dependent_id));
- scoped_ptr<internal::GraphNode> dependent_node(
- new internal::GraphNode(new_dependent_task.get(), it->priority));
- node->add_dependent(dependent_node.get());
- dependent_node->add_dependency();
- new_graph.set(new_dependent_task.get(), dependent_node.Pass());
+ new_graph.nodes.push_back(internal::TaskGraph::Node(
+ new_dependent_task.get(), it->priority, 1u));
+ new_graph.edges.push_back(internal::TaskGraph::Edge(
+ new_task.get(), new_dependent_task.get()));
+
new_dependents.push_back(new_dependent_task.get());
}
- new_graph.set(new_task.get(), node.Pass());
new_tasks.push_back(new_task.get());
}
@@ -295,29 +293,16 @@ TEST_F(TaskGraphRunnerSingleThreadTest, Priority) {
for (int i = 0; i < kNamespaceCount; ++i) {
std::vector<Task> tasks;
- tasks.push_back(Task(i,
- 0u,
- 3u,
- 1u, // 1 dependent
- 1u)); // Priority 1
- tasks.push_back(Task(i,
- 1u,
- 4u,
- 2u, // 2 dependents
- 1u)); // Priority 1
- tasks.push_back(Task(i,
- 2u,
- 5u,
- 1u, // 1 dependent
- 0u)); // Priority 0
+ tasks.push_back(Task(i, 0u, 3u, 1u, 2u)); // Priority 2
vmpstr 2014/02/06 19:44:37 heh :) Can you put a brief comment above to just s
reveman 2014/02/06 20:51:52 Removed the test which is no longer useful.
+ tasks.push_back(Task(i, 1u, 4u, 1u, 1u)); // Priority 1
+ tasks.push_back(Task(i, 2u, 5u, 1u, 0u)); // Priority 0
ScheduleTasks(i, tasks);
}
for (int i = 0; i < kNamespaceCount; ++i) {
RunAllTasks(i);
- // Check if tasks ran in order of priority and that task with more
- // dependents ran first when priority is the same.
+ // Check if tasks ran in order of priority.
ASSERT_LE(3u, run_task_ids(i).size());
EXPECT_EQ(2u, run_task_ids(i)[0]);
EXPECT_EQ(5u, run_task_ids(i)[1]);
« cc/resources/task_graph_runner.cc ('K') | « cc/resources/task_graph_runner_perftest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698