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/debug/lap_timer.h" | 5 #include "cc/debug/lap_timer.h" |
6 #include "cc/resources/picture_layer_tiling.h" | 6 #include "cc/resources/picture_layer_tiling.h" |
7 #include "cc/resources/resource_provider.h" | 7 #include "cc/resources/resource_provider.h" |
8 #include "cc/resources/scoped_resource.h" | 8 #include "cc/resources/scoped_resource.h" |
9 #include "cc/test/fake_output_surface.h" | 9 #include "cc/test/fake_output_surface.h" |
10 #include "cc/test/fake_output_surface_client.h" | 10 #include "cc/test/fake_output_surface_client.h" |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES, | 221 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES, |
222 SMOOTHNESS_TAKES_PRIORITY, | 222 SMOOTHNESS_TAKES_PRIORITY, |
223 NEW_CONTENT_TAKES_PRIORITY}; | 223 NEW_CONTENT_TAKES_PRIORITY}; |
224 | 224 |
225 // Ensure all tiles have resources. | 225 // Ensure all tiles have resources. |
226 std::vector<Tile*> all_tiles = picture_layer_tiling_->AllTilesForTesting(); | 226 std::vector<Tile*> all_tiles = picture_layer_tiling_->AllTilesForTesting(); |
227 for (std::vector<Tile*>::iterator tile_it = all_tiles.begin(); | 227 for (std::vector<Tile*>::iterator tile_it = all_tiles.begin(); |
228 tile_it != all_tiles.end(); | 228 tile_it != all_tiles.end(); |
229 ++tile_it) { | 229 ++tile_it) { |
230 Tile* tile = *tile_it; | 230 Tile* tile = *tile_it; |
231 ManagedTileState::TileVersion& tile_version = | 231 ManagedTileState::DrawInfo& draw_info = tile->draw_info(); |
232 tile->GetTileVersionForTesting(tile->GetRasterModeForTesting()); | 232 draw_info.SetResourceForTesting( |
233 tile_version.SetResourceForTesting( | |
234 ScopedResource::Create(resource_provider_.get()).Pass()); | 233 ScopedResource::Create(resource_provider_.get()).Pass()); |
235 } | 234 } |
236 | 235 |
237 int priority_count = 0; | 236 int priority_count = 0; |
238 timer_.Reset(); | 237 timer_.Reset(); |
239 do { | 238 do { |
240 int count = num_tiles; | 239 int count = num_tiles; |
241 PictureLayerTiling::TilingEvictionTileIterator it( | 240 PictureLayerTiling::TilingEvictionTileIterator it( |
242 picture_layer_tiling_.get(), | 241 picture_layer_tiling_.get(), |
243 priorities[priority_count], | 242 priorities[priority_count], |
244 PictureLayerTiling::EVENTUALLY); | 243 PictureLayerTiling::EVENTUALLY); |
245 while (count--) { | 244 while (count--) { |
246 ASSERT_TRUE(it) << "count: " << count; | 245 ASSERT_TRUE(it) << "count: " << count; |
247 ASSERT_TRUE(*it != NULL) << "count: " << count; | 246 ASSERT_TRUE(*it != NULL) << "count: " << count; |
248 ++it; | 247 ++it; |
249 } | 248 } |
250 priority_count = (priority_count + 1) % arraysize(priorities); | 249 priority_count = (priority_count + 1) % arraysize(priorities); |
251 timer_.NextLap(); | 250 timer_.NextLap(); |
252 } while (!timer_.HasTimeLimitExpired()); | 251 } while (!timer_.HasTimeLimitExpired()); |
253 | 252 |
254 // Remove all resources from tiles to make sure the tile version destructor | 253 // Remove all resources from tiles to make sure the tile version destructor |
255 // doesn't complain. | 254 // doesn't complain. |
256 for (std::vector<Tile*>::iterator tile_it = all_tiles.begin(); | 255 for (std::vector<Tile*>::iterator tile_it = all_tiles.begin(); |
257 tile_it != all_tiles.end(); | 256 tile_it != all_tiles.end(); |
258 ++tile_it) { | 257 ++tile_it) { |
259 Tile* tile = *tile_it; | 258 Tile* tile = *tile_it; |
260 ManagedTileState::TileVersion& tile_version = | 259 ManagedTileState::DrawInfo& draw_info = tile->draw_info(); |
261 tile->GetTileVersionForTesting(tile->GetRasterModeForTesting()); | 260 draw_info.SetResourceForTesting(scoped_ptr<ScopedResource>()); |
262 tile_version.SetResourceForTesting(scoped_ptr<ScopedResource>()); | |
263 } | 261 } |
264 | 262 |
265 perf_test::PrintResult( | 263 perf_test::PrintResult( |
266 "tiling_eviction_tile_iterator_construct_and_iterate", | 264 "tiling_eviction_tile_iterator_construct_and_iterate", |
267 "", | 265 "", |
268 test_name, | 266 test_name, |
269 timer_.LapsPerSecond(), | 267 timer_.LapsPerSecond(), |
270 "runs/s", | 268 "runs/s", |
271 true); | 269 true); |
272 } | 270 } |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 "32_500x500", 32, gfx::Rect(0, 0, 500, 500)); | 349 "32_500x500", 32, gfx::Rect(0, 0, 500, 500)); |
352 RunEvictionIteratorConstructAndIterateTest( | 350 RunEvictionIteratorConstructAndIterateTest( |
353 "64_100x100", 64, gfx::Rect(0, 0, 100, 100)); | 351 "64_100x100", 64, gfx::Rect(0, 0, 100, 100)); |
354 RunEvictionIteratorConstructAndIterateTest( | 352 RunEvictionIteratorConstructAndIterateTest( |
355 "64_500x500", 64, gfx::Rect(0, 0, 500, 500)); | 353 "64_500x500", 64, gfx::Rect(0, 0, 500, 500)); |
356 } | 354 } |
357 | 355 |
358 } // namespace | 356 } // namespace |
359 | 357 |
360 } // namespace cc | 358 } // namespace cc |
OLD | NEW |