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 "base/time/time.h" | 5 #include "base/time/time.h" |
6 #include "cc/debug/lap_timer.h" | 6 #include "cc/debug/lap_timer.h" |
7 #include "cc/resources/raster_buffer.h" | 7 #include "cc/resources/raster_buffer.h" |
8 #include "cc/resources/tile.h" | 8 #include "cc/resources/tile.h" |
9 #include "cc/resources/tile_priority.h" | 9 #include "cc/resources/tile_priority.h" |
10 #include "cc/test/begin_frame_args_test.h" | 10 #include "cc/test/begin_frame_args_test.h" |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 NEW_CONTENT_TAKES_PRIORITY}; | 173 NEW_CONTENT_TAKES_PRIORITY}; |
174 int priority_count = 0; | 174 int priority_count = 0; |
175 | 175 |
176 std::vector<FakePictureLayerImpl*> layers = CreateLayers(layer_count, 10); | 176 std::vector<FakePictureLayerImpl*> layers = CreateLayers(layer_count, 10); |
177 bool resourceless_software_draw = false; | 177 bool resourceless_software_draw = false; |
178 for (const auto& layer : layers) | 178 for (const auto& layer : layers) |
179 layer->UpdateTiles(Occlusion(), resourceless_software_draw); | 179 layer->UpdateTiles(Occlusion(), resourceless_software_draw); |
180 | 180 |
181 timer_.Reset(); | 181 timer_.Reset(); |
182 do { | 182 do { |
183 RasterTilePriorityQueue queue; | 183 scoped_ptr<RasterTilePriorityQueue> queue(host_impl_.BuildRasterQueue( |
184 host_impl_.BuildRasterQueue(&queue, priorities[priority_count], | 184 priorities[priority_count], RasterTilePriorityQueue::Type::ALL)); |
185 RasterTilePriorityQueue::Type::ALL); | |
186 priority_count = (priority_count + 1) % arraysize(priorities); | 185 priority_count = (priority_count + 1) % arraysize(priorities); |
187 timer_.NextLap(); | 186 timer_.NextLap(); |
188 } while (!timer_.HasTimeLimitExpired()); | 187 } while (!timer_.HasTimeLimitExpired()); |
189 | 188 |
190 perf_test::PrintResult("tile_manager_raster_tile_queue_construct", | 189 perf_test::PrintResult("tile_manager_raster_tile_queue_construct", |
191 "", | 190 "", |
192 test_name, | 191 test_name, |
193 timer_.LapsPerSecond(), | 192 timer_.LapsPerSecond(), |
194 "runs/s", | 193 "runs/s", |
195 true); | 194 true); |
196 } | 195 } |
197 | 196 |
198 void RunRasterQueueConstructAndIterateTest(const std::string& test_name, | 197 void RunRasterQueueConstructAndIterateTest(const std::string& test_name, |
199 int layer_count, | 198 int layer_count, |
200 int tile_count) { | 199 int tile_count) { |
201 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES, | 200 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES, |
202 SMOOTHNESS_TAKES_PRIORITY, | 201 SMOOTHNESS_TAKES_PRIORITY, |
203 NEW_CONTENT_TAKES_PRIORITY}; | 202 NEW_CONTENT_TAKES_PRIORITY}; |
204 | 203 |
205 std::vector<FakePictureLayerImpl*> layers = CreateLayers(layer_count, 100); | 204 std::vector<FakePictureLayerImpl*> layers = CreateLayers(layer_count, 100); |
206 bool resourceless_software_draw = false; | 205 bool resourceless_software_draw = false; |
207 for (const auto& layer : layers) | 206 for (const auto& layer : layers) |
208 layer->UpdateTiles(Occlusion(), resourceless_software_draw); | 207 layer->UpdateTiles(Occlusion(), resourceless_software_draw); |
209 | 208 |
210 int priority_count = 0; | 209 int priority_count = 0; |
211 timer_.Reset(); | 210 timer_.Reset(); |
212 do { | 211 do { |
213 int count = tile_count; | 212 int count = tile_count; |
214 RasterTilePriorityQueue queue; | 213 scoped_ptr<RasterTilePriorityQueue> queue(host_impl_.BuildRasterQueue( |
215 host_impl_.BuildRasterQueue(&queue, priorities[priority_count], | 214 priorities[priority_count], RasterTilePriorityQueue::Type::ALL)); |
216 RasterTilePriorityQueue::Type::ALL); | |
217 while (count--) { | 215 while (count--) { |
218 ASSERT_FALSE(queue.IsEmpty()); | 216 ASSERT_FALSE(queue->IsEmpty()); |
219 ASSERT_TRUE(queue.Top() != NULL); | 217 ASSERT_TRUE(queue->Top() != NULL); |
220 queue.Pop(); | 218 queue->Pop(); |
221 } | 219 } |
222 priority_count = (priority_count + 1) % arraysize(priorities); | 220 priority_count = (priority_count + 1) % arraysize(priorities); |
223 timer_.NextLap(); | 221 timer_.NextLap(); |
224 } while (!timer_.HasTimeLimitExpired()); | 222 } while (!timer_.HasTimeLimitExpired()); |
225 | 223 |
226 perf_test::PrintResult( | 224 perf_test::PrintResult( |
227 "tile_manager_raster_tile_queue_construct_and_iterate", | 225 "tile_manager_raster_tile_queue_construct_and_iterate", |
228 "", | 226 "", |
229 test_name, | 227 test_name, |
230 timer_.LapsPerSecond(), | 228 timer_.LapsPerSecond(), |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 RunEvictionQueueConstructAndIterateTest("10_64", 10, 64); | 467 RunEvictionQueueConstructAndIterateTest("10_64", 10, 64); |
470 RunEvictionQueueConstructAndIterateTest("10_128", 10, 128); | 468 RunEvictionQueueConstructAndIterateTest("10_128", 10, 128); |
471 RunEvictionQueueConstructAndIterateTest("50_16", 50, 16); | 469 RunEvictionQueueConstructAndIterateTest("50_16", 50, 16); |
472 RunEvictionQueueConstructAndIterateTest("50_32", 50, 32); | 470 RunEvictionQueueConstructAndIterateTest("50_32", 50, 32); |
473 RunEvictionQueueConstructAndIterateTest("50_64", 50, 64); | 471 RunEvictionQueueConstructAndIterateTest("50_64", 50, 64); |
474 RunEvictionQueueConstructAndIterateTest("50_128", 50, 128); | 472 RunEvictionQueueConstructAndIterateTest("50_128", 50, 128); |
475 } | 473 } |
476 | 474 |
477 } // namespace | 475 } // namespace |
478 } // namespace cc | 476 } // namespace cc |
OLD | NEW |