| 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/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/threading/thread_task_runner_handle.h" | 8 #include "base/threading/thread_task_runner_handle.h" |
| 9 #include "cc/debug/lap_timer.h" | 9 #include "cc/debug/lap_timer.h" |
| 10 #include "cc/test/fake_compositor_frame_sink.h" |
| 10 #include "cc/test/fake_impl_task_runner_provider.h" | 11 #include "cc/test/fake_impl_task_runner_provider.h" |
| 11 #include "cc/test/fake_layer_tree_host_impl.h" | 12 #include "cc/test/fake_layer_tree_host_impl.h" |
| 12 #include "cc/test/fake_output_surface.h" | |
| 13 #include "cc/test/fake_picture_layer_impl.h" | 13 #include "cc/test/fake_picture_layer_impl.h" |
| 14 #include "cc/test/fake_raster_source.h" | 14 #include "cc/test/fake_raster_source.h" |
| 15 #include "cc/test/test_shared_bitmap_manager.h" | 15 #include "cc/test/test_shared_bitmap_manager.h" |
| 16 #include "cc/test/test_task_graph_runner.h" | 16 #include "cc/test/test_task_graph_runner.h" |
| 17 #include "cc/tiles/tiling_set_raster_queue_all.h" | 17 #include "cc/tiles/tiling_set_raster_queue_all.h" |
| 18 #include "cc/trees/layer_tree_impl.h" | 18 #include "cc/trees/layer_tree_impl.h" |
| 19 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
| 20 #include "testing/perf/perf_test.h" | 20 #include "testing/perf/perf_test.h" |
| 21 | 21 |
| 22 namespace cc { | 22 namespace cc { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 35 tiling->CreateAllTilesForTesting(); | 35 tiling->CreateAllTilesForTesting(); |
| 36 std::vector<Tile*> tiling_tiles = tiling->AllTilesForTesting(); | 36 std::vector<Tile*> tiling_tiles = tiling->AllTilesForTesting(); |
| 37 std::copy( | 37 std::copy( |
| 38 tiling_tiles.begin(), tiling_tiles.end(), std::back_inserter(*all_tiles)); | 38 tiling_tiles.begin(), tiling_tiles.end(), std::back_inserter(*all_tiles)); |
| 39 } | 39 } |
| 40 | 40 |
| 41 class PictureLayerImplPerfTest : public testing::Test { | 41 class PictureLayerImplPerfTest : public testing::Test { |
| 42 public: | 42 public: |
| 43 PictureLayerImplPerfTest() | 43 PictureLayerImplPerfTest() |
| 44 : task_runner_provider_(base::ThreadTaskRunnerHandle::Get()), | 44 : task_runner_provider_(base::ThreadTaskRunnerHandle::Get()), |
| 45 output_surface_(FakeOutputSurface::CreateDelegating3d()), | 45 compositor_frame_sink_(FakeCompositorFrameSink::Create3d()), |
| 46 host_impl_(LayerTreeSettings(), | 46 host_impl_(LayerTreeSettings(), |
| 47 &task_runner_provider_, | 47 &task_runner_provider_, |
| 48 &shared_bitmap_manager_, | 48 &shared_bitmap_manager_, |
| 49 &task_graph_runner_), | 49 &task_graph_runner_), |
| 50 timer_(kWarmupRuns, | 50 timer_(kWarmupRuns, |
| 51 base::TimeDelta::FromMilliseconds(kTimeLimitMillis), | 51 base::TimeDelta::FromMilliseconds(kTimeLimitMillis), |
| 52 kTimeCheckInterval) {} | 52 kTimeCheckInterval) {} |
| 53 | 53 |
| 54 void SetUp() override { | 54 void SetUp() override { |
| 55 host_impl_.SetVisible(true); | 55 host_impl_.SetVisible(true); |
| 56 host_impl_.InitializeRenderer(output_surface_.get()); | 56 host_impl_.InitializeRenderer(compositor_frame_sink_.get()); |
| 57 } | 57 } |
| 58 | 58 |
| 59 void SetupPendingTree(const gfx::Size& layer_bounds) { | 59 void SetupPendingTree(const gfx::Size& layer_bounds) { |
| 60 scoped_refptr<FakeRasterSource> raster_source = | 60 scoped_refptr<FakeRasterSource> raster_source = |
| 61 FakeRasterSource::CreateFilled(layer_bounds); | 61 FakeRasterSource::CreateFilled(layer_bounds); |
| 62 host_impl_.CreatePendingTree(); | 62 host_impl_.CreatePendingTree(); |
| 63 LayerTreeImpl* pending_tree = host_impl_.pending_tree(); | 63 LayerTreeImpl* pending_tree = host_impl_.pending_tree(); |
| 64 pending_tree->DetachLayers(); | 64 pending_tree->DetachLayers(); |
| 65 | 65 |
| 66 std::unique_ptr<FakePictureLayerImpl> pending_layer = | 66 std::unique_ptr<FakePictureLayerImpl> pending_layer = |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 } while (!timer_.HasTimeLimitExpired()); | 168 } while (!timer_.HasTimeLimitExpired()); |
| 169 | 169 |
| 170 perf_test::PrintResult("tiling_set_eviction_queue_construct", "", test_name, | 170 perf_test::PrintResult("tiling_set_eviction_queue_construct", "", test_name, |
| 171 timer_.LapsPerSecond(), "runs/s", true); | 171 timer_.LapsPerSecond(), "runs/s", true); |
| 172 } | 172 } |
| 173 | 173 |
| 174 protected: | 174 protected: |
| 175 TestSharedBitmapManager shared_bitmap_manager_; | 175 TestSharedBitmapManager shared_bitmap_manager_; |
| 176 TestTaskGraphRunner task_graph_runner_; | 176 TestTaskGraphRunner task_graph_runner_; |
| 177 FakeImplTaskRunnerProvider task_runner_provider_; | 177 FakeImplTaskRunnerProvider task_runner_provider_; |
| 178 std::unique_ptr<OutputSurface> output_surface_; | 178 std::unique_ptr<CompositorFrameSink> compositor_frame_sink_; |
| 179 FakeLayerTreeHostImpl host_impl_; | 179 FakeLayerTreeHostImpl host_impl_; |
| 180 FakePictureLayerImpl* pending_layer_; | 180 FakePictureLayerImpl* pending_layer_; |
| 181 LapTimer timer_; | 181 LapTimer timer_; |
| 182 | 182 |
| 183 private: | 183 private: |
| 184 DISALLOW_COPY_AND_ASSIGN(PictureLayerImplPerfTest); | 184 DISALLOW_COPY_AND_ASSIGN(PictureLayerImplPerfTest); |
| 185 }; | 185 }; |
| 186 | 186 |
| 187 TEST_F(PictureLayerImplPerfTest, TilingSetRasterQueueConstructAndIterate) { | 187 TEST_F(PictureLayerImplPerfTest, TilingSetRasterQueueConstructAndIterate) { |
| 188 SetupPendingTree(gfx::Size(10000, 10000)); | 188 SetupPendingTree(gfx::Size(10000, 10000)); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 ASSERT_TRUE(host_impl_.tile_manager() != nullptr); | 257 ASSERT_TRUE(host_impl_.tile_manager() != nullptr); |
| 258 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(all_tiles); | 258 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(all_tiles); |
| 259 | 259 |
| 260 RunEvictionQueueConstructTest("0_0_100x100", gfx::Rect(0, 0, 100, 100)); | 260 RunEvictionQueueConstructTest("0_0_100x100", gfx::Rect(0, 0, 100, 100)); |
| 261 RunEvictionQueueConstructTest("5000_0_100x100", gfx::Rect(5000, 0, 100, 100)); | 261 RunEvictionQueueConstructTest("5000_0_100x100", gfx::Rect(5000, 0, 100, 100)); |
| 262 RunEvictionQueueConstructTest("9999_0_100x100", gfx::Rect(9999, 0, 100, 100)); | 262 RunEvictionQueueConstructTest("9999_0_100x100", gfx::Rect(9999, 0, 100, 100)); |
| 263 } | 263 } |
| 264 | 264 |
| 265 } // namespace | 265 } // namespace |
| 266 } // namespace cc | 266 } // namespace cc |
| OLD | NEW |