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

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

Issue 2918163002: cc: Workaround invalid property tree state on Layers. (Closed)
Patch Set: .. Created 3 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 unified diff | Download patch
« no previous file with comments | « cc/layers/layer_impl.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/draw_property_utils.h" 5 #include "cc/trees/draw_property_utils.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 451
452 template <typename LayerType> 452 template <typename LayerType>
453 static inline bool LayerShouldBeSkippedInternal( 453 static inline bool LayerShouldBeSkippedInternal(
454 LayerType* layer, 454 LayerType* layer,
455 const TransformTree& transform_tree, 455 const TransformTree& transform_tree,
456 const EffectTree& effect_tree) { 456 const EffectTree& effect_tree) {
457 const TransformNode* transform_node = 457 const TransformNode* transform_node =
458 transform_tree.Node(layer->transform_tree_index()); 458 transform_tree.Node(layer->transform_tree_index());
459 const EffectNode* effect_node = effect_tree.Node(layer->effect_tree_index()); 459 const EffectNode* effect_node = effect_tree.Node(layer->effect_tree_index());
460 460
461 DCHECK(effect_node);
462 DCHECK(transform_node);
463 // TODO(crbug.com/726423) : This is a workaround for crbug.com/726225 to
464 // avoid crashing when there is no effect or transform node. Effect node and
465 // transform node should always exist here and this workaround should be
466 // removed.
467 if (!transform_node || !effect_node)
468 return true;
469
470 if (effect_node->has_render_surface && effect_node->subtree_has_copy_request) 461 if (effect_node->has_render_surface && effect_node->subtree_has_copy_request)
471 return false; 462 return false;
472 463
473 // If the layer transform is not invertible, it should be skipped. In case the 464 // If the layer transform is not invertible, it should be skipped. In case the
474 // transform is animating and singular, we should not skip it. 465 // transform is animating and singular, we should not skip it.
475 return !transform_node->node_and_ancestors_are_animated_or_invertible || 466 return !transform_node->node_and_ancestors_are_animated_or_invertible ||
476 effect_node->hidden_by_backface_visibility || !effect_node->is_drawn; 467 effect_node->hidden_by_backface_visibility || !effect_node->is_drawn;
477 } 468 }
478 469
479 template <typename LayerType> 470 template <typename LayerType>
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
850 std::vector<LayerImpl*>* visible_layer_list) { 841 std::vector<LayerImpl*>* visible_layer_list) {
851 const TransformTree& transform_tree = property_trees->transform_tree; 842 const TransformTree& transform_tree = property_trees->transform_tree;
852 const EffectTree& effect_tree = property_trees->effect_tree; 843 const EffectTree& effect_tree = property_trees->effect_tree;
853 844
854 for (auto* layer_impl : *layer_tree_impl) { 845 for (auto* layer_impl : *layer_tree_impl) {
855 DCHECK(layer_impl); 846 DCHECK(layer_impl);
856 DCHECK(layer_impl->layer_tree_impl()); 847 DCHECK(layer_impl->layer_tree_impl());
857 // TODO(crbug.com/726423) : This is a workaround for crbug.com/725851 to 848 // TODO(crbug.com/726423) : This is a workaround for crbug.com/725851 to
858 // avoid crashing when layer_impl is nullptr. This workaround should be 849 // avoid crashing when layer_impl is nullptr. This workaround should be
859 // removed as layer_impl should not be nullptr here. 850 // removed as layer_impl should not be nullptr here.
860 if (!layer_impl) 851 if (!layer_impl || !layer_impl->HasValidPropertyTreeIndices())
861 continue; 852 continue;
862 if (!IsRootLayer(layer_impl) && 853 if (!IsRootLayer(layer_impl) &&
863 LayerShouldBeSkippedForDrawPropertiesComputation( 854 LayerShouldBeSkippedForDrawPropertiesComputation(
864 layer_impl, transform_tree, effect_tree)) 855 layer_impl, transform_tree, effect_tree))
865 continue; 856 continue;
866 857
867 bool layer_is_drawn = 858 bool layer_is_drawn =
868 effect_tree.Node(layer_impl->effect_tree_index())->is_drawn; 859 effect_tree.Node(layer_impl->effect_tree_index())->is_drawn;
869 860
870 if (LayerNeedsUpdate(layer_impl, layer_is_drawn, property_trees)) 861 if (LayerNeedsUpdate(layer_impl, layer_is_drawn, property_trees))
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
1086 void UpdateElasticOverscroll(PropertyTrees* property_trees, 1077 void UpdateElasticOverscroll(PropertyTrees* property_trees,
1087 const Layer* overscroll_elasticity_layer, 1078 const Layer* overscroll_elasticity_layer,
1088 const gfx::Vector2dF& elastic_overscroll) { 1079 const gfx::Vector2dF& elastic_overscroll) {
1089 UpdateElasticOverscrollInternal(property_trees, overscroll_elasticity_layer, 1080 UpdateElasticOverscrollInternal(property_trees, overscroll_elasticity_layer,
1090 elastic_overscroll); 1081 elastic_overscroll);
1091 } 1082 }
1092 1083
1093 } // namespace draw_property_utils 1084 } // namespace draw_property_utils
1094 1085
1095 } // namespace cc 1086 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698