| 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 16 matching lines...) Expand all Loading... |
| 27 public: | 27 public: |
| 28 PictureLayerTilingPerfTest() | 28 PictureLayerTilingPerfTest() |
| 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_ = |
| 38 shared_bitmap_manager_.get(), | 38 ResourceProvider::Create(output_surface_.get(), |
| 39 NULL, | 39 shared_bitmap_manager_.get(), NULL, NULL, 0, |
| 40 NULL, | 40 false, false, 1).Pass(); |
| 41 0, | |
| 42 false, | |
| 43 1).Pass(); | |
| 44 } | 41 } |
| 45 | 42 |
| 46 void SetUp() override { | 43 void SetUp() override { |
| 47 picture_layer_tiling_client_.SetTileSize(gfx::Size(256, 256)); | 44 picture_layer_tiling_client_.SetTileSize(gfx::Size(256, 256)); |
| 48 picture_layer_tiling_client_.set_max_tiles_for_interest_area(250); | 45 picture_layer_tiling_client_.set_max_tiles_for_interest_area(250); |
| 49 picture_layer_tiling_client_.set_tree(PENDING_TREE); | 46 picture_layer_tiling_client_.set_tree(PENDING_TREE); |
| 50 picture_layer_tiling_ = PictureLayerTiling::Create( | 47 picture_layer_tiling_ = PictureLayerTiling::Create( |
| 51 1, gfx::Size(256 * 50, 256 * 50), &picture_layer_tiling_client_); | 48 1, gfx::Size(256 * 50, 256 * 50), &picture_layer_tiling_client_); |
| 52 picture_layer_tiling_->CreateAllTilesForTesting(); | 49 picture_layer_tiling_->CreateAllTilesForTesting(); |
| 53 } | 50 } |
| 54 | 51 |
| 55 void TearDown() override { picture_layer_tiling_.reset(NULL); } | 52 void TearDown() override { picture_layer_tiling_.reset(NULL); } |
| 56 | 53 |
| 57 void RunInvalidateTest(const std::string& test_name, const Region& region) { | 54 void RunInvalidateTest(const std::string& test_name, const Region& region) { |
| 58 timer_.Reset(); | 55 timer_.Reset(); |
| 59 do { | 56 do { |
| 60 picture_layer_tiling_->UpdateTilesToCurrentRasterSource( | 57 picture_layer_tiling_->UpdateTilesToCurrentRasterSource( |
| 61 picture_layer_tiling_client_.raster_source(), region, | 58 picture_layer_tiling_client_.raster_source(), region, |
| 62 picture_layer_tiling_->tiling_size()); | 59 picture_layer_tiling_->tiling_size(), base::TimeTicks()); |
| 63 timer_.NextLap(); | 60 timer_.NextLap(); |
| 64 } while (!timer_.HasTimeLimitExpired()); | 61 } while (!timer_.HasTimeLimitExpired()); |
| 65 | 62 |
| 66 perf_test::PrintResult( | 63 perf_test::PrintResult( |
| 67 "invalidation", "", test_name, timer_.LapsPerSecond(), "runs/s", true); | 64 "invalidation", "", test_name, timer_.LapsPerSecond(), "runs/s", true); |
| 68 } | 65 } |
| 69 | 66 |
| 70 void RunComputeTilePriorityRectsStationaryTest( | 67 void RunComputeTilePriorityRectsStationaryTest( |
| 71 const std::string& test_name, | 68 const std::string& test_name, |
| 72 const gfx::Transform& transform) { | 69 const gfx::Transform& transform) { |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 "32_500x500", 32, gfx::Rect(0, 0, 500, 500)); | 234 "32_500x500", 32, gfx::Rect(0, 0, 500, 500)); |
| 238 RunRasterIteratorConstructAndIterateTest( | 235 RunRasterIteratorConstructAndIterateTest( |
| 239 "64_100x100", 64, gfx::Rect(0, 0, 100, 100)); | 236 "64_100x100", 64, gfx::Rect(0, 0, 100, 100)); |
| 240 RunRasterIteratorConstructAndIterateTest( | 237 RunRasterIteratorConstructAndIterateTest( |
| 241 "64_500x500", 64, gfx::Rect(0, 0, 500, 500)); | 238 "64_500x500", 64, gfx::Rect(0, 0, 500, 500)); |
| 242 } | 239 } |
| 243 | 240 |
| 244 } // namespace | 241 } // namespace |
| 245 | 242 |
| 246 } // namespace cc | 243 } // namespace cc |
| OLD | NEW |