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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree.h
diff --git a/cc/trees/layer_tree.h b/cc/trees/layer_tree.h
new file mode 100644
index 0000000000000000000000000000000000000000..4f2c19684c81a8c7bba9053312bc741f9eeb9f20
--- /dev/null
+++ b/cc/trees/layer_tree.h
@@ -0,0 +1,67 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CC_TREES_LAYER_TREE_H_
+#define CC_TREES_LAYER_TREE_H_
+
+#include <unordered_map>
+#include <unordered_set>
+
+#include "base/macros.h"
+#include "cc/base/cc_export.h"
+
+namespace cc {
+
+namespace proto {
+class LayerTree;
+class LayerUpdate;
+}
+
+class AnimationHost;
+class Layer;
+
+using LayerSet = std::unordered_set<Layer*>;
+using LayerIdMap = std::unordered_map<int, Layer*>;
+
+class CC_EXPORT LayerTree {
+ public:
+ explicit LayerTree(std::unique_ptr<AnimationHost> animation_host);
+ ~LayerTree();
+
+ void RegisterLayer(Layer* layer);
+ void UnregisterLayer(Layer* layer);
+ Layer* LayerById(int id) const;
+ bool UpdateLayers(const LayerList& update_layer_list,
+ bool* content_is_suitable_for_gpu);
+
+ void AddLayerShouldPushProperties(Layer* layer);
+ void RemoveLayerShouldPushProperties(Layer* layer);
+ std::unordered_set<Layer*>& LayersThatShouldPushProperties();
+ bool LayerNeedsPushPropertiesForTesting(Layer* layer) const;
+
+ void ToProtobuf(proto::LayerTree* proto);
+ void FromProtobuf(const proto::LayerTree& proto);
+
+ AnimationHost* animation_host() const { return animation_host_.get(); }
+
+ bool in_paint_layer_contents() const { return in_paint_layer_contents_; }
+ 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
+
+ private:
+ // Set of layers that need to push properties.
+ LayerSet layers_that_should_push_properties_;
+
+ // Layer id to Layer map.
+ LayerIdMap layer_id_map_;
+
+ bool in_paint_layer_contents_;
+
+ std::unique_ptr<AnimationHost> animation_host_;
+
+ DISALLOW_COPY_AND_ASSIGN(LayerTree);
+};
+
+} // namespace cc
+
+#endif // CC_TREES_LAYER_TREE_H_
« 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