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

Side by Side Diff: cc/trees/layer_tree_host_impl.cc

Issue 2762123004: cc: LayerTreeHostImpl uses element id to tick animations (Closed)
Patch Set: review comments Created 3 years, 8 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 | « cc/trees/layer_tree_host_impl.h ('k') | cc/trees/layer_tree_host_unittest.cc » ('j') | 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 4000 matching lines...) Expand 10 before | Expand all | Expand 10 after
4011 return true; 4011 return true;
4012 4012
4013 return false; 4013 return false;
4014 } 4014 }
4015 } 4015 }
4016 4016
4017 void LayerTreeHostImpl::SetMutatorsNeedCommit() {} 4017 void LayerTreeHostImpl::SetMutatorsNeedCommit() {}
4018 4018
4019 void LayerTreeHostImpl::SetMutatorsNeedRebuildPropertyTrees() {} 4019 void LayerTreeHostImpl::SetMutatorsNeedRebuildPropertyTrees() {}
4020 4020
4021 void LayerTreeHostImpl::SetTreeLayerFilterMutated(
4022 ElementId element_id,
4023 LayerTreeImpl* tree,
4024 const FilterOperations& filters) {
4025 if (!tree)
4026 return;
4027
4028 PropertyTrees* property_trees = tree->property_trees();
4029 DCHECK_EQ(1u,
4030 property_trees->element_id_to_effect_node_index.count(element_id));
4031 const int effect_node_index =
4032 property_trees->element_id_to_effect_node_index[element_id];
4033 property_trees->effect_tree.OnFilterAnimated(filters, effect_node_index,
4034 tree);
4035 }
4036
4037 void LayerTreeHostImpl::SetTreeLayerOpacityMutated(ElementId element_id,
4038 LayerTreeImpl* tree,
4039 float opacity) {
4040 if (!tree)
4041 return;
4042
4043 PropertyTrees* property_trees = tree->property_trees();
4044 DCHECK_EQ(1u,
4045 property_trees->element_id_to_effect_node_index.count(element_id));
4046 const int effect_node_index =
4047 property_trees->element_id_to_effect_node_index[element_id];
weiliangc 2017/03/31 21:04:23 I think this line from before this CL is how crbug
4048 property_trees->effect_tree.OnOpacityAnimated(opacity, effect_node_index,
4049 tree);
4050 }
4051
4052 void LayerTreeHostImpl::SetTreeLayerTransformMutated(
4053 ElementId element_id,
4054 LayerTreeImpl* tree,
4055 const gfx::Transform& transform) {
4056 if (!tree)
4057 return;
4058
4059 PropertyTrees* property_trees = tree->property_trees();
4060 DCHECK_EQ(
4061 1u, property_trees->element_id_to_transform_node_index.count(element_id));
4062 const int transform_node_index =
4063 property_trees->element_id_to_transform_node_index[element_id];
4064 property_trees->transform_tree.OnTransformAnimated(
4065 transform, transform_node_index, tree);
4066 if (LayerImpl* layer = tree->LayerByElementId(element_id))
4067 layer->set_was_ever_ready_since_last_transform_animation(false);
4068 }
4069
4070 void LayerTreeHostImpl::SetTreeLayerScrollOffsetMutated( 4021 void LayerTreeHostImpl::SetTreeLayerScrollOffsetMutated(
4071 ElementId element_id, 4022 ElementId element_id,
4072 LayerTreeImpl* tree, 4023 LayerTreeImpl* tree,
4073 const gfx::ScrollOffset& scroll_offset) { 4024 const gfx::ScrollOffset& scroll_offset) {
4074 if (!tree) 4025 if (!tree)
4075 return; 4026 return;
4076 4027
4077 const int layer_id = tree->LayerIdByElementId(element_id); 4028 const int layer_id = tree->LayerIdByElementId(element_id);
4078 PropertyTrees* property_trees = tree->property_trees(); 4029 PropertyTrees* property_trees = tree->property_trees();
4079 DCHECK_EQ(1u, 4030 DCHECK_EQ(1u,
(...skipping 13 matching lines...) Expand all
4093 4044
4094 void LayerTreeHostImpl::SetNeedUpdateGpuRasterizationStatus() { 4045 void LayerTreeHostImpl::SetNeedUpdateGpuRasterizationStatus() {
4095 need_update_gpu_rasterization_status_ = true; 4046 need_update_gpu_rasterization_status_ = true;
4096 } 4047 }
4097 4048
4098 void LayerTreeHostImpl::SetElementFilterMutated( 4049 void LayerTreeHostImpl::SetElementFilterMutated(
4099 ElementId element_id, 4050 ElementId element_id,
4100 ElementListType list_type, 4051 ElementListType list_type,
4101 const FilterOperations& filters) { 4052 const FilterOperations& filters) {
4102 if (list_type == ElementListType::ACTIVE) { 4053 if (list_type == ElementListType::ACTIVE) {
4103 SetTreeLayerFilterMutated(element_id, active_tree(), filters); 4054 active_tree()->SetFilterMutated(element_id, filters);
4104 } else { 4055 } else {
4105 SetTreeLayerFilterMutated(element_id, pending_tree(), filters); 4056 if (pending_tree())
4106 SetTreeLayerFilterMutated(element_id, recycle_tree(), filters); 4057 pending_tree()->SetFilterMutated(element_id, filters);
4058 if (recycle_tree())
4059 recycle_tree()->SetFilterMutated(element_id, filters);
4107 } 4060 }
4108 } 4061 }
4109 4062
4110 void LayerTreeHostImpl::SetElementOpacityMutated(ElementId element_id, 4063 void LayerTreeHostImpl::SetElementOpacityMutated(ElementId element_id,
4111 ElementListType list_type, 4064 ElementListType list_type,
4112 float opacity) { 4065 float opacity) {
4113 if (list_type == ElementListType::ACTIVE) { 4066 if (list_type == ElementListType::ACTIVE) {
4114 SetTreeLayerOpacityMutated(element_id, active_tree(), opacity); 4067 active_tree()->SetOpacityMutated(element_id, opacity);
4115 } else { 4068 } else {
4116 SetTreeLayerOpacityMutated(element_id, pending_tree(), opacity); 4069 if (pending_tree())
4117 SetTreeLayerOpacityMutated(element_id, recycle_tree(), opacity); 4070 pending_tree()->SetOpacityMutated(element_id, opacity);
4071 if (recycle_tree())
4072 recycle_tree()->SetOpacityMutated(element_id, opacity);
4118 } 4073 }
4119 } 4074 }
4120 4075
4121 void LayerTreeHostImpl::SetElementTransformMutated( 4076 void LayerTreeHostImpl::SetElementTransformMutated(
4122 ElementId element_id, 4077 ElementId element_id,
4123 ElementListType list_type, 4078 ElementListType list_type,
4124 const gfx::Transform& transform) { 4079 const gfx::Transform& transform) {
4125 if (list_type == ElementListType::ACTIVE) { 4080 if (list_type == ElementListType::ACTIVE) {
4126 SetTreeLayerTransformMutated(element_id, active_tree(), transform); 4081 active_tree()->SetTransformMutated(element_id, transform);
4127 } else { 4082 } else {
4128 SetTreeLayerTransformMutated(element_id, pending_tree(), transform); 4083 if (pending_tree())
4129 SetTreeLayerTransformMutated(element_id, recycle_tree(), transform); 4084 pending_tree()->SetTransformMutated(element_id, transform);
4085 if (recycle_tree())
4086 recycle_tree()->SetTransformMutated(element_id, transform);
4130 } 4087 }
4131 } 4088 }
4132 4089
4133 void LayerTreeHostImpl::SetElementScrollOffsetMutated( 4090 void LayerTreeHostImpl::SetElementScrollOffsetMutated(
4134 ElementId element_id, 4091 ElementId element_id,
4135 ElementListType list_type, 4092 ElementListType list_type,
4136 const gfx::ScrollOffset& scroll_offset) { 4093 const gfx::ScrollOffset& scroll_offset) {
4137 if (list_type == ElementListType::ACTIVE) { 4094 if (list_type == ElementListType::ACTIVE) {
4138 SetTreeLayerScrollOffsetMutated(element_id, active_tree(), scroll_offset); 4095 SetTreeLayerScrollOffsetMutated(element_id, active_tree(), scroll_offset);
4139 } else { 4096 } else {
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
4275 worker_context_visibility_ = 4232 worker_context_visibility_ =
4276 worker_context->CacheController()->ClientBecameVisible(); 4233 worker_context->CacheController()->ClientBecameVisible();
4277 } else { 4234 } else {
4278 worker_context->CacheController()->ClientBecameNotVisible( 4235 worker_context->CacheController()->ClientBecameNotVisible(
4279 std::move(worker_context_visibility_)); 4236 std::move(worker_context_visibility_));
4280 } 4237 }
4281 } 4238 }
4282 } 4239 }
4283 4240
4284 } // namespace cc 4241 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | cc/trees/layer_tree_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698