Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(363)

Side by Side Diff: cc/test/layer_test_common.h

Issue 1944623002: CC Animation: Use ElementId to attach CC animation players. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@erasedomids
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 #ifndef CC_TEST_LAYER_TEST_COMMON_H_ 5 #ifndef CC_TEST_LAYER_TEST_COMMON_H_
6 #define CC_TEST_LAYER_TEST_COMMON_H_ 6 #define CC_TEST_LAYER_TEST_COMMON_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 class LayerImplTest { 53 class LayerImplTest {
54 public: 54 public:
55 LayerImplTest(); 55 LayerImplTest();
56 explicit LayerImplTest(const LayerTreeSettings& settings); 56 explicit LayerImplTest(const LayerTreeSettings& settings);
57 ~LayerImplTest(); 57 ~LayerImplTest();
58 58
59 template <typename T> 59 template <typename T>
60 T* AddChildToRoot() { 60 T* AddChildToRoot() {
61 std::unique_ptr<T> layer = 61 std::unique_ptr<T> layer =
62 T::Create(host_->host_impl()->active_tree(), layer_impl_id_++); 62 T::Create(host_->host_impl()->active_tree(), layer_impl_id_++);
63 layer->SetElementId(NextElementId());
63 T* ptr = layer.get(); 64 T* ptr = layer.get();
64 root_layer()->AddChild(std::move(layer)); 65 root_layer()->AddChild(std::move(layer));
65 return ptr; 66 return ptr;
66 } 67 }
67 68
68 template <typename T> 69 template <typename T>
69 T* AddChild(LayerImpl* parent) { 70 T* AddChild(LayerImpl* parent) {
70 std::unique_ptr<T> layer = 71 std::unique_ptr<T> layer =
71 T::Create(host_->host_impl()->active_tree(), layer_impl_id_++); 72 T::Create(host_->host_impl()->active_tree(), layer_impl_id_++);
73 layer->SetElementId(NextElementId());
72 T* ptr = layer.get(); 74 T* ptr = layer.get();
73 parent->AddChild(std::move(layer)); 75 parent->AddChild(std::move(layer));
74 return ptr; 76 return ptr;
75 } 77 }
76 78
77 template <typename T> 79 template <typename T>
78 T* AddReplicaLayer(LayerImpl* origin) { 80 T* AddReplicaLayer(LayerImpl* origin) {
79 std::unique_ptr<T> layer = 81 std::unique_ptr<T> layer =
80 T::Create(host_->host_impl()->active_tree(), layer_impl_id_++); 82 T::Create(host_->host_impl()->active_tree(), layer_impl_id_++);
83 layer->SetElementId(NextElementId());
81 T* ptr = layer.get(); 84 T* ptr = layer.get();
82 origin->SetReplicaLayer(std::move(layer)); 85 origin->SetReplicaLayer(std::move(layer));
83 return ptr; 86 return ptr;
84 } 87 }
85 88
86 template <typename T, typename A> 89 template <typename T, typename A>
87 T* AddChildToRoot(const A& a) { 90 T* AddChildToRoot(const A& a) {
88 std::unique_ptr<T> layer = 91 std::unique_ptr<T> layer =
89 T::Create(host_->host_impl()->active_tree(), layer_impl_id_++, a); 92 T::Create(host_->host_impl()->active_tree(), layer_impl_id_++, a);
93 layer->SetElementId(NextElementId());
90 T* ptr = layer.get(); 94 T* ptr = layer.get();
91 root_layer()->AddChild(std::move(layer)); 95 root_layer()->AddChild(std::move(layer));
92 return ptr; 96 return ptr;
93 } 97 }
94 98
95 template <typename T, typename A, typename B> 99 template <typename T, typename A, typename B>
96 T* AddChildToRoot(const A& a, const B& b) { 100 T* AddChildToRoot(const A& a, const B& b) {
97 std::unique_ptr<T> layer = 101 std::unique_ptr<T> layer =
98 T::Create(host_->host_impl()->active_tree(), layer_impl_id_++, a, b); 102 T::Create(host_->host_impl()->active_tree(), layer_impl_id_++, a, b);
103 layer->SetElementId(NextElementId());
99 T* ptr = layer.get(); 104 T* ptr = layer.get();
100 root_layer()->AddChild(std::move(layer)); 105 root_layer()->AddChild(std::move(layer));
101 return ptr; 106 return ptr;
102 } 107 }
103 108
104 template <typename T, typename A, typename B, typename C, typename D> 109 template <typename T, typename A, typename B, typename C, typename D>
105 T* AddChildToRoot(const A& a, const B& b, const C& c, const D& d) { 110 T* AddChildToRoot(const A& a, const B& b, const C& c, const D& d) {
106 std::unique_ptr<T> layer = T::Create(host_->host_impl()->active_tree(), 111 std::unique_ptr<T> layer = T::Create(host_->host_impl()->active_tree(),
107 layer_impl_id_++, a, b, c, d); 112 layer_impl_id_++, a, b, c, d);
113 layer->SetElementId(NextElementId());
108 T* ptr = layer.get(); 114 T* ptr = layer.get();
109 root_layer()->AddChild(std::move(layer)); 115 root_layer()->AddChild(std::move(layer));
110 return ptr; 116 return ptr;
111 } 117 }
112 118
113 template <typename T, 119 template <typename T,
114 typename A, 120 typename A,
115 typename B, 121 typename B,
116 typename C, 122 typename C,
117 typename D, 123 typename D,
118 typename E> 124 typename E>
119 T* AddChildToRoot(const A& a, 125 T* AddChildToRoot(const A& a,
120 const B& b, 126 const B& b,
121 const C& c, 127 const C& c,
122 const D& d, 128 const D& d,
123 const E& e) { 129 const E& e) {
124 std::unique_ptr<T> layer = T::Create(host_->host_impl()->active_tree(), 130 std::unique_ptr<T> layer = T::Create(host_->host_impl()->active_tree(),
125 layer_impl_id_++, a, b, c, d, e); 131 layer_impl_id_++, a, b, c, d, e);
132 layer->SetElementId(NextElementId());
126 T* ptr = layer.get(); 133 T* ptr = layer.get();
127 root_layer()->AddChild(std::move(layer)); 134 root_layer()->AddChild(std::move(layer));
128 return ptr; 135 return ptr;
129 } 136 }
130 137
131 void CalcDrawProps(const gfx::Size& viewport_size); 138 void CalcDrawProps(const gfx::Size& viewport_size);
132 void AppendQuadsWithOcclusion(LayerImpl* layer_impl, 139 void AppendQuadsWithOcclusion(LayerImpl* layer_impl,
133 const gfx::Rect& occluded); 140 const gfx::Rect& occluded);
134 void AppendQuadsForPassWithOcclusion(LayerImpl* layer_impl, 141 void AppendQuadsForPassWithOcclusion(LayerImpl* layer_impl,
135 RenderPass* given_render_pass, 142 RenderPass* given_render_pass,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 std::unique_ptr<RenderPass> render_pass_; 176 std::unique_ptr<RenderPass> render_pass_;
170 scoped_refptr<AnimationTimeline> timeline_; 177 scoped_refptr<AnimationTimeline> timeline_;
171 scoped_refptr<AnimationTimeline> timeline_impl_; 178 scoped_refptr<AnimationTimeline> timeline_impl_;
172 int layer_impl_id_; 179 int layer_impl_id_;
173 }; 180 };
174 }; 181 };
175 182
176 } // namespace cc 183 } // namespace cc
177 184
178 #endif // CC_TEST_LAYER_TEST_COMMON_H_ 185 #endif // CC_TEST_LAYER_TEST_COMMON_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698