| 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 18 matching lines...) Expand all Loading... |
| 29 : timer_(kWarmupRuns, | 29 : timer_(kWarmupRuns, |
| 30 base::TimeDelta::FromMilliseconds(kTimeLimitMillis), | 30 base::TimeDelta::FromMilliseconds(kTimeLimitMillis), |
| 31 kTimeCheckInterval), | 31 kTimeCheckInterval), |
| 32 context_provider_(TestContextProvider::Create()) { | 32 context_provider_(TestContextProvider::Create()) { |
| 33 output_surface_ = FakeOutputSurface::Create3d(context_provider_).Pass(); | 33 output_surface_ = FakeOutputSurface::Create3d(context_provider_).Pass(); |
| 34 CHECK(output_surface_->BindToClient(&output_surface_client_)); | 34 CHECK(output_surface_->BindToClient(&output_surface_client_)); |
| 35 | 35 |
| 36 shared_bitmap_manager_.reset(new TestSharedBitmapManager()); | 36 shared_bitmap_manager_.reset(new TestSharedBitmapManager()); |
| 37 resource_provider_ = ResourceProvider::Create(output_surface_.get(), | 37 resource_provider_ = ResourceProvider::Create(output_surface_.get(), |
| 38 shared_bitmap_manager_.get(), | 38 shared_bitmap_manager_.get(), |
| 39 NULL, | 39 nullptr, |
| 40 0, | 40 0, |
| 41 false, | 41 false, |
| 42 1, | 42 1, |
| 43 false).Pass(); | 43 false).Pass(); |
| 44 } | 44 } |
| 45 | 45 |
| 46 virtual void SetUp() override { | 46 virtual void SetUp() override { |
| 47 picture_layer_tiling_client_.SetTileSize(gfx::Size(256, 256)); | 47 picture_layer_tiling_client_.SetTileSize(gfx::Size(256, 256)); |
| 48 picture_layer_tiling_client_.set_max_tiles_for_interest_area(250); | 48 picture_layer_tiling_client_.set_max_tiles_for_interest_area(250); |
| 49 picture_layer_tiling_client_.set_tree(PENDING_TREE); | 49 picture_layer_tiling_client_.set_tree(PENDING_TREE); |
| 50 picture_layer_tiling_ = PictureLayerTiling::Create( | 50 picture_layer_tiling_ = PictureLayerTiling::Create( |
| 51 1, gfx::Size(256 * 50, 256 * 50), &picture_layer_tiling_client_); | 51 1, gfx::Size(256 * 50, 256 * 50), &picture_layer_tiling_client_); |
| 52 picture_layer_tiling_->CreateAllTilesForTesting(); | 52 picture_layer_tiling_->CreateAllTilesForTesting(); |
| 53 } | 53 } |
| 54 | 54 |
| 55 virtual void TearDown() override { | 55 virtual void TearDown() override { picture_layer_tiling_.reset(nullptr); } |
| 56 picture_layer_tiling_.reset(NULL); | |
| 57 } | |
| 58 | 56 |
| 59 void RunInvalidateTest(const std::string& test_name, const Region& region) { | 57 void RunInvalidateTest(const std::string& test_name, const Region& region) { |
| 60 timer_.Reset(); | 58 timer_.Reset(); |
| 61 do { | 59 do { |
| 62 picture_layer_tiling_->UpdateTilesToCurrentPile( | 60 picture_layer_tiling_->UpdateTilesToCurrentPile( |
| 63 region, picture_layer_tiling_->tiling_size()); | 61 region, picture_layer_tiling_->tiling_size()); |
| 64 timer_.NextLap(); | 62 timer_.NextLap(); |
| 65 } while (!timer_.HasTimeLimitExpired()); | 63 } while (!timer_.HasTimeLimitExpired()); |
| 66 | 64 |
| 67 perf_test::PrintResult( | 65 perf_test::PrintResult( |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 picture_layer_tiling_->ComputeTilePriorityRects( | 156 picture_layer_tiling_->ComputeTilePriorityRects( |
| 159 ACTIVE_TREE, viewport, 1.0f, 1.0, Occlusion()); | 157 ACTIVE_TREE, viewport, 1.0f, 1.0, Occlusion()); |
| 160 | 158 |
| 161 timer_.Reset(); | 159 timer_.Reset(); |
| 162 do { | 160 do { |
| 163 int count = num_tiles; | 161 int count = num_tiles; |
| 164 PictureLayerTiling::TilingRasterTileIterator it( | 162 PictureLayerTiling::TilingRasterTileIterator it( |
| 165 picture_layer_tiling_.get()); | 163 picture_layer_tiling_.get()); |
| 166 while (count--) { | 164 while (count--) { |
| 167 ASSERT_TRUE(it) << "count: " << count; | 165 ASSERT_TRUE(it) << "count: " << count; |
| 168 ASSERT_TRUE(*it != NULL) << "count: " << count; | 166 ASSERT_TRUE(*it != nullptr) << "count: " << count; |
| 169 ++it; | 167 ++it; |
| 170 } | 168 } |
| 171 timer_.NextLap(); | 169 timer_.NextLap(); |
| 172 } while (!timer_.HasTimeLimitExpired()); | 170 } while (!timer_.HasTimeLimitExpired()); |
| 173 | 171 |
| 174 perf_test::PrintResult("tiling_raster_tile_iterator_construct_and_iterate", | 172 perf_test::PrintResult("tiling_raster_tile_iterator_construct_and_iterate", |
| 175 "", | 173 "", |
| 176 test_name, | 174 test_name, |
| 177 timer_.LapsPerSecond(), | 175 timer_.LapsPerSecond(), |
| 178 "runs/s", | 176 "runs/s", |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 int priority_count = 0; | 236 int priority_count = 0; |
| 239 timer_.Reset(); | 237 timer_.Reset(); |
| 240 do { | 238 do { |
| 241 int count = num_tiles; | 239 int count = num_tiles; |
| 242 PictureLayerTiling::TilingEvictionTileIterator it( | 240 PictureLayerTiling::TilingEvictionTileIterator it( |
| 243 picture_layer_tiling_.get(), | 241 picture_layer_tiling_.get(), |
| 244 priorities[priority_count], | 242 priorities[priority_count], |
| 245 PictureLayerTiling::EVENTUALLY); | 243 PictureLayerTiling::EVENTUALLY); |
| 246 while (count--) { | 244 while (count--) { |
| 247 ASSERT_TRUE(it) << "count: " << count; | 245 ASSERT_TRUE(it) << "count: " << count; |
| 248 ASSERT_TRUE(*it != NULL) << "count: " << count; | 246 ASSERT_TRUE(*it != nullptr) << "count: " << count; |
| 249 ++it; | 247 ++it; |
| 250 } | 248 } |
| 251 priority_count = (priority_count + 1) % arraysize(priorities); | 249 priority_count = (priority_count + 1) % arraysize(priorities); |
| 252 timer_.NextLap(); | 250 timer_.NextLap(); |
| 253 } while (!timer_.HasTimeLimitExpired()); | 251 } while (!timer_.HasTimeLimitExpired()); |
| 254 | 252 |
| 255 // 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 |
| 256 // doesn't complain. | 254 // doesn't complain. |
| 257 for (std::vector<Tile*>::iterator tile_it = all_tiles.begin(); | 255 for (std::vector<Tile*>::iterator tile_it = all_tiles.begin(); |
| 258 tile_it != all_tiles.end(); | 256 tile_it != all_tiles.end(); |
| (...skipping 92 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 |