| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/layers/picture_layer_impl.h" | 5 #include "cc/layers/picture_layer_impl.h" |
| 6 | 6 |
| 7 #include "base/thread_task_runner_handle.h" | 7 #include "base/thread_task_runner_handle.h" |
| 8 #include "cc/debug/lap_timer.h" | 8 #include "cc/debug/lap_timer.h" |
| 9 #include "cc/test/fake_impl_proxy.h" | 9 #include "cc/test/fake_impl_proxy.h" |
| 10 #include "cc/test/fake_layer_tree_host_impl.h" | 10 #include "cc/test/fake_layer_tree_host_impl.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 tiling->CreateAllTilesForTesting(); | 34 tiling->CreateAllTilesForTesting(); |
| 35 std::vector<Tile*> tiling_tiles = tiling->AllTilesForTesting(); | 35 std::vector<Tile*> tiling_tiles = tiling->AllTilesForTesting(); |
| 36 std::copy( | 36 std::copy( |
| 37 tiling_tiles.begin(), tiling_tiles.end(), std::back_inserter(*all_tiles)); | 37 tiling_tiles.begin(), tiling_tiles.end(), std::back_inserter(*all_tiles)); |
| 38 } | 38 } |
| 39 | 39 |
| 40 class PictureLayerImplPerfTest : public testing::Test { | 40 class PictureLayerImplPerfTest : public testing::Test { |
| 41 public: | 41 public: |
| 42 PictureLayerImplPerfTest() | 42 PictureLayerImplPerfTest() |
| 43 : proxy_(base::ThreadTaskRunnerHandle::Get()), | 43 : proxy_(base::ThreadTaskRunnerHandle::Get()), |
| 44 output_surface_(FakeOutputSurface::Create3d()), |
| 44 host_impl_(LayerTreeSettings(), | 45 host_impl_(LayerTreeSettings(), |
| 45 &proxy_, | 46 &proxy_, |
| 46 &shared_bitmap_manager_, | 47 &shared_bitmap_manager_, |
| 47 &task_graph_runner_), | 48 &task_graph_runner_), |
| 48 timer_(kWarmupRuns, | 49 timer_(kWarmupRuns, |
| 49 base::TimeDelta::FromMilliseconds(kTimeLimitMillis), | 50 base::TimeDelta::FromMilliseconds(kTimeLimitMillis), |
| 50 kTimeCheckInterval) {} | 51 kTimeCheckInterval) {} |
| 51 | 52 |
| 52 void SetUp() override { | 53 void SetUp() override { |
| 53 host_impl_.InitializeRenderer(FakeOutputSurface::Create3d()); | 54 host_impl_.InitializeRenderer(output_surface_.get()); |
| 54 } | 55 } |
| 55 | 56 |
| 56 void SetupActiveTree(const gfx::Size& layer_bounds, | 57 void SetupActiveTree(const gfx::Size& layer_bounds, |
| 57 const gfx::Size& tile_size) { | 58 const gfx::Size& tile_size) { |
| 58 scoped_refptr<FakePicturePileImpl> pile = | 59 scoped_refptr<FakePicturePileImpl> pile = |
| 59 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 60 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
| 60 LayerTreeImpl* active_tree = host_impl_.active_tree(); | 61 LayerTreeImpl* active_tree = host_impl_.active_tree(); |
| 61 active_tree->DetachLayerTree(); | 62 active_tree->DetachLayerTree(); |
| 62 | 63 |
| 63 scoped_ptr<FakePictureLayerImpl> active_layer = | 64 scoped_ptr<FakePictureLayerImpl> active_layer = |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 } while (!timer_.HasTimeLimitExpired()); | 158 } while (!timer_.HasTimeLimitExpired()); |
| 158 | 159 |
| 159 perf_test::PrintResult("tiling_set_eviction_queue_construct", "", test_name, | 160 perf_test::PrintResult("tiling_set_eviction_queue_construct", "", test_name, |
| 160 timer_.LapsPerSecond(), "runs/s", true); | 161 timer_.LapsPerSecond(), "runs/s", true); |
| 161 } | 162 } |
| 162 | 163 |
| 163 protected: | 164 protected: |
| 164 TestSharedBitmapManager shared_bitmap_manager_; | 165 TestSharedBitmapManager shared_bitmap_manager_; |
| 165 TestTaskGraphRunner task_graph_runner_; | 166 TestTaskGraphRunner task_graph_runner_; |
| 166 FakeImplProxy proxy_; | 167 FakeImplProxy proxy_; |
| 168 scoped_ptr<OutputSurface> output_surface_; |
| 167 FakeLayerTreeHostImpl host_impl_; | 169 FakeLayerTreeHostImpl host_impl_; |
| 168 FakePictureLayerImpl* active_layer_; | 170 FakePictureLayerImpl* active_layer_; |
| 169 LapTimer timer_; | 171 LapTimer timer_; |
| 170 | 172 |
| 171 private: | 173 private: |
| 172 DISALLOW_COPY_AND_ASSIGN(PictureLayerImplPerfTest); | 174 DISALLOW_COPY_AND_ASSIGN(PictureLayerImplPerfTest); |
| 173 }; | 175 }; |
| 174 | 176 |
| 175 TEST_F(PictureLayerImplPerfTest, TilingSetRasterQueueConstructAndIterate) { | 177 TEST_F(PictureLayerImplPerfTest, TilingSetRasterQueueConstructAndIterate) { |
| 176 SetupActiveTree(gfx::Size(10000, 10000), gfx::Size(256, 256)); | 178 SetupActiveTree(gfx::Size(10000, 10000), gfx::Size(256, 256)); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 ASSERT_TRUE(host_impl_.tile_manager() != nullptr); | 247 ASSERT_TRUE(host_impl_.tile_manager() != nullptr); |
| 246 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(all_tiles); | 248 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(all_tiles); |
| 247 | 249 |
| 248 RunEvictionQueueConstructTest("0_0_100x100", gfx::Rect(0, 0, 100, 100)); | 250 RunEvictionQueueConstructTest("0_0_100x100", gfx::Rect(0, 0, 100, 100)); |
| 249 RunEvictionQueueConstructTest("5000_0_100x100", gfx::Rect(5000, 0, 100, 100)); | 251 RunEvictionQueueConstructTest("5000_0_100x100", gfx::Rect(5000, 0, 100, 100)); |
| 250 RunEvictionQueueConstructTest("9999_0_100x100", gfx::Rect(9999, 0, 100, 100)); | 252 RunEvictionQueueConstructTest("9999_0_100x100", gfx::Rect(9999, 0, 100, 100)); |
| 251 } | 253 } |
| 252 | 254 |
| 253 } // namespace | 255 } // namespace |
| 254 } // namespace cc | 256 } // namespace cc |
| OLD | NEW |