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