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

Unified Diff: cc/trees/layer_tree_host_common.cc

Issue 13939005: cc: Add strict layer property change checking and handle bounds changes during paint. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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
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 aa9ad5e57255c40ffad3c20b50bf134c9416d9cb..a0bc6cc4d232a323ab27ce63ecef3489d50f1d7e 100644
--- a/cc/trees/layer_tree_host_common.cc
+++ b/cc/trees/layer_tree_host_common.cc
@@ -268,6 +268,17 @@ static inline void UpdateTilePrioritiesForLayer(LayerImpl* layer) {
static inline void UpdateTilePrioritiesForLayer(Layer* layer) {}
+static inline void PrepareToUpdateLayer(LayerImpl* layer) {}
+
+static inline void PrepareToUpdateLayer(Layer* layer) {
+ layer->PrepareToUpdate();
+
+ if (layer->mask_layer())
+ layer->mask_layer()->PrepareToUpdate();
+ if (layer->replica_layer() && layer->replica_layer()->mask_layer())
+ layer->replica_layer()->mask_layer()->PrepareToUpdate();
+}
+
template <typename LayerType>
static bool SubtreeShouldRenderToSeparateSurface(
LayerType* layer,
@@ -767,7 +778,8 @@ static void CalculateDrawPropertiesInternal(
float page_scale_factor,
bool subtree_can_use_lcd_text,
gfx::Rect* drawable_content_rect_of_subtree,
- bool update_tile_priorities) {
+ bool update_tile_priorities,
+ bool prepare_to_update) {
// This function computes the new matrix transformations recursively for this
// layer and all its descendants. It also computes the appropriate render
// surfaces.
@@ -1246,7 +1258,8 @@ static void CalculateDrawPropertiesInternal(
page_scale_factor,
subtree_can_use_lcd_text,
&drawable_content_rect_of_child_subtree,
- update_tile_priorities);
+ update_tile_priorities,
+ prepare_to_update);
if (!drawable_content_rect_of_child_subtree.IsEmpty()) {
accumulated_drawable_content_rect_of_children.Union(
drawable_content_rect_of_child_subtree);
@@ -1409,6 +1422,9 @@ static void CalculateDrawPropertiesInternal(
layer->render_target()->render_surface()->
AddContributingDelegatedRenderPassLayer(layer);
}
+
+ if (prepare_to_update)
+ PrepareToUpdateLayer(layer);
}
void LayerTreeHostCommon::CalculateDrawProperties(
@@ -1430,6 +1446,7 @@ void LayerTreeHostCommon::CalculateDrawProperties(
bool subtree_should_be_clipped = true;
gfx::Rect device_viewport_rect(device_viewport_size);
bool update_tile_priorities = false;
+ bool prepare_to_update = true;
// This function should have received a root layer.
DCHECK(IsRootLayer(root_layer));
@@ -1454,7 +1471,8 @@ void LayerTreeHostCommon::CalculateDrawProperties(
page_scale_factor,
can_use_lcd_text,
&total_drawable_content_rect,
- update_tile_priorities);
+ update_tile_priorities,
+ prepare_to_update);
// The dummy layer list should not have been used.
DCHECK_EQ(0u, dummy_layer_list.size());
@@ -1483,6 +1501,7 @@ void LayerTreeHostCommon::CalculateDrawProperties(
// initial clip rect.
bool subtree_should_be_clipped = true;
gfx::Rect device_viewport_rect(device_viewport_size);
+ bool prepare_to_update = false;
// This function should have received a root layer.
DCHECK(IsRootLayer(root_layer));
@@ -1508,7 +1527,8 @@ void LayerTreeHostCommon::CalculateDrawProperties(
page_scale_factor,
can_use_lcd_text,
&total_drawable_content_rect,
- update_tile_priorities);
+ update_tile_priorities,
+ prepare_to_update);
// The dummy layer list should not have been used.
DCHECK_EQ(0u, dummy_layer_list.size());

Powered by Google App Engine
This is Rietveld 408576698