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

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: Fix based on review. 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
« no previous file with comments | « cc/test/fake_layer_tree_host.cc ('k') | cc/trees/layer_tree.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 bool UpdateLayers(const LayerList& update_layer_list,
36 bool* content_is_suitable_for_gpu);
37
38 void AddLayerShouldPushProperties(Layer* layer);
39 void RemoveLayerShouldPushProperties(Layer* layer);
40 std::unordered_set<Layer*>& LayersThatShouldPushProperties();
41 bool LayerNeedsPushPropertiesForTesting(Layer* layer) const;
42
43 void ToProtobuf(proto::LayerTree* proto);
44 void FromProtobuf(const proto::LayerTree& proto);
45
46 AnimationHost* animation_host() const { return animation_host_.get(); }
47
48 bool in_paint_layer_contents() const { return in_paint_layer_contents_; }
49 void set_in_paint_layer_contents(bool value);
Khushal 2016/07/20 21:29:48 Do we still need a setter for this? It should be s
50
51 private:
52 // Set of layers that need to push properties.
53 LayerSet layers_that_should_push_properties_;
54
55 // Layer id to Layer map.
56 LayerIdMap layer_id_map_;
57
58 bool in_paint_layer_contents_;
59
60 std::unique_ptr<AnimationHost> animation_host_;
61
62 DISALLOW_COPY_AND_ASSIGN(LayerTree);
63 };
64
65 } // namespace cc
66
67 #endif // CC_TREES_LAYER_TREE_H_
OLDNEW
« no previous file with comments | « cc/test/fake_layer_tree_host.cc ('k') | cc/trees/layer_tree.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698