| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/test/push_properties_counting_layer_impl.h" | 5 #include "cc/test/push_properties_counting_layer_impl.h" |
| 6 | 6 |
| 7 namespace cc { | 7 namespace cc { |
| 8 | 8 |
| 9 // static | 9 // static |
| 10 std::unique_ptr<PushPropertiesCountingLayerImpl> | 10 std::unique_ptr<PushPropertiesCountingLayerImpl> |
| 11 PushPropertiesCountingLayerImpl::Create(LayerTreeImpl* tree_impl, int id) { | 11 PushPropertiesCountingLayerImpl::Create(LayerTreeImpl* tree_impl, int id) { |
| 12 return base::WrapUnique(new PushPropertiesCountingLayerImpl(tree_impl, id)); | 12 return base::WrapUnique(new PushPropertiesCountingLayerImpl(tree_impl, id)); |
| 13 } | 13 } |
| 14 | 14 |
| 15 PushPropertiesCountingLayerImpl::PushPropertiesCountingLayerImpl( | 15 PushPropertiesCountingLayerImpl::PushPropertiesCountingLayerImpl( |
| 16 LayerTreeImpl* tree_impl, | 16 LayerTreeImpl* tree_impl, |
| 17 int id) | 17 int id) |
| 18 : LayerImpl(tree_impl, id), push_properties_count_(0) { | 18 : LayerImpl(tree_impl, id), push_properties_count_(0) {} |
| 19 SetBounds(gfx::Size(1, 1)); | |
| 20 } | |
| 21 | 19 |
| 22 PushPropertiesCountingLayerImpl::~PushPropertiesCountingLayerImpl() = default; | 20 PushPropertiesCountingLayerImpl::~PushPropertiesCountingLayerImpl() = default; |
| 23 | 21 |
| 24 void PushPropertiesCountingLayerImpl::PushPropertiesTo(LayerImpl* layer) { | 22 void PushPropertiesCountingLayerImpl::PushPropertiesTo(LayerImpl* layer) { |
| 25 LayerImpl::PushPropertiesTo(layer); | 23 LayerImpl::PushPropertiesTo(layer); |
| 26 push_properties_count_++; | 24 push_properties_count_++; |
| 27 // Push state to the active tree because we can only access it from there. | 25 // Push state to the active tree because we can only access it from there. |
| 28 static_cast<PushPropertiesCountingLayerImpl*>(layer)->push_properties_count_ = | 26 static_cast<PushPropertiesCountingLayerImpl*>(layer)->push_properties_count_ = |
| 29 push_properties_count_; | 27 push_properties_count_; |
| 30 } | 28 } |
| 31 | 29 |
| 32 std::unique_ptr<LayerImpl> PushPropertiesCountingLayerImpl::CreateLayerImpl( | 30 std::unique_ptr<LayerImpl> PushPropertiesCountingLayerImpl::CreateLayerImpl( |
| 33 LayerTreeImpl* tree_impl) { | 31 LayerTreeImpl* tree_impl) { |
| 34 return PushPropertiesCountingLayerImpl::Create(tree_impl, LayerImpl::id()); | 32 return PushPropertiesCountingLayerImpl::Create(tree_impl, LayerImpl::id()); |
| 35 } | 33 } |
| 36 | 34 |
| 37 } // namespace cc | 35 } // namespace cc |
| OLD | NEW |