Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(322)

Side by Side Diff: cc/trees/layer_tree.h

Issue 2159513003: Setup LayerTree class, refactor 2 functions from LayerTreeHost to it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove external access to layer_id_map_ in LayerTree. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698