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

Side by Side 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, 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 unified diff | Download patch
« no previous file with comments | « cc/trees/layer_tree_host_unittest.cc ('k') | 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_impl.h" 5 #include "cc/trees/layer_tree_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 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 598
599 void LayerTreeImpl::UpdatePropertyTreeScrollingAndAnimationFromMainThread() { 599 void LayerTreeImpl::UpdatePropertyTreeScrollingAndAnimationFromMainThread() {
600 // TODO(enne): This should get replaced by pulling out scrolling and 600 // TODO(enne): This should get replaced by pulling out scrolling and
601 // animations into their own trees. Then scrolls and animations would have 601 // animations into their own trees. Then scrolls and animations would have
602 // their own ways of synchronizing across commits. This occurs to push 602 // their own ways of synchronizing across commits. This occurs to push
603 // updates from scrolling deltas on the compositor thread that have occurred 603 // updates from scrolling deltas on the compositor thread that have occurred
604 // after begin frame and updates from animations that have ticked since begin 604 // after begin frame and updates from animations that have ticked since begin
605 // frame to a newly-committed property tree. 605 // frame to a newly-committed property tree.
606 if (layer_list_.empty()) 606 if (layer_list_.empty())
607 return; 607 return;
608 std::vector<int> layer_ids_to_remove;
608 for (auto& layer_id_to_opacity : opacity_animations_map_) { 609 for (auto& layer_id_to_opacity : opacity_animations_map_) {
609 const int id = layer_id_to_opacity.first; 610 const int id = layer_id_to_opacity.first;
610 if (property_trees_.IsInIdToIndexMap(PropertyTrees::TreeType::EFFECT, id)) { 611 if (property_trees_.IsInIdToIndexMap(PropertyTrees::TreeType::EFFECT, id)) {
611 EffectNode* node = property_trees_.effect_tree.Node( 612 EffectNode* node = property_trees_.effect_tree.Node(
612 property_trees_.effect_id_to_index_map[id]); 613 property_trees_.effect_id_to_index_map[id]);
613 if (!node->data.is_currently_animating_opacity || 614 if (!node->data.is_currently_animating_opacity ||
614 node->data.opacity == layer_id_to_opacity.second) 615 node->data.opacity == layer_id_to_opacity.second) {
616 layer_ids_to_remove.push_back(id);
615 continue; 617 continue;
618 }
616 node->data.opacity = layer_id_to_opacity.second; 619 node->data.opacity = layer_id_to_opacity.second;
617 property_trees_.effect_tree.set_needs_update(true); 620 property_trees_.effect_tree.set_needs_update(true);
618 } 621 }
619 } 622 }
620 opacity_animations_map_.clear(); 623 for (auto id : layer_ids_to_remove)
624 opacity_animations_map_.erase(id);
625 layer_ids_to_remove.clear();
621 626
622 for (auto& layer_id_to_transform : transform_animations_map_) { 627 for (auto& layer_id_to_transform : transform_animations_map_) {
623 const int id = layer_id_to_transform.first; 628 const int id = layer_id_to_transform.first;
624 if (property_trees_.IsInIdToIndexMap(PropertyTrees::TreeType::TRANSFORM, 629 if (property_trees_.IsInIdToIndexMap(PropertyTrees::TreeType::TRANSFORM,
625 id)) { 630 id)) {
626 TransformNode* node = property_trees_.transform_tree.Node( 631 TransformNode* node = property_trees_.transform_tree.Node(
627 property_trees_.transform_id_to_index_map[id]); 632 property_trees_.transform_id_to_index_map[id]);
628 if (!node->data.is_currently_animating || 633 if (!node->data.is_currently_animating ||
629 node->data.local == layer_id_to_transform.second) 634 node->data.local == layer_id_to_transform.second) {
635 layer_ids_to_remove.push_back(id);
630 continue; 636 continue;
637 }
631 node->data.local = layer_id_to_transform.second; 638 node->data.local = layer_id_to_transform.second;
632 node->data.needs_local_transform_update = true; 639 node->data.needs_local_transform_update = true;
633 property_trees_.transform_tree.set_needs_update(true); 640 property_trees_.transform_tree.set_needs_update(true);
634 } 641 }
635 } 642 }
636 transform_animations_map_.clear(); 643 for (auto id : layer_ids_to_remove)
644 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.
637 645
638 LayerTreeHostCommon::CallFunctionForEveryLayer(this, [](LayerImpl* layer) { 646 LayerTreeHostCommon::CallFunctionForEveryLayer(this, [](LayerImpl* layer) {
639 layer->UpdatePropertyTreeForScrollingAndAnimationIfNeeded(); 647 layer->UpdatePropertyTreeForScrollingAndAnimationIfNeeded();
640 }); 648 });
641 } 649 }
642 650
643 void LayerTreeImpl::SetPageScaleOnActiveTree(float active_page_scale) { 651 void LayerTreeImpl::SetPageScaleOnActiveTree(float active_page_scale) {
644 DCHECK(IsActiveTree()); 652 DCHECK(IsActiveTree());
645 if (page_scale_factor()->SetCurrent( 653 if (page_scale_factor()->SetCurrent(
646 ClampPageScaleFactorToLimits(active_page_scale))) { 654 ClampPageScaleFactorToLimits(active_page_scale))) {
(...skipping 1444 matching lines...) Expand 10 before | Expand all | Expand 10 after
2091 2099
2092 void LayerTreeImpl::ResetAllChangeTracking() { 2100 void LayerTreeImpl::ResetAllChangeTracking() {
2093 layers_that_should_push_properties_.clear(); 2101 layers_that_should_push_properties_.clear();
2094 // Iterate over all layers, including masks and replicas. 2102 // Iterate over all layers, including masks and replicas.
2095 for (auto& layer : *layers_) 2103 for (auto& layer : *layers_)
2096 layer->ResetChangeTracking(); 2104 layer->ResetChangeTracking();
2097 property_trees_.ResetAllChangeTracking(); 2105 property_trees_.ResetAllChangeTracking();
2098 } 2106 }
2099 2107
2100 } // namespace cc 2108 } // namespace cc
OLDNEW
« 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