| 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()), | |
| 45 host_impl_(LayerTreeSettings(), | 44 host_impl_(LayerTreeSettings(), |
| 46 &proxy_, | 45 &proxy_, |
| 47 &shared_bitmap_manager_, | 46 &shared_bitmap_manager_, |
| 48 &task_graph_runner_), | 47 &task_graph_runner_), |
| 49 timer_(kWarmupRuns, | 48 timer_(kWarmupRuns, |
| 50 base::TimeDelta::FromMilliseconds(kTimeLimitMillis), | 49 base::TimeDelta::FromMilliseconds(kTimeLimitMillis), |
| 51 kTimeCheckInterval) {} | 50 kTimeCheckInterval) {} |
| 52 | 51 |
| 53 void SetUp() override { | 52 void SetUp() override { |
| 54 host_impl_.InitializeRenderer(output_surface_.get()); | 53 host_impl_.InitializeRenderer(FakeOutputSurface::Create3d()); |
| 55 } | 54 } |
| 56 | 55 |
| 57 void SetupActiveTree(const gfx::Size& layer_bounds, | 56 void SetupActiveTree(const gfx::Size& layer_bounds, |
| 58 const gfx::Size& tile_size) { | 57 const gfx::Size& tile_size) { |
| 59 scoped_refptr<FakePicturePileImpl> pile = | 58 scoped_refptr<FakePicturePileImpl> pile = |
| 60 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 59 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
| 61 LayerTreeImpl* active_tree = host_impl_.active_tree(); | 60 LayerTreeImpl* active_tree = host_impl_.active_tree(); |
| 62 active_tree->DetachLayerTree(); | 61 active_tree->DetachLayerTree(); |
| 63 | 62 |
| 64 scoped_ptr<FakePictureLayerImpl> active_layer = | 63 scoped_ptr<FakePictureLayerImpl> active_layer = |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 } while (!timer_.HasTimeLimitExpired()); | 157 } while (!timer_.HasTimeLimitExpired()); |
| 159 | 158 |
| 160 perf_test::PrintResult("tiling_set_eviction_queue_construct", "", test_name, | 159 perf_test::PrintResult("tiling_set_eviction_queue_construct", "", test_name, |
| 161 timer_.LapsPerSecond(), "runs/s", true); | 160 timer_.LapsPerSecond(), "runs/s", true); |
| 162 } | 161 } |
| 163 | 162 |
| 164 protected: | 163 protected: |
| 165 TestSharedBitmapManager shared_bitmap_manager_; | 164 TestSharedBitmapManager shared_bitmap_manager_; |
| 166 TestTaskGraphRunner task_graph_runner_; | 165 TestTaskGraphRunner task_graph_runner_; |
| 167 FakeImplProxy proxy_; | 166 FakeImplProxy proxy_; |
| 168 scoped_ptr<OutputSurface> output_surface_; | |
| 169 FakeLayerTreeHostImpl host_impl_; | 167 FakeLayerTreeHostImpl host_impl_; |
| 170 FakePictureLayerImpl* active_layer_; | 168 FakePictureLayerImpl* active_layer_; |
| 171 LapTimer timer_; | 169 LapTimer timer_; |
| 172 | 170 |
| 173 private: | 171 private: |
| 174 DISALLOW_COPY_AND_ASSIGN(PictureLayerImplPerfTest); | 172 DISALLOW_COPY_AND_ASSIGN(PictureLayerImplPerfTest); |
| 175 }; | 173 }; |
| 176 | 174 |
| 177 TEST_F(PictureLayerImplPerfTest, TilingSetRasterQueueConstructAndIterate) { | 175 TEST_F(PictureLayerImplPerfTest, TilingSetRasterQueueConstructAndIterate) { |
| 178 SetupActiveTree(gfx::Size(10000, 10000), gfx::Size(256, 256)); | 176 SetupActiveTree(gfx::Size(10000, 10000), gfx::Size(256, 256)); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 ASSERT_TRUE(host_impl_.tile_manager() != nullptr); | 245 ASSERT_TRUE(host_impl_.tile_manager() != nullptr); |
| 248 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(all_tiles); | 246 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(all_tiles); |
| 249 | 247 |
| 250 RunEvictionQueueConstructTest("0_0_100x100", gfx::Rect(0, 0, 100, 100)); | 248 RunEvictionQueueConstructTest("0_0_100x100", gfx::Rect(0, 0, 100, 100)); |
| 251 RunEvictionQueueConstructTest("5000_0_100x100", gfx::Rect(5000, 0, 100, 100)); | 249 RunEvictionQueueConstructTest("5000_0_100x100", gfx::Rect(5000, 0, 100, 100)); |
| 252 RunEvictionQueueConstructTest("9999_0_100x100", gfx::Rect(9999, 0, 100, 100)); | 250 RunEvictionQueueConstructTest("9999_0_100x100", gfx::Rect(9999, 0, 100, 100)); |
| 253 } | 251 } |
| 254 | 252 |
| 255 } // namespace | 253 } // namespace |
| 256 } // namespace cc | 254 } // namespace cc |
| OLD | NEW |