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" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 LapTimer timer_; | 58 LapTimer timer_; |
59 }; | 59 }; |
60 | 60 |
61 TEST_F(LayerPerfTest, PushPropertiesTo) { | 61 TEST_F(LayerPerfTest, PushPropertiesTo) { |
62 scoped_refptr<Layer> test_layer = Layer::Create(); | 62 scoped_refptr<Layer> test_layer = Layer::Create(); |
63 scoped_ptr<LayerImpl> impl_layer = | 63 scoped_ptr<LayerImpl> impl_layer = |
64 LayerImpl::Create(host_impl_.active_tree(), 1); | 64 LayerImpl::Create(host_impl_.active_tree(), 1); |
65 | 65 |
66 layer_tree_host_->SetRootLayer(test_layer); | 66 layer_tree_host_->SetRootLayer(test_layer); |
67 | 67 |
68 float anchor_point_z = 0; | 68 float transform_origin_z = 0; |
69 bool scrollable = true; | 69 bool scrollable = true; |
70 bool contents_opaque = true; | 70 bool contents_opaque = true; |
71 bool double_sided = true; | 71 bool double_sided = true; |
72 bool hide_layer_and_subtree = true; | 72 bool hide_layer_and_subtree = true; |
73 bool masks_to_bounds = true; | 73 bool masks_to_bounds = true; |
74 | 74 |
75 // Properties changed. | 75 // Properties changed. |
76 timer_.Reset(); | 76 timer_.Reset(); |
77 do { | 77 do { |
78 test_layer->SetNeedsDisplayRect(gfx::RectF(0.f, 0.f, 5.f, 5.f)); | 78 test_layer->SetNeedsDisplayRect(gfx::RectF(0.f, 0.f, 5.f, 5.f)); |
79 test_layer->SetAnchorPointZ(anchor_point_z); | 79 test_layer->SetTransformOrigin(gfx::Point3F(0.f, 0.f, transform_origin_z)); |
80 test_layer->SetContentsOpaque(contents_opaque); | 80 test_layer->SetContentsOpaque(contents_opaque); |
81 test_layer->SetDoubleSided(double_sided); | 81 test_layer->SetDoubleSided(double_sided); |
82 test_layer->SetHideLayerAndSubtree(hide_layer_and_subtree); | 82 test_layer->SetHideLayerAndSubtree(hide_layer_and_subtree); |
83 test_layer->SetMasksToBounds(masks_to_bounds); | 83 test_layer->SetMasksToBounds(masks_to_bounds); |
84 test_layer->SetScrollClipLayerId(scrollable ? test_layer->id() | 84 test_layer->SetScrollClipLayerId(scrollable ? test_layer->id() |
85 : Layer::INVALID_ID); | 85 : Layer::INVALID_ID); |
86 test_layer->PushPropertiesTo(impl_layer.get()); | 86 test_layer->PushPropertiesTo(impl_layer.get()); |
87 | 87 |
88 anchor_point_z += 0.01f; | 88 transform_origin_z += 0.01f; |
89 scrollable = !scrollable; | 89 scrollable = !scrollable; |
90 contents_opaque = !contents_opaque; | 90 contents_opaque = !contents_opaque; |
91 double_sided = !double_sided; | 91 double_sided = !double_sided; |
92 hide_layer_and_subtree = !hide_layer_and_subtree; | 92 hide_layer_and_subtree = !hide_layer_and_subtree; |
93 masks_to_bounds = !masks_to_bounds; | 93 masks_to_bounds = !masks_to_bounds; |
94 | 94 |
95 timer_.NextLap(); | 95 timer_.NextLap(); |
96 } while (!timer_.HasTimeLimitExpired()); | 96 } while (!timer_.HasTimeLimitExpired()); |
97 | 97 |
98 perf_test::PrintResult("push_properties_to", | 98 perf_test::PrintResult("push_properties_to", |
(...skipping 14 matching lines...) Expand all Loading... |
113 "", | 113 "", |
114 "props_didnt_change", | 114 "props_didnt_change", |
115 timer_.LapsPerSecond(), | 115 timer_.LapsPerSecond(), |
116 "runs/s", | 116 "runs/s", |
117 true); | 117 true); |
118 } | 118 } |
119 | 119 |
120 | 120 |
121 } // namespace | 121 } // namespace |
122 } // namespace cc | 122 } // namespace cc |
OLD | NEW |