Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/layer.h" | 5 #include "cc/layers/layer.h" |
| 6 | 6 |
| 7 #include "base/threading/thread_task_runner_handle.h" | 7 #include "base/threading/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_task_runner_provider.h" | 9 #include "cc/test/fake_impl_task_runner_provider.h" |
| 10 #include "cc/test/fake_layer_tree_host.h" | 10 #include "cc/test/fake_layer_tree_host.h" |
| 11 #include "cc/test/fake_layer_tree_host_client.h" | 11 #include "cc/test/fake_layer_tree_host_client.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/stub_layer_tree_host_single_thread_client.h" | 13 #include "cc/test/stub_layer_tree_host_single_thread_client.h" |
| 14 #include "cc/test/test_shared_bitmap_manager.h" | |
| 14 #include "cc/test/test_task_graph_runner.h" | 15 #include "cc/test/test_task_graph_runner.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
| 16 #include "testing/perf/perf_test.h" | 17 #include "testing/perf/perf_test.h" |
| 17 | 18 |
| 18 namespace cc { | 19 namespace cc { |
| 19 namespace { | 20 namespace { |
| 20 | 21 |
| 21 static const int kTimeLimitMillis = 3000; | 22 static const int kTimeLimitMillis = 3000; |
| 22 static const int kWarmupRuns = 5; | 23 static const int kWarmupRuns = 5; |
| 23 static const int kTimeCheckInterval = 10; | 24 static const int kTimeCheckInterval = 10; |
| 24 | 25 |
| 25 class LayerPerfTest : public testing::Test { | 26 class LayerPerfTest : public testing::Test { |
| 26 public: | 27 public: |
| 27 LayerPerfTest() | 28 LayerPerfTest() |
| 28 : host_impl_(&task_runner_provider_, | 29 : host_impl_(&task_runner_provider_, &task_graph_runner_), |
| 29 &shared_bitmap_manager_, | |
| 30 &task_graph_runner_), | |
| 31 timer_(kWarmupRuns, | 30 timer_(kWarmupRuns, |
| 32 base::TimeDelta::FromMilliseconds(kTimeLimitMillis), | 31 base::TimeDelta::FromMilliseconds(kTimeLimitMillis), |
| 33 kTimeCheckInterval) {} | 32 kTimeCheckInterval) {} |
| 34 | 33 |
| 35 protected: | 34 protected: |
| 36 void SetUp() override { | 35 void SetUp() override { |
| 37 layer_tree_host_ = | 36 layer_tree_host_ = |
| 38 FakeLayerTreeHost::Create(&fake_client_, &task_graph_runner_); | 37 FakeLayerTreeHost::Create(&fake_client_, &task_graph_runner_); |
| 39 layer_tree_host_->InitializeSingleThreaded( | 38 layer_tree_host_->InitializeSingleThreaded( |
| 40 &single_thread_client_, base::ThreadTaskRunnerHandle::Get()); | 39 &single_thread_client_, base::ThreadTaskRunnerHandle::Get()); |
| 41 } | 40 } |
| 42 | 41 |
| 43 void TearDown() override { | 42 void TearDown() override { |
| 44 layer_tree_host_->SetRootLayer(nullptr); | 43 layer_tree_host_->SetRootLayer(nullptr); |
| 45 layer_tree_host_ = nullptr; | 44 layer_tree_host_ = nullptr; |
| 46 } | 45 } |
| 47 | 46 |
| 48 FakeImplTaskRunnerProvider task_runner_provider_; | 47 FakeImplTaskRunnerProvider task_runner_provider_; |
| 49 TestSharedBitmapManager shared_bitmap_manager_; | 48 TestSharedBitmapManager shared_bitmap_manager_; |
|
danakj
2016/10/27 21:00:34
Not used?
piman
2016/10/28 00:58:36
Removed.
| |
| 50 TestTaskGraphRunner task_graph_runner_; | 49 TestTaskGraphRunner task_graph_runner_; |
| 51 FakeLayerTreeHostImpl host_impl_; | 50 FakeLayerTreeHostImpl host_impl_; |
| 52 | 51 |
| 53 StubLayerTreeHostSingleThreadClient single_thread_client_; | 52 StubLayerTreeHostSingleThreadClient single_thread_client_; |
| 54 FakeLayerTreeHostClient fake_client_; | 53 FakeLayerTreeHostClient fake_client_; |
| 55 std::unique_ptr<FakeLayerTreeHost> layer_tree_host_; | 54 std::unique_ptr<FakeLayerTreeHost> layer_tree_host_; |
| 56 LapTimer timer_; | 55 LapTimer timer_; |
| 57 }; | 56 }; |
| 58 | 57 |
| 59 TEST_F(LayerPerfTest, PushPropertiesTo) { | 58 TEST_F(LayerPerfTest, PushPropertiesTo) { |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 158 test_layer->PushPropertiesTo(impl_layer.get()); | 157 test_layer->PushPropertiesTo(impl_layer.get()); |
| 159 timer_.NextLap(); | 158 timer_.NextLap(); |
| 160 } while (!timer_.HasTimeLimitExpired()); | 159 } while (!timer_.HasTimeLimitExpired()); |
| 161 | 160 |
| 162 perf_test::PrintResult("impl_push_properties_to", "", "props_didnt_change", | 161 perf_test::PrintResult("impl_push_properties_to", "", "props_didnt_change", |
| 163 timer_.LapsPerSecond(), "runs/s", true); | 162 timer_.LapsPerSecond(), "runs/s", true); |
| 164 } | 163 } |
| 165 | 164 |
| 166 } // namespace | 165 } // namespace |
| 167 } // namespace cc | 166 } // namespace cc |
| OLD | NEW |