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

Unified Diff: cc/layers/layer.cc

Issue 2183403002: cc: Move data to LayerTree from LayerTreeHost. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@layer_tree_change
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/layers/layer.cc
diff --git a/cc/layers/layer.cc b/cc/layers/layer.cc
index 3352c1f22a03762df78a68a7b695acff4e8afbe8..9a537d3300acebfacadb44787fe887ad72369f80 100644
--- a/cc/layers/layer.cc
+++ b/cc/layers/layer.cc
@@ -128,17 +128,17 @@ void Layer::SetLayerTreeHost(LayerTreeHost* host) {
return;
if (layer_tree_host_) {
- layer_tree_host_->property_trees()->RemoveIdFromIdToIndexMaps(id());
- layer_tree_host_->property_trees()->needs_rebuild = true;
+ layer_tree_->property_trees()->RemoveIdFromIdToIndexMaps(id());
+ layer_tree_->property_trees()->needs_rebuild = true;
layer_tree_->UnregisterLayer(this);
if (inputs_.element_id) {
- layer_tree_host_->animation_host()->UnregisterElement(
- inputs_.element_id, ElementListType::ACTIVE);
+ layer_tree_->animation_host()->UnregisterElement(inputs_.element_id,
+ ElementListType::ACTIVE);
layer_tree_host_->RemoveFromElementMap(this);
}
}
if (host) {
- host->property_trees()->needs_rebuild = true;
+ host->GetLayerTree()->property_trees()->needs_rebuild = true;
host->GetLayerTree()->RegisterLayer(this);
if (inputs_.element_id) {
host->AddToElementMap(this);
@@ -181,7 +181,7 @@ void Layer::SetNeedsCommit() {
return;
SetNeedsPushProperties();
- layer_tree_host_->property_trees()->needs_rebuild = true;
+ layer_tree_->property_trees()->needs_rebuild = true;
if (ignore_set_needs_commit_)
return;
@@ -202,10 +202,10 @@ void Layer::SetNeedsCommitNoRebuild() {
}
void Layer::SetNeedsFullTreeSync() {
- if (!layer_tree_host_)
+ if (!layer_tree_)
return;
- layer_tree_host_->SetNeedsFullTreeSync();
+ layer_tree_->SetNeedsFullTreeSync();
}
void Layer::SetNextCommitWaitsForActivation() {
@@ -245,7 +245,7 @@ void Layer::SetParent(Layer* layer) {
if (!layer_tree_host_)
return;
- layer_tree_host_->property_trees()->needs_rebuild = true;
+ layer_tree_->property_trees()->needs_rebuild = true;
}
void Layer::AddChild(scoped_refptr<Layer> child) {
@@ -491,7 +491,7 @@ void Layer::SetOpacity(float opacity) {
inputs_.opacity = opacity;
SetSubtreePropertyChanged();
if (layer_tree_host_ && !force_rebuild) {
- PropertyTrees* property_trees = layer_tree_host_->property_trees();
+ PropertyTrees* property_trees = layer_tree_->property_trees();
auto effect_id_to_index = property_trees->effect_id_to_index_map.find(id());
if (effect_id_to_index != property_trees->effect_id_to_index_map.end()) {
EffectNode* node =
@@ -595,7 +595,7 @@ void Layer::SetPosition(const gfx::PointF& position) {
return;
SetSubtreePropertyChanged();
- PropertyTrees* property_trees = layer_tree_host_->property_trees();
+ PropertyTrees* property_trees = layer_tree_->property_trees();
if (property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::TRANSFORM,
id())) {
DCHECK_EQ(transform_tree_index(),
@@ -605,7 +605,7 @@ void Layer::SetPosition(const gfx::PointF& position) {
transform_node->update_post_local_transform(position, transform_origin());
transform_node->needs_local_transform_update = true;
transform_node->transform_changed = true;
- layer_tree_host_->property_trees()->transform_tree.set_needs_update(true);
+ layer_tree_->property_trees()->transform_tree.set_needs_update(true);
SetNeedsCommitNoRebuild();
return;
}
@@ -643,7 +643,7 @@ void Layer::SetTransform(const gfx::Transform& transform) {
SetSubtreePropertyChanged();
if (layer_tree_host_) {
- PropertyTrees* property_trees = layer_tree_host_->property_trees();
+ PropertyTrees* property_trees = layer_tree_->property_trees();
if (property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::TRANSFORM,
id())) {
// We need to trigger a rebuild if we could have affected 2d axis
@@ -659,7 +659,7 @@ void Layer::SetTransform(const gfx::Transform& transform) {
transform_node->local = transform;
transform_node->needs_local_transform_update = true;
transform_node->transform_changed = true;
- layer_tree_host_->property_trees()->transform_tree.set_needs_update(true);
+ layer_tree_->property_trees()->transform_tree.set_needs_update(true);
if (preserves_2d_axis_alignment)
SetNeedsCommitNoRebuild();
else
@@ -684,7 +684,7 @@ void Layer::SetTransformOrigin(const gfx::Point3F& transform_origin) {
return;
SetSubtreePropertyChanged();
- PropertyTrees* property_trees = layer_tree_host_->property_trees();
+ PropertyTrees* property_trees = layer_tree_->property_trees();
if (property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::TRANSFORM,
id())) {
DCHECK_EQ(transform_tree_index(),
@@ -695,7 +695,7 @@ void Layer::SetTransformOrigin(const gfx::Point3F& transform_origin) {
transform_node->update_post_local_transform(position(), transform_origin);
transform_node->needs_local_transform_update = true;
transform_node->transform_changed = true;
- layer_tree_host_->property_trees()->transform_tree.set_needs_update(true);
+ layer_tree_->property_trees()->transform_tree.set_needs_update(true);
SetNeedsCommitNoRebuild();
return;
}
@@ -756,8 +756,8 @@ void Layer::SetClipParent(Layer* ancestor) {
inputs_.clip_parent->AddClipChild(this);
SetNeedsCommit();
- if (layer_tree_host_)
- layer_tree_host_->SetNeedsMetaInfoRecomputation(true);
+ if (layer_tree_)
+ layer_tree_->SetNeedsMetaInfoRecomputation(true);
}
void Layer::AddClipChild(Layer* child) {
@@ -784,7 +784,7 @@ void Layer::SetScrollOffset(const gfx::ScrollOffset& scroll_offset) {
if (!layer_tree_host_)
return;
- PropertyTrees* property_trees = layer_tree_host_->property_trees();
+ PropertyTrees* property_trees = layer_tree_->property_trees();
if (scroll_tree_index() != ScrollTree::kInvalidNodeId && scrollable())
property_trees->scroll_tree.SetScrollOffset(id(), scroll_offset);
@@ -817,7 +817,7 @@ void Layer::SetScrollOffsetFromImplSide(
bool needs_rebuild = true;
- PropertyTrees* property_trees = layer_tree_host_->property_trees();
+ PropertyTrees* property_trees = layer_tree_->property_trees();
if (scroll_tree_index() != ScrollTree::kInvalidNodeId && scrollable())
property_trees->scroll_tree.SetScrollOffset(id(), scroll_offset);
@@ -943,7 +943,7 @@ void Layer::SetTransformTreeIndex(int index) {
int Layer::transform_tree_index() const {
if (!layer_tree_host_ ||
- layer_tree_host_->property_trees()->sequence_number !=
+ layer_tree_->property_trees()->sequence_number !=
property_tree_sequence_number_) {
return TransformTree::kInvalidNodeId;
}
@@ -960,7 +960,7 @@ void Layer::SetClipTreeIndex(int index) {
int Layer::clip_tree_index() const {
if (!layer_tree_host_ ||
- layer_tree_host_->property_trees()->sequence_number !=
+ layer_tree_->property_trees()->sequence_number !=
property_tree_sequence_number_) {
return ClipTree::kInvalidNodeId;
}
@@ -977,7 +977,7 @@ void Layer::SetEffectTreeIndex(int index) {
int Layer::effect_tree_index() const {
if (!layer_tree_host_ ||
- layer_tree_host_->property_trees()->sequence_number !=
+ layer_tree_->property_trees()->sequence_number !=
property_tree_sequence_number_) {
return EffectTree::kInvalidNodeId;
}
@@ -986,7 +986,7 @@ int Layer::effect_tree_index() const {
int Layer::render_target_effect_tree_index() const {
EffectNode* effect_node =
- layer_tree_host_->property_trees()->effect_tree.Node(effect_tree_index_);
+ layer_tree_->property_trees()->effect_tree.Node(effect_tree_index_);
if (effect_node->has_render_surface)
return effect_node->id;
else
@@ -1003,7 +1003,7 @@ void Layer::SetScrollTreeIndex(int index) {
int Layer::scroll_tree_index() const {
if (!layer_tree_host_ ||
- layer_tree_host_->property_trees()->sequence_number !=
+ layer_tree_->property_trees()->sequence_number !=
property_tree_sequence_number_) {
return ScrollTree::kInvalidNodeId;
}
@@ -1185,8 +1185,7 @@ void Layer::PushPropertiesTo(LayerImpl* layer) {
// active tree. To do so, avoid scrolling the pending tree along with it
// instead of trying to undo that scrolling later.
if (ScrollOffsetAnimationWasInterrupted())
- layer_tree_host()
- ->property_trees()
+ layer_tree_->property_trees()
->scroll_tree.SetScrollOffsetClobberActiveValue(layer->id());
// If the main thread commits multiple times before the impl thread actually
@@ -1296,7 +1295,7 @@ void Layer::FromLayerNodeProto(const proto::LayerNode& proto,
inputs_.layer_id = proto.id();
layer_tree_host_ = layer_tree_host;
- layer_tree_ = layer_tree_host ? layer_tree_host->GetLayerTree() : nullptr;
+ layer_tree_ = layer_tree_host->GetLayerTree();
layer_tree_->RegisterLayer(this);
for (int i = 0; i < proto.children_size(); ++i) {
@@ -1645,7 +1644,7 @@ void Layer::OnOpacityAnimated(float opacity) {
// recording may be needed.
SetNeedsUpdate();
if (layer_tree_host_) {
- PropertyTrees* property_trees = layer_tree_host_->property_trees();
+ PropertyTrees* property_trees = layer_tree_->property_trees();
if (property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::EFFECT,
id())) {
DCHECK_EQ(effect_tree_index(),
@@ -1665,7 +1664,7 @@ void Layer::OnTransformAnimated(const gfx::Transform& transform) {
// recording may be needed.
SetNeedsUpdate();
if (layer_tree_host_) {
- PropertyTrees* property_trees = layer_tree_host_->property_trees();
+ PropertyTrees* property_trees = layer_tree_->property_trees();
if (property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::TRANSFORM,
id())) {
DCHECK_EQ(transform_tree_index(),
@@ -1689,7 +1688,7 @@ void Layer::OnScrollOffsetAnimated(const gfx::ScrollOffset& scroll_offset) {
void Layer::OnTransformIsCurrentlyAnimatingChanged(
bool is_currently_animating) {
DCHECK(layer_tree_host_);
- PropertyTrees* property_trees = layer_tree_host_->property_trees();
+ PropertyTrees* property_trees = layer_tree_->property_trees();
if (!property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::TRANSFORM,
id()))
return;
@@ -1704,7 +1703,7 @@ void Layer::OnTransformIsPotentiallyAnimatingChanged(
bool has_potential_animation) {
if (!layer_tree_host_)
return;
- PropertyTrees* property_trees = layer_tree_host_->property_trees();
+ PropertyTrees* property_trees = layer_tree_->property_trees();
if (!property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::TRANSFORM,
id()))
return;
@@ -1724,7 +1723,7 @@ void Layer::OnTransformIsPotentiallyAnimatingChanged(
void Layer::OnOpacityIsCurrentlyAnimatingChanged(bool is_currently_animating) {
DCHECK(layer_tree_host_);
- PropertyTrees* property_trees = layer_tree_host_->property_trees();
+ PropertyTrees* property_trees = layer_tree_->property_trees();
if (!property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::EFFECT, id()))
return;
DCHECK_EQ(effect_tree_index(), property_trees->effect_id_to_index_map[id()]);
@@ -1735,7 +1734,7 @@ void Layer::OnOpacityIsCurrentlyAnimatingChanged(bool is_currently_animating) {
void Layer::OnOpacityIsPotentiallyAnimatingChanged(
bool has_potential_animation) {
DCHECK(layer_tree_host_);
- PropertyTrees* property_trees = layer_tree_host_->property_trees();
+ PropertyTrees* property_trees = layer_tree_->property_trees();
if (!property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::EFFECT, id()))
return;
DCHECK_EQ(effect_tree_index(), property_trees->effect_id_to_index_map[id()]);
@@ -1747,7 +1746,7 @@ void Layer::OnOpacityIsPotentiallyAnimatingChanged(
void Layer::OnFilterIsCurrentlyAnimatingChanged(bool is_currently_animating) {
DCHECK(layer_tree_host_);
- PropertyTrees* property_trees = layer_tree_host_->property_trees();
+ PropertyTrees* property_trees = layer_tree_->property_trees();
if (!property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::EFFECT, id()))
return;
DCHECK_EQ(effect_tree_index(), property_trees->effect_id_to_index_map[id()]);
@@ -1758,7 +1757,7 @@ void Layer::OnFilterIsCurrentlyAnimatingChanged(bool is_currently_animating) {
void Layer::OnFilterIsPotentiallyAnimatingChanged(
bool has_potential_animation) {
DCHECK(layer_tree_host_);
- PropertyTrees* property_trees = layer_tree_host_->property_trees();
+ PropertyTrees* property_trees = layer_tree_->property_trees();
if (!property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::EFFECT, id()))
return;
DCHECK_EQ(effect_tree_index(), property_trees->effect_id_to_index_map[id()]);
@@ -1870,8 +1869,7 @@ void Layer::DidBeginTracing() {
}
int Layer::num_copy_requests_in_target_subtree() {
- return layer_tree_host()
- ->property_trees()
+ return layer_tree_->property_trees()
->effect_tree.Node(effect_tree_index())
->num_copy_requests_in_subtree;
}
@@ -1879,7 +1877,7 @@ int Layer::num_copy_requests_in_target_subtree() {
gfx::Transform Layer::screen_space_transform() const {
DCHECK_NE(transform_tree_index_, TransformTree::kInvalidNodeId);
return draw_property_utils::ScreenSpaceTransform(
- this, layer_tree_host_->property_trees()->transform_tree);
+ this, layer_tree_->property_trees()->transform_tree);
}
LayerTree* Layer::GetLayerTree() const {

Powered by Google App Engine
This is Rietveld 408576698