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

Unified Diff: cc/trees/layer_tree.cc

Issue 2493523003: cc: Remove unused proto conversion code. (Closed)
Patch Set: test Created 4 years, 1 month 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/trees/layer_tree.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.cc
diff --git a/cc/trees/layer_tree.cc b/cc/trees/layer_tree.cc
index 0d530d62687633e9fd8f0b119d3f558ea8e1fc12..bf07576cc69500ff0e9f14a4e76bfb444e1a2384 100644
--- a/cc/trees/layer_tree.cc
+++ b/cc/trees/layer_tree.cc
@@ -10,7 +10,6 @@
#include "cc/layers/heads_up_display_layer.h"
#include "cc/layers/heads_up_display_layer_impl.h"
#include "cc/layers/layer.h"
-#include "cc/layers/layer_proto_converter.h"
#include "cc/proto/gfx_conversions.h"
#include "cc/proto/layer_tree.pb.h"
#include "cc/trees/layer_tree_host.h"
@@ -21,27 +20,6 @@
namespace cc {
-namespace {
-
-Layer* UpdateAndGetLayer(Layer* current_layer,
- int layer_id,
- LayerTree* layer_tree) {
- if (layer_id == Layer::INVALID_ID) {
- if (current_layer)
- current_layer->SetLayerTreeHost(nullptr);
-
- return nullptr;
- }
- Layer* layer = layer_tree->LayerById(layer_id);
- DCHECK(layer);
- if (current_layer && current_layer != layer)
- current_layer->SetLayerTreeHost(nullptr);
-
- return layer;
-}
-
-} // namespace
-
LayerTree::Inputs::Inputs()
: top_controls_height(0.f),
top_controls_shown_ratio(0.f),
@@ -429,11 +407,9 @@ void LayerTree::PushPropertiesTo(LayerTreeImpl* tree_impl,
tree_impl->set_has_ever_been_drawn(false);
}
-void LayerTree::ToProtobuf(proto::LayerTree* proto, bool inputs_only) {
+void LayerTree::ToProtobuf(proto::LayerTree* proto) {
TRACE_EVENT0("cc.remote", "LayerProtoConverter::SerializeLayerHierarchy");
- // LayerTree::Inputs Serialization -----------------------------------------
-
// TODO(khushalsagar): Why walk the tree twice? Why not serialize properties
// for dirty layers as you serialize the hierarchy?
if (inputs_.root_layer)
@@ -481,95 +457,6 @@ void LayerTree::ToProtobuf(proto::LayerTree* proto, bool inputs_only) {
proto->set_touch_end_or_cancel_event_listener_properties(
static_cast<uint32_t>(
event_listener_properties(EventListenerClass::kTouchEndOrCancel)));
-
- if (inputs_only)
- return;
- // ----------------------------------------------------------------------
-
- for (auto* layer : layers_that_should_push_properties_) {
- proto->add_layers_that_should_push_properties(layer->id());
- }
- proto->set_in_paint_layer_contents(in_paint_layer_contents());
-
- proto->set_needs_full_tree_sync(needs_full_tree_sync_);
- proto->set_needs_meta_info_recomputation(needs_meta_info_recomputation_);
- proto->set_hud_layer_id(hud_layer_ ? hud_layer_->id() : Layer::INVALID_ID);
-
- property_trees_.ToProtobuf(proto->mutable_property_trees());
- Vector2dFToProto(elastic_overscroll_, proto->mutable_elastic_overscroll());
-}
-
-void LayerTree::FromProtobuf(const proto::LayerTree& proto) {
- // Layer hierarchy.
- scoped_refptr<Layer> new_root_layer;
- if (proto.has_root_layer())
- new_root_layer = LayerProtoConverter::DeserializeLayerHierarchy(
- inputs_.root_layer, proto.root_layer(), layer_tree_host_);
- if (inputs_.root_layer != new_root_layer) {
- inputs_.root_layer = new_root_layer;
- }
-
- for (auto layer_id : proto.layers_that_should_push_properties()) {
- AddLayerShouldPushProperties(layer_id_map_[layer_id]);
- }
- in_paint_layer_contents_ = proto.in_paint_layer_contents();
-
- needs_full_tree_sync_ = proto.needs_full_tree_sync();
- needs_meta_info_recomputation_ = proto.needs_meta_info_recomputation();
-
- inputs_.overscroll_elasticity_layer =
- UpdateAndGetLayer(inputs_.overscroll_elasticity_layer.get(),
- proto.overscroll_elasticity_layer_id(), this);
- inputs_.page_scale_layer = UpdateAndGetLayer(
- inputs_.page_scale_layer.get(), proto.page_scale_layer_id(), this);
- inputs_.inner_viewport_scroll_layer =
- UpdateAndGetLayer(inputs_.inner_viewport_scroll_layer.get(),
- proto.inner_viewport_scroll_layer_id(), this);
- inputs_.outer_viewport_scroll_layer =
- UpdateAndGetLayer(inputs_.outer_viewport_scroll_layer.get(),
- proto.outer_viewport_scroll_layer_id(), this);
-
- inputs_.device_viewport_size = ProtoToSize(proto.device_viewport_size());
- inputs_.device_scale_factor = proto.device_scale_factor();
- inputs_.painted_device_scale_factor = proto.painted_device_scale_factor();
- inputs_.page_scale_factor = proto.page_scale_factor();
- inputs_.min_page_scale_factor = proto.min_page_scale_factor();
- inputs_.max_page_scale_factor = proto.max_page_scale_factor();
- inputs_.background_color = proto.background_color();
- inputs_.has_transparent_background = proto.has_transparent_background();
- inputs_.have_scroll_event_handlers = proto.have_scroll_event_handlers();
- inputs_.event_listener_properties[static_cast<size_t>(
- EventListenerClass::kMouseWheel)] =
- static_cast<EventListenerProperties>(
- proto.wheel_event_listener_properties());
- inputs_.event_listener_properties[static_cast<size_t>(
- EventListenerClass::kTouchStartOrMove)] =
- static_cast<EventListenerProperties>(
- proto.touch_start_or_move_event_listener_properties());
- inputs_.event_listener_properties[static_cast<size_t>(
- EventListenerClass::kTouchEndOrCancel)] =
- static_cast<EventListenerProperties>(
- proto.touch_end_or_cancel_event_listener_properties());
-
- hud_layer_ = static_cast<HeadsUpDisplayLayer*>(
- UpdateAndGetLayer(hud_layer_.get(), proto.hud_layer_id(), this));
-
- LayerSelectionFromProtobuf(&inputs_.selection, proto.selection());
- elastic_overscroll_ = ProtoToVector2dF(proto.elastic_overscroll());
-
- // It is required to create new PropertyTrees before deserializing it.
- property_trees_ = PropertyTrees();
- property_trees_.FromProtobuf(proto.property_trees());
-
- // Forcefully override the sequence number of all layers in the tree to have
- // a valid sequence number. Changing the sequence number for a layer does not
- // need a commit, so the value will become out of date for layers that are not
- // updated for other reasons. All layers that at this point are part of the
- // layer tree are valid, so it is OK that they have a valid sequence number.
- int seq_num = property_trees_.sequence_number;
- LayerTreeHostCommon::CallFunctionForEveryLayer(this, [seq_num](Layer* layer) {
- layer->set_property_tree_sequence_number(seq_num);
- });
}
Layer* LayerTree::LayerByElementId(ElementId element_id) const {
« no previous file with comments | « cc/trees/layer_tree.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698