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

Unified Diff: cc/trees/layer_tree_host.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
« cc/trees/layer_tree_host.h ('K') | « cc/trees/layer_tree_host.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host.cc
diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc
index cd025356975a3d31838bd9bf74d581cd7f189f1b..743836be685f3193c266ed6cd7e07824faa8002b 100644
--- a/cc/trees/layer_tree_host.cc
+++ b/cc/trees/layer_tree_host.cc
@@ -44,6 +44,7 @@
#include "cc/layers/layer_proto_converter.h"
#include "cc/layers/painted_scrollbar_layer.h"
#include "cc/proto/gfx_conversions.h"
+#include "cc/proto/layer_tree.pb.h"
#include "cc/proto/layer_tree_host.pb.h"
#include "cc/resources/ui_resource_request.h"
#include "cc/scheduler/begin_frame_source.h"
@@ -251,7 +252,8 @@ LayerTreeHost::LayerTreeHost(InitParams* params, CompositorMode mode)
task_graph_runner_(params->task_graph_runner),
image_serialization_processor_(params->image_serialization_processor),
surface_client_id_(0u),
- next_surface_sequence_(1u) {
+ next_surface_sequence_(1u),
+ layer_tree_() {
Khushal 2016/07/18 16:59:33 Don't need to initialize it for a default ctor.
xingliu 2016/07/19 22:47:38 Done.
DCHECK(task_graph_runner_);
DCHECK(animation_host_);
@@ -1345,20 +1347,20 @@ void LayerTreeHost::RemoveFromElementMap(Layer* layer) {
}
void LayerTreeHost::AddLayerShouldPushProperties(Layer* layer) {
Khushal 2016/07/18 16:59:33 Why do we still need these methods on the host? Th
xingliu 2016/07/19 22:47:38 Done.
- layers_that_should_push_properties_.insert(layer);
+ layer_tree_.AddLayerShouldPushProperties(layer);
}
void LayerTreeHost::RemoveLayerShouldPushProperties(Layer* layer) {
- layers_that_should_push_properties_.erase(layer);
+ layer_tree_.RemoveLayerShouldPushProperties(layer);
}
std::unordered_set<Layer*>& LayerTreeHost::LayersThatShouldPushProperties() {
- return layers_that_should_push_properties_;
+ return layer_tree_.layers_that_should_push_properties();
}
bool LayerTreeHost::LayerNeedsPushPropertiesForTesting(Layer* layer) {
- return layers_that_should_push_properties_.find(layer) !=
- layers_that_should_push_properties_.end();
+ const LayerSet& layers = layer_tree_.layers_that_should_push_properties();
+ return layers.find(layer) != layers.end();
}
void LayerTreeHost::RegisterLayer(Layer* layer) {
@@ -1378,7 +1380,8 @@ void LayerTreeHost::UnregisterLayer(Layer* layer) {
animation_host_->UnregisterElement(layer->element_id(),
ElementListType::ACTIVE);
}
- RemoveLayerShouldPushProperties(layer);
+
+ layer_tree_.RemoveLayerShouldPushProperties(layer);
layer_id_map_.erase(layer->id());
}
@@ -1540,8 +1543,7 @@ void LayerTreeHost::ToProtobufForCommit(
// layers_that_should_push_properties_ should be serialized before layer
// properties because it is cleared during the properties serialization.
- for (auto layer : layers_that_should_push_properties_)
- proto->add_layers_that_should_push_properties(layer->id());
+ layer_tree_.ToProtobuf(proto->mutable_layer_tree());
LayerProtoConverter::SerializeLayerProperties(this,
proto->mutable_layer_updates());
@@ -1621,8 +1623,7 @@ void LayerTreeHost::FromProtobufForCommit(const proto::LayerTreeHost& proto) {
root_layer_ = new_root_layer;
}
- for (auto layer_id : proto.layers_that_should_push_properties())
- layers_that_should_push_properties_.insert(layer_id_map_[layer_id]);
+ layer_tree_.FromProtobuf(proto.layer_tree(), &layer_id_map_);
// Ensure ClientPictureCache contains all the necessary SkPictures before
// deserializing the properties.
« cc/trees/layer_tree_host.h ('K') | « cc/trees/layer_tree_host.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698