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

Unified Diff: cc/trees/layer_tree_impl.cc

Issue 2105173006: cc: Clear entries from animations maps only when main thread wins (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: "DCHECK" Created 4 years, 6 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 | « cc/trees/layer_tree_host_unittest.cc ('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_impl.cc
diff --git a/cc/trees/layer_tree_impl.cc b/cc/trees/layer_tree_impl.cc
index 0adf8745e1a6e80207f614dd9b878cbd973c8794..b8113c858598dbddb909a7b9572b21092b260217 100644
--- a/cc/trees/layer_tree_impl.cc
+++ b/cc/trees/layer_tree_impl.cc
@@ -605,19 +605,24 @@ void LayerTreeImpl::UpdatePropertyTreeScrollingAndAnimationFromMainThread() {
// frame to a newly-committed property tree.
if (layer_list_.empty())
return;
+ std::vector<int> layer_ids_to_remove;
for (auto& layer_id_to_opacity : opacity_animations_map_) {
const int id = layer_id_to_opacity.first;
if (property_trees_.IsInIdToIndexMap(PropertyTrees::TreeType::EFFECT, id)) {
EffectNode* node = property_trees_.effect_tree.Node(
property_trees_.effect_id_to_index_map[id]);
if (!node->data.is_currently_animating_opacity ||
- node->data.opacity == layer_id_to_opacity.second)
+ node->data.opacity == layer_id_to_opacity.second) {
+ layer_ids_to_remove.push_back(id);
continue;
+ }
node->data.opacity = layer_id_to_opacity.second;
property_trees_.effect_tree.set_needs_update(true);
}
}
- opacity_animations_map_.clear();
+ for (auto id : layer_ids_to_remove)
+ opacity_animations_map_.erase(id);
+ layer_ids_to_remove.clear();
for (auto& layer_id_to_transform : transform_animations_map_) {
const int id = layer_id_to_transform.first;
@@ -626,14 +631,17 @@ void LayerTreeImpl::UpdatePropertyTreeScrollingAndAnimationFromMainThread() {
TransformNode* node = property_trees_.transform_tree.Node(
property_trees_.transform_id_to_index_map[id]);
if (!node->data.is_currently_animating ||
- node->data.local == layer_id_to_transform.second)
+ node->data.local == layer_id_to_transform.second) {
+ layer_ids_to_remove.push_back(id);
continue;
+ }
node->data.local = layer_id_to_transform.second;
node->data.needs_local_transform_update = true;
property_trees_.transform_tree.set_needs_update(true);
}
}
- transform_animations_map_.clear();
+ for (auto id : layer_ids_to_remove)
+ transform_animations_map_.erase(id);
jaydasika 2016/06/30 00:26:39 Just realized map entries should be erased in Remo
jaydasika 2016/06/30 18:52:00 Done.
LayerTreeHostCommon::CallFunctionForEveryLayer(this, [](LayerImpl* layer) {
layer->UpdatePropertyTreeForScrollingAndAnimationIfNeeded();
« no previous file with comments | « cc/trees/layer_tree_host_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698