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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/trees/layer_tree_host_impl.h" 5 #include "cc/trees/layer_tree_host_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 3876 matching lines...) Expand 10 before | Expand all | Expand 10 after
3887 3887
3888 void LayerTreeHostImpl::SetMutatorsNeedRebuildPropertyTrees() {} 3888 void LayerTreeHostImpl::SetMutatorsNeedRebuildPropertyTrees() {}
3889 3889
3890 void LayerTreeHostImpl::SetTreeLayerFilterMutated( 3890 void LayerTreeHostImpl::SetTreeLayerFilterMutated(
3891 ElementId element_id, 3891 ElementId element_id,
3892 LayerTreeImpl* tree, 3892 LayerTreeImpl* tree,
3893 const FilterOperations& filters) { 3893 const FilterOperations& filters) {
3894 if (!tree) 3894 if (!tree)
3895 return; 3895 return;
3896 3896
3897 const int layer_id = tree->LayerIdByElementId(element_id); 3897 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.
3898 DCHECK(tree->property_trees()->IsInIdToIndexMap( 3898 tree->property_trees()->element_id_to_effect_node_index[element_id];
3899 PropertyTrees::TreeType::EFFECT, layer_id)); 3899 tree->property_trees()->effect_tree.OnFilterAnimated(filters,
3900 const int effect_id = 3900 effect_node_index, tree);
3901 tree->property_trees()->effect_id_to_index_map[layer_id];
3902 if (effect_id != EffectTree::kInvalidNodeId)
3903 tree->property_trees()->effect_tree.OnFilterAnimated(filters, effect_id,
3904 tree);
3905 } 3901 }
3906 3902
3907 void LayerTreeHostImpl::SetTreeLayerOpacityMutated(ElementId element_id, 3903 void LayerTreeHostImpl::SetTreeLayerOpacityMutated(ElementId element_id,
3908 LayerTreeImpl* tree, 3904 LayerTreeImpl* tree,
3909 float opacity) { 3905 float opacity) {
3910 if (!tree) 3906 if (!tree)
3911 return; 3907 return;
3912 3908
3913 const int layer_id = tree->LayerIdByElementId(element_id); 3909 const int effect_node_index =
3914 DCHECK(tree->property_trees()->IsInIdToIndexMap( 3910 tree->property_trees()->element_id_to_effect_node_index[element_id];
3915 PropertyTrees::TreeType::EFFECT, layer_id)); 3911 tree->property_trees()->effect_tree.OnOpacityAnimated(
3916 const int effect_id = 3912 opacity, effect_node_index, tree);
3917 tree->property_trees()->effect_id_to_index_map[layer_id];
3918 if (effect_id != EffectTree::kInvalidNodeId)
3919 tree->property_trees()->effect_tree.OnOpacityAnimated(opacity, effect_id,
3920 tree);
3921 } 3913 }
3922 3914
3923 void LayerTreeHostImpl::SetTreeLayerTransformMutated( 3915 void LayerTreeHostImpl::SetTreeLayerTransformMutated(
3924 ElementId element_id, 3916 ElementId element_id,
3925 LayerTreeImpl* tree, 3917 LayerTreeImpl* tree,
3926 const gfx::Transform& transform) { 3918 const gfx::Transform& transform) {
3927 if (!tree) 3919 if (!tree)
3928 return; 3920 return;
3929 3921
3922 const int transform_node_index =
3923 tree->property_trees()->element_id_to_transform_node_index[element_id];
3924 tree->property_trees()->transform_tree.OnTransformAnimated(
3925 transform, transform_node_index, tree);
3930 const int layer_id = tree->LayerIdByElementId(element_id); 3926 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.
3931 DCHECK(tree->property_trees()->IsInIdToIndexMap( 3927 if (LayerImpl* layer = tree->LayerById(layer_id))
3932 PropertyTrees::TreeType::TRANSFORM, layer_id));
3933 const int transform_id =
3934 tree->property_trees()->transform_id_to_index_map[layer_id];
3935 if (transform_id != TransformTree::kInvalidNodeId)
3936 tree->property_trees()->transform_tree.OnTransformAnimated(
3937 transform, transform_id, tree);
3938 LayerImpl* layer = tree->LayerById(layer_id);
3939 if (layer)
3940 layer->set_was_ever_ready_since_last_transform_animation(false); 3928 layer->set_was_ever_ready_since_last_transform_animation(false);
3941 } 3929 }
3942 3930
3943 void LayerTreeHostImpl::SetTreeLayerScrollOffsetMutated( 3931 void LayerTreeHostImpl::SetTreeLayerScrollOffsetMutated(
3944 ElementId element_id, 3932 ElementId element_id,
3945 LayerTreeImpl* tree, 3933 LayerTreeImpl* tree,
3946 const gfx::ScrollOffset& scroll_offset) { 3934 const gfx::ScrollOffset& scroll_offset) {
3947 if (!tree) 3935 if (!tree)
3948 return; 3936 return;
3949 3937
3950 const int layer_id = tree->LayerIdByElementId(element_id); 3938 const int layer_id = tree->LayerIdByElementId(element_id);
3951 DCHECK(tree->property_trees()->IsInIdToIndexMap( 3939 DCHECK(tree->property_trees()->IsInIdToIndexMap(
3952 PropertyTrees::TreeType::TRANSFORM, layer_id));
3953 DCHECK(tree->property_trees()->IsInIdToIndexMap(
3954 PropertyTrees::TreeType::SCROLL, layer_id)); 3940 PropertyTrees::TreeType::SCROLL, layer_id));
3955 const int transform_id = 3941 int transform_node_index =
3956 tree->property_trees()->transform_id_to_index_map[layer_id]; 3942 tree->property_trees()->element_id_to_transform_node_index[element_id];
3957 const int scroll_id = 3943 // TODO(wkorman): Build map from element id to scroll node in property tree
3944 // builder and make use of it below.
3945 const int scroll_node_index =
3958 tree->property_trees()->scroll_id_to_index_map[layer_id]; 3946 tree->property_trees()->scroll_id_to_index_map[layer_id];
3959 if (transform_id != TransformTree::kInvalidNodeId && 3947 if (scroll_node_index != ScrollTree::kInvalidNodeId) {
3960 scroll_id != ScrollTree::kInvalidNodeId) {
3961 tree->property_trees()->scroll_tree.OnScrollOffsetAnimated( 3948 tree->property_trees()->scroll_tree.OnScrollOffsetAnimated(
3962 layer_id, transform_id, scroll_id, scroll_offset, tree); 3949 layer_id, transform_node_index, scroll_node_index, scroll_offset, tree);
3963 // Run mutation callbacks to respond to updated scroll offset. 3950 // Run mutation callbacks to respond to updated scroll offset.
3964 Mutate(CurrentBeginFrameArgs().frame_time); 3951 Mutate(CurrentBeginFrameArgs().frame_time);
3965 } 3952 }
3966 } 3953 }
3967 3954
3968 bool LayerTreeHostImpl::AnimationsPreserveAxisAlignment( 3955 bool LayerTreeHostImpl::AnimationsPreserveAxisAlignment(
3969 const LayerImpl* layer) const { 3956 const LayerImpl* layer) const {
3970 return mutator_host_->AnimationsPreserveAxisAlignment(layer->element_id()); 3957 return mutator_host_->AnimationsPreserveAxisAlignment(layer->element_id());
3971 } 3958 }
3972 3959
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
4092 worker_context_visibility_ = 4079 worker_context_visibility_ =
4093 worker_context->CacheController()->ClientBecameVisible(); 4080 worker_context->CacheController()->ClientBecameVisible();
4094 } else { 4081 } else {
4095 worker_context->CacheController()->ClientBecameNotVisible( 4082 worker_context->CacheController()->ClientBecameNotVisible(
4096 std::move(worker_context_visibility_)); 4083 std::move(worker_context_visibility_));
4097 } 4084 }
4098 } 4085 }
4099 } 4086 }
4100 4087
4101 } // namespace cc 4088 } // namespace cc
OLDNEW
« 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