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 "cc/debug/lap_timer.h" | 7 #include "cc/debug/lap_timer.h" |
8 #include "cc/resources/layer_painter.h" | 8 #include "cc/resources/layer_painter.h" |
9 #include "cc/test/fake_impl_proxy.h" | 9 #include "cc/test/fake_impl_proxy.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 | 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 MockLayerPainter : public LayerPainter { | 24 class MockLayerPainter : public LayerPainter { |
25 public: | 25 public: |
26 void Paint(SkCanvas* canvas, const gfx::Rect& content_rect) override {} | 26 void Paint(SkCanvas* canvas, const gfx::Rect& content_rect) override {} |
27 }; | 27 }; |
28 | 28 |
29 | 29 |
30 class LayerPerfTest : public testing::Test { | 30 class LayerPerfTest : public testing::Test { |
31 public: | 31 public: |
32 LayerPerfTest() | 32 LayerPerfTest() |
33 : host_impl_(&proxy_, &shared_bitmap_manager_), | 33 : host_impl_(&proxy_, &shared_bitmap_manager_, &task_graph_runner_), |
34 fake_client_(FakeLayerTreeHostClient::DIRECT_3D), | 34 fake_client_(FakeLayerTreeHostClient::DIRECT_3D), |
35 timer_(kWarmupRuns, | 35 timer_(kWarmupRuns, |
36 base::TimeDelta::FromMilliseconds(kTimeLimitMillis), | 36 base::TimeDelta::FromMilliseconds(kTimeLimitMillis), |
37 kTimeCheckInterval) {} | 37 kTimeCheckInterval) {} |
38 | 38 |
39 protected: | 39 protected: |
40 void SetUp() override { | 40 void SetUp() override { |
41 layer_tree_host_ = FakeLayerTreeHost::Create(&fake_client_); | 41 layer_tree_host_ = FakeLayerTreeHost::Create(&fake_client_); |
42 layer_tree_host_->InitializeSingleThreaded( | 42 layer_tree_host_->InitializeSingleThreaded( |
43 &fake_client_, base::MessageLoopProxy::current(), nullptr); | 43 &fake_client_, base::MessageLoopProxy::current(), nullptr); |
44 } | 44 } |
45 | 45 |
46 void TearDown() override { | 46 void TearDown() override { |
47 layer_tree_host_->SetRootLayer(nullptr); | 47 layer_tree_host_->SetRootLayer(nullptr); |
48 layer_tree_host_ = nullptr; | 48 layer_tree_host_ = nullptr; |
49 } | 49 } |
50 | 50 |
51 FakeImplProxy proxy_; | 51 FakeImplProxy proxy_; |
52 TestSharedBitmapManager shared_bitmap_manager_; | 52 TestSharedBitmapManager shared_bitmap_manager_; |
| 53 TestTaskGraphRunner task_graph_runner_; |
53 FakeLayerTreeHostImpl host_impl_; | 54 FakeLayerTreeHostImpl host_impl_; |
54 | 55 |
55 FakeLayerTreeHostClient fake_client_; | 56 FakeLayerTreeHostClient fake_client_; |
56 scoped_ptr<FakeLayerTreeHost> layer_tree_host_; | 57 scoped_ptr<FakeLayerTreeHost> layer_tree_host_; |
57 LapTimer timer_; | 58 LapTimer timer_; |
58 }; | 59 }; |
59 | 60 |
60 TEST_F(LayerPerfTest, PushPropertiesTo) { | 61 TEST_F(LayerPerfTest, PushPropertiesTo) { |
61 scoped_refptr<Layer> test_layer = Layer::Create(); | 62 scoped_refptr<Layer> test_layer = Layer::Create(); |
62 scoped_ptr<LayerImpl> impl_layer = | 63 scoped_ptr<LayerImpl> impl_layer = |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 "", | 113 "", |
113 "props_didnt_change", | 114 "props_didnt_change", |
114 timer_.LapsPerSecond(), | 115 timer_.LapsPerSecond(), |
115 "runs/s", | 116 "runs/s", |
116 true); | 117 true); |
117 } | 118 } |
118 | 119 |
119 | 120 |
120 } // namespace | 121 } // namespace |
121 } // namespace cc | 122 } // namespace cc |
OLD | NEW |