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

Unified Diff: cc/trees/draw_property_utils.cc

Issue 1837343002: cc : Use effect tree to determine if a layer is a replica (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/draw_property_utils.cc
diff --git a/cc/trees/draw_property_utils.cc b/cc/trees/draw_property_utils.cc
index 15bdddc50616a8b104cbeaeb0b12e5710f4ff894..6e7422bc8b688332e04c02dc6b315db3b5e9a73f 100644
--- a/cc/trees/draw_property_utils.cc
+++ b/cc/trees/draw_property_utils.cc
@@ -12,6 +12,7 @@
#include "cc/layers/draw_properties.h"
#include "cc/layers/layer.h"
#include "cc/layers/layer_impl.h"
+#include "cc/trees/layer_tree_host.h"
#include "cc/trees/layer_tree_impl.h"
#include "cc/trees/property_tree.h"
#include "cc/trees/property_tree_builder.h"
@@ -31,6 +32,21 @@ static bool IsRootLayer(const LayerImpl* layer) {
return layer->layer_tree_impl()->IsRootLayer(layer);
}
+#if DCHECK_IS_ON()
+static Layer* EffectNodeOwner(Layer* layer) {
+ EffectNode* node =
+ layer->layer_tree_host()->property_trees()->effect_tree.Node(
+ layer->effect_tree_index());
+ return layer->layer_tree_host()->LayerById(node->owner_id);
+}
+
+static LayerImpl* EffectNodeOwner(LayerImpl* layer) {
+ EffectNode* node =
+ layer->layer_tree_impl()->property_trees()->effect_tree.Node(
+ layer->effect_tree_index());
+ return layer->layer_tree_impl()->LayerById(node->owner_id);
+}
+
template <typename LayerType>
static void ValidateRenderSurfaceForLayer(LayerType* layer) {
// This test verifies that there are no cases where a LayerImpl needs
@@ -41,7 +57,7 @@ static void ValidateRenderSurfaceForLayer(LayerType* layer) {
DCHECK(layer->filters().IsEmpty()) << "layer: " << layer->id();
DCHECK(layer->background_filters().IsEmpty()) << "layer: " << layer->id();
DCHECK(!IsRootLayer(layer)) << "layer: " << layer->id();
- if (layer->parent()->replica_layer() == layer)
+ if (EffectNodeOwner(layer)->replica_layer() == layer)
return;
DCHECK(!layer->mask_layer()) << "layer: " << layer->id();
DCHECK(!layer->replica_layer()) << "layer: " << layer->id();
@@ -54,6 +70,7 @@ static void ValidateRenderSurfacesRecursive(Layer* layer) {
for (size_t i = 0; i < layer->children().size(); ++i)
ValidateRenderSurfacesRecursive(layer->child_at(i));
}
+#endif
template <typename LayerType>
void CalculateVisibleRects(const std::vector<LayerType*>& visible_layer_list,
@@ -697,7 +714,9 @@ void BuildPropertyTreesAndComputeVisibleRects(
device_transform, property_trees);
UpdateRenderSurfacesForLayersRecursive(&property_trees->effect_tree,
root_layer);
+#if DCHECK_IS_ON()
ValidateRenderSurfacesRecursive(root_layer);
+#endif
ComputeVisibleRects(root_layer, property_trees,
can_render_to_separate_surface, update_layer_list);
}
@@ -742,8 +761,10 @@ void ComputeVisibleRects(LayerImpl* root_layer,
for (auto* layer : *root_layer->layer_tree_impl()) {
UpdateRenderSurfaceForLayer(&property_trees->effect_tree,
can_render_to_separate_surface, layer);
+#if DCHECK_IS_ON()
if (can_render_to_separate_surface)
ValidateRenderSurfaceForLayer(layer);
+#endif
}
LayerImplList update_layer_list;
ComputeVisibleRectsInternal(root_layer, property_trees,
« 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