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

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

Issue 2915653002: 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 && 470 if (effect_node->has_render_surface &&
462 effect_node->num_copy_requests_in_subtree > 0) 471 effect_node->num_copy_requests_in_subtree > 0)
463 return false; 472 return false;
473
464 // If the layer transform is not invertible, it should be skipped. 474 // If the layer transform is not invertible, it should be skipped.
465 // TODO(ajuma): Correctly process subtrees with singular transform for the 475 // TODO(ajuma): Correctly process subtrees with singular transform for the
466 // case where we may animate to a non-singular transform and wish to 476 // case where we may animate to a non-singular transform and wish to
467 // pre-raster. 477 // pre-raster.
468 return !transform_node->node_and_ancestors_are_animated_or_invertible || 478 return !transform_node->node_and_ancestors_are_animated_or_invertible ||
469 effect_node->hidden_by_backface_visibility || !effect_node->is_drawn; 479 effect_node->hidden_by_backface_visibility || !effect_node->is_drawn;
470 } 480 }
471 481
472 template <typename LayerType> 482 template <typename LayerType>
473 static void UpdateElasticOverscrollInternal( 483 static void UpdateElasticOverscrollInternal(
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
844 } 854 }
845 } 855 }
846 856
847 void FindLayersThatNeedUpdates(LayerTreeImpl* layer_tree_impl, 857 void FindLayersThatNeedUpdates(LayerTreeImpl* layer_tree_impl,
848 const PropertyTrees* property_trees, 858 const PropertyTrees* property_trees,
849 std::vector<LayerImpl*>* visible_layer_list) { 859 std::vector<LayerImpl*>* visible_layer_list) {
850 const TransformTree& transform_tree = property_trees->transform_tree; 860 const TransformTree& transform_tree = property_trees->transform_tree;
851 const EffectTree& effect_tree = property_trees->effect_tree; 861 const EffectTree& effect_tree = property_trees->effect_tree;
852 862
853 for (auto* layer_impl : *layer_tree_impl) { 863 for (auto* layer_impl : *layer_tree_impl) {
864 DCHECK(layer_impl);
865 DCHECK(layer_impl->layer_tree_impl());
866 // TODO(crbug.com/726423) : This is a workaround for crbug.com/725851 to
867 // avoid crashing when layer_impl is nullptr. This workaround should be
868 // removed as layer_impl should not be nullptr here.
869 if (!layer_impl)
870 continue;
854 if (!IsRootLayer(layer_impl) && 871 if (!IsRootLayer(layer_impl) &&
855 LayerShouldBeSkipped(layer_impl, transform_tree, effect_tree)) 872 LayerShouldBeSkipped(layer_impl, transform_tree, effect_tree))
856 continue; 873 continue;
857 874
858 bool layer_is_drawn = 875 bool layer_is_drawn =
859 effect_tree.Node(layer_impl->effect_tree_index())->is_drawn; 876 effect_tree.Node(layer_impl->effect_tree_index())->is_drawn;
860 877
861 if (LayerNeedsUpdate(layer_impl, layer_is_drawn, property_trees)) 878 if (LayerNeedsUpdate(layer_impl, layer_is_drawn, property_trees))
862 visible_layer_list->push_back(layer_impl); 879 visible_layer_list->push_back(layer_impl);
863 } 880 }
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
1096 void UpdateElasticOverscroll(PropertyTrees* property_trees, 1113 void UpdateElasticOverscroll(PropertyTrees* property_trees,
1097 const Layer* overscroll_elasticity_layer, 1114 const Layer* overscroll_elasticity_layer,
1098 const gfx::Vector2dF& elastic_overscroll) { 1115 const gfx::Vector2dF& elastic_overscroll) {
1099 UpdateElasticOverscrollInternal(property_trees, overscroll_elasticity_layer, 1116 UpdateElasticOverscrollInternal(property_trees, overscroll_elasticity_layer,
1100 elastic_overscroll); 1117 elastic_overscroll);
1101 } 1118 }
1102 1119
1103 } // namespace draw_property_utils 1120 } // namespace draw_property_utils
1104 1121
1105 } // namespace cc 1122 } // 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