| OLD | NEW |
| 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 "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "cc/quads/render_pass.h" | 10 #include "cc/quads/render_pass.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 | 63 |
| 64 template <typename T> | 64 template <typename T> |
| 65 T* AddChild(LayerImpl* parent) { | 65 T* AddChild(LayerImpl* parent) { |
| 66 scoped_ptr<T> layer = | 66 scoped_ptr<T> layer = |
| 67 T::Create(host_->host_impl()->active_tree(), layer_impl_id_++); | 67 T::Create(host_->host_impl()->active_tree(), layer_impl_id_++); |
| 68 T* ptr = layer.get(); | 68 T* ptr = layer.get(); |
| 69 parent->AddChild(std::move(layer)); | 69 parent->AddChild(std::move(layer)); |
| 70 return ptr; | 70 return ptr; |
| 71 } | 71 } |
| 72 | 72 |
| 73 template <typename T> | |
| 74 T* AddReplicaLayer(LayerImpl* origin) { | |
| 75 scoped_ptr<T> layer = | |
| 76 T::Create(host_->host_impl()->active_tree(), layer_impl_id_++); | |
| 77 T* ptr = layer.get(); | |
| 78 origin->SetReplicaLayer(layer.Pass()); | |
| 79 return ptr; | |
| 80 } | |
| 81 | |
| 82 template <typename T, typename A> | 73 template <typename T, typename A> |
| 83 T* AddChildToRoot(const A& a) { | 74 T* AddChildToRoot(const A& a) { |
| 84 scoped_ptr<T> layer = | 75 scoped_ptr<T> layer = |
| 85 T::Create(host_->host_impl()->active_tree(), layer_impl_id_++, a); | 76 T::Create(host_->host_impl()->active_tree(), layer_impl_id_++, a); |
| 86 T* ptr = layer.get(); | 77 T* ptr = layer.get(); |
| 87 root_layer_impl_->AddChild(std::move(layer)); | 78 root_layer_impl_->AddChild(std::move(layer)); |
| 88 return ptr; | 79 return ptr; |
| 89 } | 80 } |
| 90 | 81 |
| 91 template <typename T, typename A, typename B> | 82 template <typename T, typename A, typename B> |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 scoped_ptr<FakeLayerTreeHost> host_; | 145 scoped_ptr<FakeLayerTreeHost> host_; |
| 155 scoped_ptr<LayerImpl> root_layer_impl_; | 146 scoped_ptr<LayerImpl> root_layer_impl_; |
| 156 scoped_ptr<RenderPass> render_pass_; | 147 scoped_ptr<RenderPass> render_pass_; |
| 157 int layer_impl_id_; | 148 int layer_impl_id_; |
| 158 }; | 149 }; |
| 159 }; | 150 }; |
| 160 | 151 |
| 161 } // namespace cc | 152 } // namespace cc |
| 162 | 153 |
| 163 #endif // CC_TEST_LAYER_TEST_COMMON_H_ | 154 #endif // CC_TEST_LAYER_TEST_COMMON_H_ |
| OLD | NEW |