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 #ifndef CC_TEST_PUSH_PROPERTIES_COUNTING_LAYER_H_ | 5 #ifndef CC_TEST_PUSH_PROPERTIES_COUNTING_LAYER_H_ |
6 #define CC_TEST_PUSH_PROPERTIES_COUNTING_LAYER_H_ | 6 #define CC_TEST_PUSH_PROPERTIES_COUNTING_LAYER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "cc/layers/layer.h" | 12 #include "cc/layers/layer.h" |
13 #include "cc/proto/layer.pb.h" | |
14 | 13 |
15 namespace cc { | 14 namespace cc { |
16 | 15 |
17 class LayerImpl; | 16 class LayerImpl; |
18 class LayerTreeImpl; | 17 class LayerTreeImpl; |
19 | 18 |
20 class PushPropertiesCountingLayer : public Layer { | 19 class PushPropertiesCountingLayer : public Layer { |
21 public: | 20 public: |
22 static scoped_refptr<PushPropertiesCountingLayer> Create(); | 21 static scoped_refptr<PushPropertiesCountingLayer> Create(); |
23 | 22 |
24 // Layer implementation. | 23 // Layer implementation. |
25 void PushPropertiesTo(LayerImpl* layer) override; | 24 void PushPropertiesTo(LayerImpl* layer) override; |
26 std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; | 25 std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; |
27 void ToLayerPropertiesProto(proto::LayerProperties* proto) override; | |
28 void SetTypeForProtoSerialization(proto::LayerNode* proto) const override; | |
29 | 26 |
30 // Something to make this layer push properties, but no other layer. | 27 // Something to make this layer push properties, but no other layer. |
31 void MakePushProperties(); | 28 void MakePushProperties(); |
32 | 29 |
33 size_t push_properties_count() const { return push_properties_count_; } | 30 size_t push_properties_count() const { return push_properties_count_; } |
34 void reset_push_properties_count() { push_properties_count_ = 0; } | 31 void reset_push_properties_count() { push_properties_count_ = 0; } |
35 | 32 |
36 void set_persist_needs_push_properties(bool persist) { | 33 void set_persist_needs_push_properties(bool persist) { |
37 persist_needs_push_properties_ = persist; | 34 persist_needs_push_properties_ = persist; |
38 } | 35 } |
39 | 36 |
40 private: | 37 private: |
41 PushPropertiesCountingLayer(); | 38 PushPropertiesCountingLayer(); |
42 ~PushPropertiesCountingLayer() override; | 39 ~PushPropertiesCountingLayer() override; |
43 | 40 |
44 void AddPushPropertiesCount(); | 41 void AddPushPropertiesCount(); |
45 | 42 |
46 size_t push_properties_count_; | 43 size_t push_properties_count_; |
47 bool persist_needs_push_properties_; | 44 bool persist_needs_push_properties_; |
48 | 45 |
49 DISALLOW_COPY_AND_ASSIGN(PushPropertiesCountingLayer); | 46 DISALLOW_COPY_AND_ASSIGN(PushPropertiesCountingLayer); |
50 }; | 47 }; |
51 | 48 |
52 } // namespace cc | 49 } // namespace cc |
53 | 50 |
54 #endif // CC_TEST_PUSH_PROPERTIES_COUNTING_LAYER_H_ | 51 #endif // CC_TEST_PUSH_PROPERTIES_COUNTING_LAYER_H_ |
OLD | NEW |