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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 RasterTask* task = it->get(); | 57 RasterTask* task = it->get(); |
58 | 58 |
59 task->WillComplete(); | 59 task->WillComplete(); |
60 task->CompleteOnOriginThread(this); | 60 task->CompleteOnOriginThread(this); |
61 task->DidComplete(); | 61 task->DidComplete(); |
62 | 62 |
63 task->RunReplyOnOriginThread(); | 63 task->RunReplyOnOriginThread(); |
64 } | 64 } |
65 completed_tasks_.clear(); | 65 completed_tasks_.clear(); |
66 } | 66 } |
| 67 ResourceFormat GetResourceFormat() override { |
| 68 return RGBA_8888; |
| 69 } |
67 | 70 |
68 // Overridden from TileTaskClient: | 71 // Overridden from TileTaskClient: |
69 scoped_ptr<RasterBuffer> AcquireBufferForRaster( | 72 scoped_ptr<RasterBuffer> AcquireBufferForRaster( |
70 const Resource* resource) override { | 73 const Resource* resource) override { |
71 return nullptr; | 74 return nullptr; |
72 } | 75 } |
73 void ReleaseBufferForRaster(scoped_ptr<RasterBuffer> buffer) override {} | 76 void ReleaseBufferForRaster(scoped_ptr<RasterBuffer> buffer) override {} |
74 | 77 |
75 private: | 78 private: |
76 RasterTask::Vector completed_tasks_; | 79 RasterTask::Vector completed_tasks_; |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 NEW_CONTENT_TAKES_PRIORITY}; | 176 NEW_CONTENT_TAKES_PRIORITY}; |
174 int priority_count = 0; | 177 int priority_count = 0; |
175 | 178 |
176 std::vector<FakePictureLayerImpl*> layers = CreateLayers(layer_count, 10); | 179 std::vector<FakePictureLayerImpl*> layers = CreateLayers(layer_count, 10); |
177 bool resourceless_software_draw = false; | 180 bool resourceless_software_draw = false; |
178 for (const auto& layer : layers) | 181 for (const auto& layer : layers) |
179 layer->UpdateTiles(Occlusion(), resourceless_software_draw); | 182 layer->UpdateTiles(Occlusion(), resourceless_software_draw); |
180 | 183 |
181 timer_.Reset(); | 184 timer_.Reset(); |
182 do { | 185 do { |
183 RasterTilePriorityQueue queue; | 186 scoped_ptr<RasterTilePriorityQueue> queue(host_impl_.BuildRasterQueue( |
184 host_impl_.BuildRasterQueue(&queue, priorities[priority_count], | 187 priorities[priority_count], RasterTilePriorityQueue::Type::ALL)); |
185 RasterTilePriorityQueue::Type::ALL); | |
186 priority_count = (priority_count + 1) % arraysize(priorities); | 188 priority_count = (priority_count + 1) % arraysize(priorities); |
187 timer_.NextLap(); | 189 timer_.NextLap(); |
188 } while (!timer_.HasTimeLimitExpired()); | 190 } while (!timer_.HasTimeLimitExpired()); |
189 | 191 |
190 perf_test::PrintResult("tile_manager_raster_tile_queue_construct", | 192 perf_test::PrintResult("tile_manager_raster_tile_queue_construct", |
191 "", | 193 "", |
192 test_name, | 194 test_name, |
193 timer_.LapsPerSecond(), | 195 timer_.LapsPerSecond(), |
194 "runs/s", | 196 "runs/s", |
195 true); | 197 true); |
196 } | 198 } |
197 | 199 |
198 void RunRasterQueueConstructAndIterateTest(const std::string& test_name, | 200 void RunRasterQueueConstructAndIterateTest(const std::string& test_name, |
199 int layer_count, | 201 int layer_count, |
200 int tile_count) { | 202 int tile_count) { |
201 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES, | 203 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES, |
202 SMOOTHNESS_TAKES_PRIORITY, | 204 SMOOTHNESS_TAKES_PRIORITY, |
203 NEW_CONTENT_TAKES_PRIORITY}; | 205 NEW_CONTENT_TAKES_PRIORITY}; |
204 | 206 |
205 std::vector<FakePictureLayerImpl*> layers = CreateLayers(layer_count, 100); | 207 std::vector<FakePictureLayerImpl*> layers = CreateLayers(layer_count, 100); |
206 bool resourceless_software_draw = false; | 208 bool resourceless_software_draw = false; |
207 for (const auto& layer : layers) | 209 for (const auto& layer : layers) |
208 layer->UpdateTiles(Occlusion(), resourceless_software_draw); | 210 layer->UpdateTiles(Occlusion(), resourceless_software_draw); |
209 | 211 |
210 int priority_count = 0; | 212 int priority_count = 0; |
211 timer_.Reset(); | 213 timer_.Reset(); |
212 do { | 214 do { |
213 int count = tile_count; | 215 int count = tile_count; |
214 RasterTilePriorityQueue queue; | 216 scoped_ptr<RasterTilePriorityQueue> queue(host_impl_.BuildRasterQueue( |
215 host_impl_.BuildRasterQueue(&queue, priorities[priority_count], | 217 priorities[priority_count], RasterTilePriorityQueue::Type::ALL)); |
216 RasterTilePriorityQueue::Type::ALL); | |
217 while (count--) { | 218 while (count--) { |
218 ASSERT_FALSE(queue.IsEmpty()); | 219 ASSERT_FALSE(queue->IsEmpty()); |
219 ASSERT_TRUE(queue.Top() != NULL); | 220 ASSERT_TRUE(queue->Top() != NULL); |
220 queue.Pop(); | 221 queue->Pop(); |
221 } | 222 } |
222 priority_count = (priority_count + 1) % arraysize(priorities); | 223 priority_count = (priority_count + 1) % arraysize(priorities); |
223 timer_.NextLap(); | 224 timer_.NextLap(); |
224 } while (!timer_.HasTimeLimitExpired()); | 225 } while (!timer_.HasTimeLimitExpired()); |
225 | 226 |
226 perf_test::PrintResult( | 227 perf_test::PrintResult( |
227 "tile_manager_raster_tile_queue_construct_and_iterate", | 228 "tile_manager_raster_tile_queue_construct_and_iterate", |
228 "", | 229 "", |
229 test_name, | 230 test_name, |
230 timer_.LapsPerSecond(), | 231 timer_.LapsPerSecond(), |
(...skipping 13 matching lines...) Expand all Loading... |
244 for (const auto& layer : layers) { | 245 for (const auto& layer : layers) { |
245 layer->UpdateTiles(Occlusion(), resourceless_software_draw); | 246 layer->UpdateTiles(Occlusion(), resourceless_software_draw); |
246 for (size_t i = 0; i < layer->num_tilings(); ++i) { | 247 for (size_t i = 0; i < layer->num_tilings(); ++i) { |
247 tile_manager()->InitializeTilesWithResourcesForTesting( | 248 tile_manager()->InitializeTilesWithResourcesForTesting( |
248 layer->tilings()->tiling_at(i)->AllTilesForTesting()); | 249 layer->tilings()->tiling_at(i)->AllTilesForTesting()); |
249 } | 250 } |
250 } | 251 } |
251 | 252 |
252 timer_.Reset(); | 253 timer_.Reset(); |
253 do { | 254 do { |
254 EvictionTilePriorityQueue queue; | 255 scoped_ptr<EvictionTilePriorityQueue> queue( |
255 host_impl_.BuildEvictionQueue(&queue, priorities[priority_count]); | 256 host_impl_.BuildEvictionQueue(priorities[priority_count])); |
256 priority_count = (priority_count + 1) % arraysize(priorities); | 257 priority_count = (priority_count + 1) % arraysize(priorities); |
257 timer_.NextLap(); | 258 timer_.NextLap(); |
258 } while (!timer_.HasTimeLimitExpired()); | 259 } while (!timer_.HasTimeLimitExpired()); |
259 | 260 |
260 perf_test::PrintResult("tile_manager_eviction_tile_queue_construct", | 261 perf_test::PrintResult("tile_manager_eviction_tile_queue_construct", |
261 "", | 262 "", |
262 test_name, | 263 test_name, |
263 timer_.LapsPerSecond(), | 264 timer_.LapsPerSecond(), |
264 "runs/s", | 265 "runs/s", |
265 true); | 266 true); |
(...skipping 14 matching lines...) Expand all Loading... |
280 layer->UpdateTiles(Occlusion(), resourceless_software_draw); | 281 layer->UpdateTiles(Occlusion(), resourceless_software_draw); |
281 for (size_t i = 0; i < layer->num_tilings(); ++i) { | 282 for (size_t i = 0; i < layer->num_tilings(); ++i) { |
282 tile_manager()->InitializeTilesWithResourcesForTesting( | 283 tile_manager()->InitializeTilesWithResourcesForTesting( |
283 layer->tilings()->tiling_at(i)->AllTilesForTesting()); | 284 layer->tilings()->tiling_at(i)->AllTilesForTesting()); |
284 } | 285 } |
285 } | 286 } |
286 | 287 |
287 timer_.Reset(); | 288 timer_.Reset(); |
288 do { | 289 do { |
289 int count = tile_count; | 290 int count = tile_count; |
290 EvictionTilePriorityQueue queue; | 291 scoped_ptr<EvictionTilePriorityQueue> queue( |
291 host_impl_.BuildEvictionQueue(&queue, priorities[priority_count]); | 292 host_impl_.BuildEvictionQueue(priorities[priority_count])); |
292 while (count--) { | 293 while (count--) { |
293 ASSERT_FALSE(queue.IsEmpty()); | 294 ASSERT_FALSE(queue->IsEmpty()); |
294 ASSERT_TRUE(queue.Top() != NULL); | 295 ASSERT_TRUE(queue->Top() != NULL); |
295 queue.Pop(); | 296 queue->Pop(); |
296 } | 297 } |
297 priority_count = (priority_count + 1) % arraysize(priorities); | 298 priority_count = (priority_count + 1) % arraysize(priorities); |
298 timer_.NextLap(); | 299 timer_.NextLap(); |
299 } while (!timer_.HasTimeLimitExpired()); | 300 } while (!timer_.HasTimeLimitExpired()); |
300 | 301 |
301 perf_test::PrintResult( | 302 perf_test::PrintResult( |
302 "tile_manager_eviction_tile_queue_construct_and_iterate", | 303 "tile_manager_eviction_tile_queue_construct_and_iterate", |
303 "", | 304 "", |
304 test_name, | 305 test_name, |
305 timer_.LapsPerSecond(), | 306 timer_.LapsPerSecond(), |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 RunEvictionQueueConstructAndIterateTest("10_64", 10, 64); | 470 RunEvictionQueueConstructAndIterateTest("10_64", 10, 64); |
470 RunEvictionQueueConstructAndIterateTest("10_128", 10, 128); | 471 RunEvictionQueueConstructAndIterateTest("10_128", 10, 128); |
471 RunEvictionQueueConstructAndIterateTest("50_16", 50, 16); | 472 RunEvictionQueueConstructAndIterateTest("50_16", 50, 16); |
472 RunEvictionQueueConstructAndIterateTest("50_32", 50, 32); | 473 RunEvictionQueueConstructAndIterateTest("50_32", 50, 32); |
473 RunEvictionQueueConstructAndIterateTest("50_64", 50, 64); | 474 RunEvictionQueueConstructAndIterateTest("50_64", 50, 64); |
474 RunEvictionQueueConstructAndIterateTest("50_128", 50, 128); | 475 RunEvictionQueueConstructAndIterateTest("50_128", 50, 128); |
475 } | 476 } |
476 | 477 |
477 } // namespace | 478 } // namespace |
478 } // namespace cc | 479 } // namespace cc |
OLD | NEW |