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/test_task_graph_runner.h" | 13 #include "cc/test/test_task_graph_runner.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
15 #include "testing/perf/perf_test.h" | 15 #include "testing/perf/perf_test.h" |
16 | 16 |
17 namespace cc { | 17 namespace cc { |
18 namespace { | 18 namespace { |
19 | 19 |
20 static const int kTimeLimitMillis = 3000; | 20 static const int kTimeLimitMillis = 3000; |
21 static const int kWarmupRuns = 5; | 21 static const int kWarmupRuns = 5; |
22 static const int kTimeCheckInterval = 10; | 22 static const int kTimeCheckInterval = 10; |
23 | 23 |
24 class LayerPerfTest : public testing::Test { | 24 class LayerPerfTest : public testing::Test { |
25 public: | 25 public: |
26 LayerPerfTest() | 26 LayerPerfTest() |
27 : host_impl_(&task_runner_provider_, | 27 : host_impl_(&task_runner_provider_, |
28 &shared_bitmap_manager_, | 28 &shared_bitmap_manager_, |
29 &task_graph_runner_), | 29 &task_graph_runner_), |
30 fake_client_(FakeLayerTreeHostClient::DIRECT_3D), | |
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 &fake_client_, base::ThreadTaskRunnerHandle::Get(), nullptr); | 39 &fake_client_, base::ThreadTaskRunnerHandle::Get(), nullptr); |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 test_layer->PushPropertiesTo(impl_layer.get()); | 156 test_layer->PushPropertiesTo(impl_layer.get()); |
158 timer_.NextLap(); | 157 timer_.NextLap(); |
159 } while (!timer_.HasTimeLimitExpired()); | 158 } while (!timer_.HasTimeLimitExpired()); |
160 | 159 |
161 perf_test::PrintResult("impl_push_properties_to", "", "props_didnt_change", | 160 perf_test::PrintResult("impl_push_properties_to", "", "props_didnt_change", |
162 timer_.LapsPerSecond(), "runs/s", true); | 161 timer_.LapsPerSecond(), "runs/s", true); |
163 } | 162 } |
164 | 163 |
165 } // namespace | 164 } // namespace |
166 } // namespace cc | 165 } // namespace cc |
OLD | NEW |