| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "cc/test/push_properties_counting_layer.h" |
| 6 |
| 7 #include "cc/test/push_properties_counting_layer_impl.h" |
| 8 |
| 9 namespace cc { |
| 10 |
| 11 // static |
| 12 scoped_refptr<PushPropertiesCountingLayer> |
| 13 PushPropertiesCountingLayer::Create() { |
| 14 return new PushPropertiesCountingLayer(); |
| 15 } |
| 16 |
| 17 PushPropertiesCountingLayer::PushPropertiesCountingLayer() |
| 18 : push_properties_count_(0), persist_needs_push_properties_(false) { |
| 19 SetBounds(gfx::Size(1, 1)); |
| 20 } |
| 21 |
| 22 PushPropertiesCountingLayer::~PushPropertiesCountingLayer() = default; |
| 23 |
| 24 void PushPropertiesCountingLayer::PushPropertiesTo(LayerImpl* layer) { |
| 25 Layer::PushPropertiesTo(layer); |
| 26 AddPushPropertiesCount(); |
| 27 } |
| 28 |
| 29 std::unique_ptr<LayerImpl> PushPropertiesCountingLayer::CreateLayerImpl( |
| 30 LayerTreeImpl* tree_impl) { |
| 31 return PushPropertiesCountingLayerImpl::Create(tree_impl, Layer::id()); |
| 32 } |
| 33 |
| 34 void PushPropertiesCountingLayer::ToLayerPropertiesProto( |
| 35 proto::LayerUpdate* layer_update, |
| 36 bool inputs_only) { |
| 37 Layer::ToLayerPropertiesProto(layer_update, inputs_only); |
| 38 AddPushPropertiesCount(); |
| 39 } |
| 40 |
| 41 void PushPropertiesCountingLayer::SetTypeForProtoSerialization( |
| 42 proto::LayerNode* proto) const { |
| 43 proto->set_type(proto::LayerNode::PUSH_PROPERTIES_COUNTING_LAYER); |
| 44 } |
| 45 |
| 46 void PushPropertiesCountingLayer::MakePushProperties() { |
| 47 SetContentsOpaque(!contents_opaque()); |
| 48 } |
| 49 |
| 50 void PushPropertiesCountingLayer::SetDrawsContent(bool draws_content) { |
| 51 SetIsDrawable(draws_content); |
| 52 } |
| 53 |
| 54 void PushPropertiesCountingLayer::AddPushPropertiesCount() { |
| 55 push_properties_count_++; |
| 56 if (persist_needs_push_properties_) { |
| 57 GetLayerTree()->AddLayerShouldPushProperties(this); |
| 58 } |
| 59 } |
| 60 |
| 61 } // namespace cc |
| OLD | NEW |