OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/resources/raster_worker_pool.h" | 5 #include "cc/resources/raster_worker_pool.h" |
6 | 6 |
7 #include "base/time/time.h" | 7 #include "base/time/time.h" |
8 #include "cc/test/lap_timer.h" | 8 #include "cc/test/lap_timer.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 #include "testing/perf/perf_test.h" | 10 #include "testing/perf/perf_test.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 virtual void OnRasterTasksFinished() OVERRIDE { NOTREACHED(); } | 72 virtual void OnRasterTasksFinished() OVERRIDE { NOTREACHED(); } |
73 virtual void OnRasterTasksRequiredForActivationFinished() OVERRIDE { | 73 virtual void OnRasterTasksRequiredForActivationFinished() OVERRIDE { |
74 NOTREACHED(); | 74 NOTREACHED(); |
75 } | 75 } |
76 | 76 |
77 void SetRasterTasks(RasterTask::Queue* queue) { | 77 void SetRasterTasks(RasterTask::Queue* queue) { |
78 RasterWorkerPool::SetRasterTasks(queue); | 78 RasterWorkerPool::SetRasterTasks(queue); |
79 } | 79 } |
80 | 80 |
81 void BuildTaskGraph() { | 81 void BuildTaskGraph() { |
82 unsigned priority = 0; | 82 unsigned priority = 2u; |
83 TaskGraph graph; | 83 internal::TaskGraph graph; |
84 | 84 |
85 scoped_refptr<internal::WorkerPoolTask> | 85 scoped_refptr<internal::WorkerPoolTask> |
86 raster_required_for_activation_finished_task( | 86 raster_required_for_activation_finished_task( |
87 CreateRasterRequiredForActivationFinishedTask( | 87 CreateRasterRequiredForActivationFinishedTask( |
88 raster_tasks_required_for_activation().size())); | 88 raster_tasks_required_for_activation().size())); |
89 internal::GraphNode* raster_required_for_activation_finished_node = | |
90 CreateGraphNodeForTask( | |
91 raster_required_for_activation_finished_task.get(), | |
92 priority++, | |
93 &graph); | |
94 | |
95 scoped_refptr<internal::WorkerPoolTask> raster_finished_task( | 89 scoped_refptr<internal::WorkerPoolTask> raster_finished_task( |
96 CreateRasterFinishedTask()); | 90 CreateRasterFinishedTask()); |
97 internal::GraphNode* raster_finished_node = | 91 |
98 CreateGraphNodeForTask(raster_finished_task.get(), priority++, &graph); | 92 size_t raster_required_for_activation_finished_dependencies = 0u; |
| 93 size_t raster_finished_dependencies = 0u; |
99 | 94 |
100 for (RasterTaskVector::const_iterator it = raster_tasks().begin(); | 95 for (RasterTaskVector::const_iterator it = raster_tasks().begin(); |
101 it != raster_tasks().end(); | 96 it != raster_tasks().end(); |
102 ++it) { | 97 ++it) { |
103 internal::RasterWorkerPoolTask* task = it->get(); | 98 internal::RasterWorkerPoolTask* task = it->get(); |
104 | 99 |
105 internal::GraphNode* node = CreateGraphNodeForRasterTask( | |
106 task, task->dependencies(), priority++, &graph); | |
107 | |
108 if (IsRasterTaskRequiredForActivation(task)) { | 100 if (IsRasterTaskRequiredForActivation(task)) { |
109 raster_required_for_activation_finished_node->add_dependency(); | 101 raster_required_for_activation_finished_dependencies++; |
110 node->add_dependent(raster_required_for_activation_finished_node); | 102 graph.edges.push_back(internal::TaskGraph::Edge( |
| 103 task, raster_required_for_activation_finished_task.get())); |
111 } | 104 } |
112 | 105 |
113 raster_finished_node->add_dependency(); | 106 InsertNodeForRasterTask(&graph, task, task->dependencies(), priority++); |
114 node->add_dependent(raster_finished_node); | 107 |
| 108 raster_finished_dependencies++; |
| 109 graph.edges.push_back( |
| 110 internal::TaskGraph::Edge(task, raster_finished_task.get())); |
115 } | 111 } |
| 112 |
| 113 InsertNodeForTask(&graph, |
| 114 raster_required_for_activation_finished_task.get(), |
| 115 0u, |
| 116 raster_required_for_activation_finished_dependencies); |
| 117 InsertNodeForTask( |
| 118 &graph, raster_finished_task.get(), 1u, raster_finished_dependencies); |
116 } | 119 } |
117 | 120 |
118 private: | 121 private: |
119 DISALLOW_COPY_AND_ASSIGN(PerfRasterWorkerPool); | 122 DISALLOW_COPY_AND_ASSIGN(PerfRasterWorkerPool); |
120 }; | 123 }; |
121 | 124 |
122 class RasterWorkerPoolPerfTest : public testing::Test { | 125 class RasterWorkerPoolPerfTest : public testing::Test { |
123 public: | 126 public: |
124 RasterWorkerPoolPerfTest() | 127 RasterWorkerPoolPerfTest() |
125 : timer_(kWarmupRuns, | 128 : timer_(kWarmupRuns, |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 RunBuildTaskGraphTest("10_4", 10, 4); | 214 RunBuildTaskGraphTest("10_4", 10, 4); |
212 RunBuildTaskGraphTest("100_4", 100, 4); | 215 RunBuildTaskGraphTest("100_4", 100, 4); |
213 RunBuildTaskGraphTest("1000_4", 1000, 4); | 216 RunBuildTaskGraphTest("1000_4", 1000, 4); |
214 RunBuildTaskGraphTest("10_16", 10, 16); | 217 RunBuildTaskGraphTest("10_16", 10, 16); |
215 RunBuildTaskGraphTest("100_16", 100, 16); | 218 RunBuildTaskGraphTest("100_16", 100, 16); |
216 RunBuildTaskGraphTest("1000_16", 1000, 16); | 219 RunBuildTaskGraphTest("1000_16", 1000, 16); |
217 } | 220 } |
218 | 221 |
219 } // namespace | 222 } // namespace |
220 } // namespace cc | 223 } // namespace cc |
OLD | NEW |