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

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

Issue 2901393004: cc : Workaround for null layer impls and invalid property tree indices (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 | « 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 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
461 if (effect_node->has_render_surface && effect_node->subtree_has_copy_request) 470 if (effect_node->has_render_surface && effect_node->subtree_has_copy_request)
462 return false; 471 return false;
463 472
464 // If the layer transform is not invertible, it should be skipped. In case the 473 // If the layer transform is not invertible, it should be skipped. In case the
465 // transform is animating and singular, we should not skip it. 474 // transform is animating and singular, we should not skip it.
466 return !transform_node->node_and_ancestors_are_animated_or_invertible || 475 return !transform_node->node_and_ancestors_are_animated_or_invertible ||
467 effect_node->hidden_by_backface_visibility || !effect_node->is_drawn; 476 effect_node->hidden_by_backface_visibility || !effect_node->is_drawn;
468 } 477 }
469 478
470 template <typename LayerType> 479 template <typename LayerType>
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
836 } 845 }
837 } 846 }
838 847
839 void FindLayersThatNeedUpdates(LayerTreeImpl* layer_tree_impl, 848 void FindLayersThatNeedUpdates(LayerTreeImpl* layer_tree_impl,
840 const PropertyTrees* property_trees, 849 const PropertyTrees* property_trees,
841 std::vector<LayerImpl*>* visible_layer_list) { 850 std::vector<LayerImpl*>* visible_layer_list) {
842 const TransformTree& transform_tree = property_trees->transform_tree; 851 const TransformTree& transform_tree = property_trees->transform_tree;
843 const EffectTree& effect_tree = property_trees->effect_tree; 852 const EffectTree& effect_tree = property_trees->effect_tree;
844 853
845 for (auto* layer_impl : *layer_tree_impl) { 854 for (auto* layer_impl : *layer_tree_impl) {
855 DCHECK(layer_impl);
856 DCHECK(layer_impl->layer_tree_impl());
857 // 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
859 // removed as layer_impl should not be nullptr here.
860 if (!layer_impl)
861 continue;
846 if (!IsRootLayer(layer_impl) && 862 if (!IsRootLayer(layer_impl) &&
847 LayerShouldBeSkippedForDrawPropertiesComputation( 863 LayerShouldBeSkippedForDrawPropertiesComputation(
848 layer_impl, transform_tree, effect_tree)) 864 layer_impl, transform_tree, effect_tree))
849 continue; 865 continue;
850 866
851 bool layer_is_drawn = 867 bool layer_is_drawn =
852 effect_tree.Node(layer_impl->effect_tree_index())->is_drawn; 868 effect_tree.Node(layer_impl->effect_tree_index())->is_drawn;
853 869
854 if (LayerNeedsUpdate(layer_impl, layer_is_drawn, property_trees)) 870 if (LayerNeedsUpdate(layer_impl, layer_is_drawn, property_trees))
855 visible_layer_list->push_back(layer_impl); 871 visible_layer_list->push_back(layer_impl);
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
1070 void UpdateElasticOverscroll(PropertyTrees* property_trees, 1086 void UpdateElasticOverscroll(PropertyTrees* property_trees,
1071 const Layer* overscroll_elasticity_layer, 1087 const Layer* overscroll_elasticity_layer,
1072 const gfx::Vector2dF& elastic_overscroll) { 1088 const gfx::Vector2dF& elastic_overscroll) {
1073 UpdateElasticOverscrollInternal(property_trees, overscroll_elasticity_layer, 1089 UpdateElasticOverscrollInternal(property_trees, overscroll_elasticity_layer,
1074 elastic_overscroll); 1090 elastic_overscroll);
1075 } 1091 }
1076 1092
1077 } // namespace draw_property_utils 1093 } // namespace draw_property_utils
1078 1094
1079 } // namespace cc 1095 } // 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