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 #ifndef CC_TREES_LAYER_TREE_H_ |
| 6 #define CC_TREES_LAYER_TREE_H_ |
| 7 |
| 8 #include <unordered_map> |
| 9 #include <unordered_set> |
| 10 |
| 11 #include "base/macros.h" |
| 12 #include "cc/base/cc_export.h" |
| 13 |
| 14 namespace cc { |
| 15 |
| 16 namespace proto { |
| 17 class LayerTree; |
| 18 class LayerUpdate; |
| 19 } |
| 20 |
| 21 class AnimationHost; |
| 22 class Layer; |
| 23 |
| 24 using LayerSet = std::unordered_set<Layer*>; |
| 25 using LayerIdMap = std::unordered_map<int, Layer*>; |
| 26 |
| 27 class CC_EXPORT LayerTree { |
| 28 public: |
| 29 explicit LayerTree(std::unique_ptr<AnimationHost>* animation_host); |
| 30 ~LayerTree(); |
| 31 |
| 32 void RegisterLayer(Layer* layer); |
| 33 void UnregisterLayer(Layer* layer); |
| 34 Layer* LayerById(int id) const; |
| 35 |
| 36 void AddLayerShouldPushProperties(Layer* layer); |
| 37 void RemoveLayerShouldPushProperties(Layer* layer); |
| 38 std::unordered_set<Layer*>& LayersThatShouldPushProperties(); |
| 39 |
| 40 void ToProtobuf(proto::LayerTree* proto); |
| 41 void FromProtobuf(const proto::LayerTree& proto); |
| 42 |
| 43 AnimationHost* animation_host() const { return animation_host_.get(); } |
| 44 |
| 45 bool in_paint_layer_contents() const { return in_paint_layer_contents_; } |
| 46 bool& get_in_paint_layer_contents() { return in_paint_layer_contents_; } |
| 47 void set_in_paint_layer_contents(bool value); |
| 48 |
| 49 private: |
| 50 // Set of layers that need to push properties. |
| 51 LayerSet layers_that_should_push_properties_; |
| 52 |
| 53 // Layer id to Layer map. |
| 54 LayerIdMap layer_id_map_; |
| 55 |
| 56 bool in_paint_layer_contents_; |
| 57 |
| 58 std::unique_ptr<AnimationHost> animation_host_; |
| 59 |
| 60 DISALLOW_COPY_AND_ASSIGN(LayerTree); |
| 61 }; |
| 62 |
| 63 } // namespace cc |
| 64 |
| 65 #endif // CC_TREES_LAYER_TREE_H_ |
OLD | NEW |