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

Unified Diff: cc/trees/layer_tree_host_common.cc

Issue 1832663002: cc : Determine if a layer is root by using the value in LayerTreeImpl (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 | « cc/trees/draw_property_utils.cc ('k') | cc/trees/layer_tree_host_common_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_common.cc
diff --git a/cc/trees/layer_tree_host_common.cc b/cc/trees/layer_tree_host_common.cc
index 77b327b59b16814ecb6a4f7edc788ab83cb267f8..143969b8e50b1b50adf8e13934f8ae9e88a627e6 100644
--- a/cc/trees/layer_tree_host_common.cc
+++ b/cc/trees/layer_tree_host_common.cc
@@ -243,11 +243,14 @@ gfx::Rect LayerTreeHostCommon::CalculateVisibleRect(
target_surface_rect, layer_bound_rect, layer_in_surface_space, transform);
}
-template <typename LayerType>
-static inline bool IsRootLayer(LayerType* layer) {
+static inline bool IsRootLayer(const Layer* layer) {
return !layer->parent();
}
+static inline bool IsRootLayer(const LayerImpl* layer) {
+ return layer->layer_tree_impl()->IsRootLayer(layer);
+}
+
template <typename LayerType>
static inline bool LayerIsInExisting3DRenderingContext(LayerType* layer) {
return layer->Is3dSorted() && layer->parent() &&
@@ -321,7 +324,7 @@ static bool LayerShouldBeSkipped(LayerImpl* layer,
LayerImpl* backface_test_layer = layer;
if (layer->use_parent_backface_visibility()) {
- DCHECK(layer->parent());
+ DCHECK(!IsRootLayer(layer));
DCHECK(!layer->parent()->use_parent_backface_visibility());
backface_test_layer = layer->parent();
}
@@ -710,7 +713,7 @@ void CalculateRenderTarget(LayerImpl* layer,
layer;
} else {
- DCHECK(layer->parent());
+ DCHECK(!IsRootLayer(layer));
layer->draw_properties().render_target = layer->parent()->render_target();
}
« no previous file with comments | « cc/trees/draw_property_utils.cc ('k') | cc/trees/layer_tree_host_common_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698