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

Unified Diff: cc/trees/layer_tree.cc

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: 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
Index: cc/trees/layer_tree.cc
diff --git a/cc/trees/layer_tree.cc b/cc/trees/layer_tree.cc
new file mode 100644
index 0000000000000000000000000000000000000000..237018ee24dd211fbdad0e09a6a9d50109fdd117
--- /dev/null
+++ b/cc/trees/layer_tree.cc
@@ -0,0 +1,40 @@
+// 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.
+
+#include "cc/layers/layer.h"
+#include "cc/proto/layer_tree.pb.h"
+#include "cc/trees/layer_tree.h"
+
+namespace cc {
+
+LayerTree::LayerTree() {}
+
+LayerTree::~LayerTree() {}
+
+void LayerTree::AddLayerShouldPushProperties(Layer* layer) {
+ layers_that_should_push_properties_.insert(layer);
+}
+
+void LayerTree::RemoveLayerShouldPushProperties(Layer* layer) {
+ layers_that_should_push_properties_.erase(layer);
+}
+
+LayerSet& LayerTree::layers_that_should_push_properties() {
+ return layers_that_should_push_properties_;
+}
+
+void LayerTree::ToProtobuf(proto::LayerTree* proto) {
+ for (auto layer : layers_that_should_push_properties_) {
+ proto->add_layers_that_should_push_properties(layer->id());
+ }
+}
+
+void LayerTree::FromProtobuf(const proto::LayerTree& proto,
+ LayerIdMap* layer_id_map) {
+ for (auto layer_id : proto.layers_that_should_push_properties()) {
+ AddLayerShouldPushProperties((*layer_id_map)[layer_id]);
+ }
+}
+
+} // namespace cc

Powered by Google App Engine
This is Rietveld 408576698