| 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_display_list_raster_source.h" | 9 #include "cc/test/fake_display_list_raster_source.h" |
| 10 #include "cc/test/fake_impl_proxy.h" | 10 #include "cc/test/fake_impl_task_runner_provider.h" |
| 11 #include "cc/test/fake_layer_tree_host_impl.h" | 11 #include "cc/test/fake_layer_tree_host_impl.h" |
| 12 #include "cc/test/fake_output_surface.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/test_shared_bitmap_manager.h" | 14 #include "cc/test/test_shared_bitmap_manager.h" |
| 15 #include "cc/test/test_task_graph_runner.h" | 15 #include "cc/test/test_task_graph_runner.h" |
| 16 #include "cc/tiles/tiling_set_raster_queue_all.h" | 16 #include "cc/tiles/tiling_set_raster_queue_all.h" |
| 17 #include "cc/trees/layer_tree_impl.h" | 17 #include "cc/trees/layer_tree_impl.h" |
| 18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| 19 #include "testing/perf/perf_test.h" | 19 #include "testing/perf/perf_test.h" |
| 20 | 20 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 33 tiling->set_resolution(HIGH_RESOLUTION); | 33 tiling->set_resolution(HIGH_RESOLUTION); |
| 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 : task_runner_provider_(base::ThreadTaskRunnerHandle::Get()), |
| 44 output_surface_(FakeOutputSurface::Create3d()), | 44 output_surface_(FakeOutputSurface::Create3d()), |
| 45 host_impl_(LayerTreeSettings(), | 45 host_impl_(LayerTreeSettings(), |
| 46 &proxy_, | 46 &task_runner_provider_, |
| 47 &shared_bitmap_manager_, | 47 &shared_bitmap_manager_, |
| 48 &task_graph_runner_), | 48 &task_graph_runner_), |
| 49 timer_(kWarmupRuns, | 49 timer_(kWarmupRuns, |
| 50 base::TimeDelta::FromMilliseconds(kTimeLimitMillis), | 50 base::TimeDelta::FromMilliseconds(kTimeLimitMillis), |
| 51 kTimeCheckInterval) {} | 51 kTimeCheckInterval) {} |
| 52 | 52 |
| 53 void SetUp() override { | 53 void SetUp() override { |
| 54 host_impl_.SetVisible(true); | 54 host_impl_.SetVisible(true); |
| 55 host_impl_.InitializeRenderer(output_surface_.get()); | 55 host_impl_.InitializeRenderer(output_surface_.get()); |
| 56 } | 56 } |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 timer_.NextLap(); | 157 timer_.NextLap(); |
| 158 } while (!timer_.HasTimeLimitExpired()); | 158 } while (!timer_.HasTimeLimitExpired()); |
| 159 | 159 |
| 160 perf_test::PrintResult("tiling_set_eviction_queue_construct", "", test_name, | 160 perf_test::PrintResult("tiling_set_eviction_queue_construct", "", test_name, |
| 161 timer_.LapsPerSecond(), "runs/s", true); | 161 timer_.LapsPerSecond(), "runs/s", true); |
| 162 } | 162 } |
| 163 | 163 |
| 164 protected: | 164 protected: |
| 165 TestSharedBitmapManager shared_bitmap_manager_; | 165 TestSharedBitmapManager shared_bitmap_manager_; |
| 166 TestTaskGraphRunner task_graph_runner_; | 166 TestTaskGraphRunner task_graph_runner_; |
| 167 FakeImplProxy proxy_; | 167 FakeImplTaskRunnerProvider task_runner_provider_; |
| 168 scoped_ptr<OutputSurface> output_surface_; | 168 scoped_ptr<OutputSurface> output_surface_; |
| 169 FakeLayerTreeHostImpl host_impl_; | 169 FakeLayerTreeHostImpl host_impl_; |
| 170 FakePictureLayerImpl* pending_layer_; | 170 FakePictureLayerImpl* pending_layer_; |
| 171 LapTimer timer_; | 171 LapTimer timer_; |
| 172 | 172 |
| 173 private: | 173 private: |
| 174 DISALLOW_COPY_AND_ASSIGN(PictureLayerImplPerfTest); | 174 DISALLOW_COPY_AND_ASSIGN(PictureLayerImplPerfTest); |
| 175 }; | 175 }; |
| 176 | 176 |
| 177 TEST_F(PictureLayerImplPerfTest, TilingSetRasterQueueConstructAndIterate) { | 177 TEST_F(PictureLayerImplPerfTest, TilingSetRasterQueueConstructAndIterate) { |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 ASSERT_TRUE(host_impl_.tile_manager() != nullptr); | 247 ASSERT_TRUE(host_impl_.tile_manager() != nullptr); |
| 248 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(all_tiles); | 248 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(all_tiles); |
| 249 | 249 |
| 250 RunEvictionQueueConstructTest("0_0_100x100", gfx::Rect(0, 0, 100, 100)); | 250 RunEvictionQueueConstructTest("0_0_100x100", gfx::Rect(0, 0, 100, 100)); |
| 251 RunEvictionQueueConstructTest("5000_0_100x100", gfx::Rect(5000, 0, 100, 100)); | 251 RunEvictionQueueConstructTest("5000_0_100x100", gfx::Rect(5000, 0, 100, 100)); |
| 252 RunEvictionQueueConstructTest("9999_0_100x100", gfx::Rect(9999, 0, 100, 100)); | 252 RunEvictionQueueConstructTest("9999_0_100x100", gfx::Rect(9999, 0, 100, 100)); |
| 253 } | 253 } |
| 254 | 254 |
| 255 } // namespace | 255 } // namespace |
| 256 } // namespace cc | 256 } // namespace cc |
| OLD | NEW |