| 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_compositor_frame_sink.h" |
| 11 #include "cc/test/fake_impl_task_runner_provider.h" | 11 #include "cc/test/fake_impl_task_runner_provider.h" |
| 12 #include "cc/test/fake_layer_tree_host_impl.h" | 12 #include "cc/test/fake_layer_tree_host_impl.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" | |
| 16 #include "cc/test/test_task_graph_runner.h" | 15 #include "cc/test/test_task_graph_runner.h" |
| 17 #include "cc/tiles/tiling_set_raster_queue_all.h" | 16 #include "cc/tiles/tiling_set_raster_queue_all.h" |
| 18 #include "cc/trees/layer_tree_impl.h" | 17 #include "cc/trees/layer_tree_impl.h" |
| 19 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| 20 #include "testing/perf/perf_test.h" | 19 #include "testing/perf/perf_test.h" |
| 21 | 20 |
| 22 namespace cc { | 21 namespace cc { |
| 23 namespace { | 22 namespace { |
| 24 | 23 |
| 25 static const int kTimeLimitMillis = 2000; | 24 static const int kTimeLimitMillis = 2000; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 38 tiling_tiles.begin(), tiling_tiles.end(), std::back_inserter(*all_tiles)); | 37 tiling_tiles.begin(), tiling_tiles.end(), std::back_inserter(*all_tiles)); |
| 39 } | 38 } |
| 40 | 39 |
| 41 class PictureLayerImplPerfTest : public testing::Test { | 40 class PictureLayerImplPerfTest : public testing::Test { |
| 42 public: | 41 public: |
| 43 PictureLayerImplPerfTest() | 42 PictureLayerImplPerfTest() |
| 44 : task_runner_provider_(base::ThreadTaskRunnerHandle::Get()), | 43 : task_runner_provider_(base::ThreadTaskRunnerHandle::Get()), |
| 45 compositor_frame_sink_(FakeCompositorFrameSink::Create3d()), | 44 compositor_frame_sink_(FakeCompositorFrameSink::Create3d()), |
| 46 host_impl_(LayerTreeSettings(), | 45 host_impl_(LayerTreeSettings(), |
| 47 &task_runner_provider_, | 46 &task_runner_provider_, |
| 48 &shared_bitmap_manager_, | |
| 49 &task_graph_runner_), | 47 &task_graph_runner_), |
| 50 timer_(kWarmupRuns, | 48 timer_(kWarmupRuns, |
| 51 base::TimeDelta::FromMilliseconds(kTimeLimitMillis), | 49 base::TimeDelta::FromMilliseconds(kTimeLimitMillis), |
| 52 kTimeCheckInterval) {} | 50 kTimeCheckInterval) {} |
| 53 | 51 |
| 54 void SetUp() override { | 52 void SetUp() override { |
| 55 host_impl_.SetVisible(true); | 53 host_impl_.SetVisible(true); |
| 56 host_impl_.InitializeRenderer(compositor_frame_sink_.get()); | 54 host_impl_.InitializeRenderer(compositor_frame_sink_.get()); |
| 57 } | 55 } |
| 58 | 56 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 std::unique_ptr<TilingSetEvictionQueue> queue(new TilingSetEvictionQueue( | 163 std::unique_ptr<TilingSetEvictionQueue> queue(new TilingSetEvictionQueue( |
| 166 pending_layer_->picture_layer_tiling_set())); | 164 pending_layer_->picture_layer_tiling_set())); |
| 167 timer_.NextLap(); | 165 timer_.NextLap(); |
| 168 } while (!timer_.HasTimeLimitExpired()); | 166 } while (!timer_.HasTimeLimitExpired()); |
| 169 | 167 |
| 170 perf_test::PrintResult("tiling_set_eviction_queue_construct", "", test_name, | 168 perf_test::PrintResult("tiling_set_eviction_queue_construct", "", test_name, |
| 171 timer_.LapsPerSecond(), "runs/s", true); | 169 timer_.LapsPerSecond(), "runs/s", true); |
| 172 } | 170 } |
| 173 | 171 |
| 174 protected: | 172 protected: |
| 175 TestSharedBitmapManager shared_bitmap_manager_; | |
| 176 TestTaskGraphRunner task_graph_runner_; | 173 TestTaskGraphRunner task_graph_runner_; |
| 177 FakeImplTaskRunnerProvider task_runner_provider_; | 174 FakeImplTaskRunnerProvider task_runner_provider_; |
| 178 std::unique_ptr<CompositorFrameSink> compositor_frame_sink_; | 175 std::unique_ptr<CompositorFrameSink> compositor_frame_sink_; |
| 179 FakeLayerTreeHostImpl host_impl_; | 176 FakeLayerTreeHostImpl host_impl_; |
| 180 FakePictureLayerImpl* pending_layer_; | 177 FakePictureLayerImpl* pending_layer_; |
| 181 LapTimer timer_; | 178 LapTimer timer_; |
| 182 | 179 |
| 183 private: | 180 private: |
| 184 DISALLOW_COPY_AND_ASSIGN(PictureLayerImplPerfTest); | 181 DISALLOW_COPY_AND_ASSIGN(PictureLayerImplPerfTest); |
| 185 }; | 182 }; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 ASSERT_TRUE(host_impl_.tile_manager() != nullptr); | 254 ASSERT_TRUE(host_impl_.tile_manager() != nullptr); |
| 258 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(all_tiles); | 255 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(all_tiles); |
| 259 | 256 |
| 260 RunEvictionQueueConstructTest("0_0_100x100", gfx::Rect(0, 0, 100, 100)); | 257 RunEvictionQueueConstructTest("0_0_100x100", gfx::Rect(0, 0, 100, 100)); |
| 261 RunEvictionQueueConstructTest("5000_0_100x100", gfx::Rect(5000, 0, 100, 100)); | 258 RunEvictionQueueConstructTest("5000_0_100x100", gfx::Rect(5000, 0, 100, 100)); |
| 262 RunEvictionQueueConstructTest("9999_0_100x100", gfx::Rect(9999, 0, 100, 100)); | 259 RunEvictionQueueConstructTest("9999_0_100x100", gfx::Rect(9999, 0, 100, 100)); |
| 263 } | 260 } |
| 264 | 261 |
| 265 } // namespace | 262 } // namespace |
| 266 } // namespace cc | 263 } // namespace cc |
| OLD | NEW |