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

Unified Diff: cc/trees/layer_tree_host_impl.cc

Issue 2619383004: Revise LayerTreeHostImpl to use new element-id-to-node-index maps. (Closed)
Patch Set: Created 3 years, 11 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 | « no previous file | 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_impl.cc
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index 9d01bd653cb692523f0cfccf3bcc9f098ad0f097..da7437a138fbfb460b882b6d7f02db56f7f71435 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -3894,14 +3894,10 @@ void LayerTreeHostImpl::SetTreeLayerFilterMutated(
if (!tree)
return;
- const int layer_id = tree->LayerIdByElementId(element_id);
- DCHECK(tree->property_trees()->IsInIdToIndexMap(
- PropertyTrees::TreeType::EFFECT, layer_id));
- const int effect_id =
- tree->property_trees()->effect_id_to_index_map[layer_id];
- if (effect_id != EffectTree::kInvalidNodeId)
- tree->property_trees()->effect_tree.OnFilterAnimated(filters, effect_id,
- tree);
+ const int effect_node_index =
wkorman 2017/01/09 23:46:16 All unit and layout tests seem to pass (locally, C
ajuma 2017/01/10 00:39:11 What if we DCHECK before looking up? e.g.: DCHECK(
wkorman 2017/01/10 21:34:12 Done.
+ tree->property_trees()->element_id_to_effect_node_index[element_id];
+ tree->property_trees()->effect_tree.OnFilterAnimated(filters,
+ effect_node_index, tree);
}
void LayerTreeHostImpl::SetTreeLayerOpacityMutated(ElementId element_id,
@@ -3910,14 +3906,10 @@ void LayerTreeHostImpl::SetTreeLayerOpacityMutated(ElementId element_id,
if (!tree)
return;
- const int layer_id = tree->LayerIdByElementId(element_id);
- DCHECK(tree->property_trees()->IsInIdToIndexMap(
- PropertyTrees::TreeType::EFFECT, layer_id));
- const int effect_id =
- tree->property_trees()->effect_id_to_index_map[layer_id];
- if (effect_id != EffectTree::kInvalidNodeId)
- tree->property_trees()->effect_tree.OnOpacityAnimated(opacity, effect_id,
- tree);
+ const int effect_node_index =
+ tree->property_trees()->element_id_to_effect_node_index[element_id];
+ tree->property_trees()->effect_tree.OnOpacityAnimated(
+ opacity, effect_node_index, tree);
}
void LayerTreeHostImpl::SetTreeLayerTransformMutated(
@@ -3927,16 +3919,12 @@ void LayerTreeHostImpl::SetTreeLayerTransformMutated(
if (!tree)
return;
+ const int transform_node_index =
+ tree->property_trees()->element_id_to_transform_node_index[element_id];
+ tree->property_trees()->transform_tree.OnTransformAnimated(
+ transform, transform_node_index, tree);
const int layer_id = tree->LayerIdByElementId(element_id);
ajuma 2017/01/10 00:39:11 You can use LayerByElementId here to get the layer
wkorman 2017/01/10 21:34:12 Done.
- DCHECK(tree->property_trees()->IsInIdToIndexMap(
- PropertyTrees::TreeType::TRANSFORM, layer_id));
- const int transform_id =
- tree->property_trees()->transform_id_to_index_map[layer_id];
- if (transform_id != TransformTree::kInvalidNodeId)
- tree->property_trees()->transform_tree.OnTransformAnimated(
- transform, transform_id, tree);
- LayerImpl* layer = tree->LayerById(layer_id);
- if (layer)
+ if (LayerImpl* layer = tree->LayerById(layer_id))
layer->set_was_ever_ready_since_last_transform_animation(false);
}
@@ -3949,17 +3937,16 @@ void LayerTreeHostImpl::SetTreeLayerScrollOffsetMutated(
const int layer_id = tree->LayerIdByElementId(element_id);
DCHECK(tree->property_trees()->IsInIdToIndexMap(
- PropertyTrees::TreeType::TRANSFORM, layer_id));
- DCHECK(tree->property_trees()->IsInIdToIndexMap(
PropertyTrees::TreeType::SCROLL, layer_id));
- const int transform_id =
- tree->property_trees()->transform_id_to_index_map[layer_id];
- const int scroll_id =
+ int transform_node_index =
+ tree->property_trees()->element_id_to_transform_node_index[element_id];
+ // TODO(wkorman): Build map from element id to scroll node in property tree
+ // builder and make use of it below.
+ const int scroll_node_index =
tree->property_trees()->scroll_id_to_index_map[layer_id];
- if (transform_id != TransformTree::kInvalidNodeId &&
- scroll_id != ScrollTree::kInvalidNodeId) {
+ if (scroll_node_index != ScrollTree::kInvalidNodeId) {
tree->property_trees()->scroll_tree.OnScrollOffsetAnimated(
- layer_id, transform_id, scroll_id, scroll_offset, tree);
+ layer_id, transform_node_index, scroll_node_index, scroll_offset, tree);
// Run mutation callbacks to respond to updated scroll offset.
Mutate(CurrentBeginFrameArgs().frame_time);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698