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 655b4052a8b367f8383098c71a96960e13165a13..6532135f4de9775e8421b076f10bff3f6054a7b8 100644 |
--- a/cc/trees/layer_tree_host_common.cc |
+++ b/cc/trees/layer_tree_host_common.cc |
@@ -1129,6 +1129,45 @@ static inline typename LayerType::RenderSurfaceType* CreateOrReuseRenderSurface( |
return layer->render_surface(); |
} |
+template <typename LayerTypePtr> |
+static inline void MarkLayerWithRenderSurfaceLayerListId( |
+ LayerTypePtr layer, |
+ int current_render_surface_layer_list_id) { |
+ layer->draw_properties().last_valid_render_surface_layer_list_id = |
+ current_render_surface_layer_list_id; |
+ if (layer->mask_layer()) { |
+ layer->mask_layer() |
+ ->draw_properties() |
+ .last_valid_render_surface_layer_list_id = |
+ current_render_surface_layer_list_id; |
+ } |
+ if (layer->replica_layer()) { |
+ layer->replica_layer() |
+ ->draw_properties() |
+ .last_valid_render_surface_layer_list_id = |
+ current_render_surface_layer_list_id; |
+ if (layer->replica_layer()->mask_layer()) { |
+ layer->replica_layer() |
+ ->mask_layer() |
+ ->draw_properties() |
+ .last_valid_render_surface_layer_list_id = |
+ current_render_surface_layer_list_id; |
+ } |
+ } |
+} |
+ |
+template <typename LayerListType> |
+static inline void MarkLayerListWithRenderSurfaceLayerListId( |
+ LayerListType* layer_list, |
+ int current_render_surface_layer_list_id) { |
+ for (typename LayerListType::iterator it = layer_list->begin(); |
+ it != layer_list->end(); |
+ ++it) { |
+ MarkLayerWithRenderSurfaceLayerListId(*it, |
+ current_render_surface_layer_list_id); |
+ } |
+} |
+ |
template <typename LayerType> |
static inline void RemoveSurfaceForEarlyExit( |
LayerType* layer_to_remove, |
@@ -1142,9 +1181,15 @@ static inline void RemoveSurfaceForEarlyExit( |
// layers from the end of the list. |
while (render_surface_layer_list->back() != layer_to_remove) { |
render_surface_layer_list->back()->ClearRenderSurfaceLayerList(); |
+ MarkLayerListWithRenderSurfaceLayerListId( |
enne (OOO)
2014/05/06 21:10:27
This doesn't do anything. You're calling this aft
vmpstr
2014/05/06 22:38:53
Fixed.
|
+ &render_surface_layer_list->back()->render_surface()->layer_list(), 0); |
+ MarkLayerWithRenderSurfaceLayerListId(render_surface_layer_list->back(), 0); |
enne (OOO)
2014/05/06 21:10:27
Likewise, this.
vmpstr
2014/05/06 22:38:53
This marks the layer itself?
enne (OOO)
2014/05/07 00:12:11
Ok, I guess it's getting the mask and replica from
|
render_surface_layer_list->pop_back(); |
} |
DCHECK_EQ(render_surface_layer_list->back(), layer_to_remove); |
+ MarkLayerListWithRenderSurfaceLayerListId( |
enne (OOO)
2014/05/06 21:10:27
We will only get into this function if layer_to_re
vmpstr
2014/05/06 22:38:53
It doesn't have to be empty here, we also call thi
enne (OOO)
2014/05/07 00:12:11
Oh right, I forgot the clip case.
|
+ &layer_to_remove->render_surface()->layer_list(), 0); |
+ MarkLayerWithRenderSurfaceLayerListId(layer_to_remove, 0); |
enne (OOO)
2014/05/06 21:10:27
This should already be marked properly. The layer
|
render_surface_layer_list->pop_back(); |
layer_to_remove->ClearRenderSurfaceLayerList(); |
} |
@@ -1423,8 +1468,8 @@ static void CalculateDrawPropertiesInternal( |
const DataForRecursion<LayerType>& data_from_ancestor, |
typename LayerType::RenderSurfaceListType* render_surface_layer_list, |
typename LayerType::LayerListType* layer_list, |
- std::vector<AccumulatedSurfaceState<LayerType> >* |
- accumulated_surface_state) { |
+ std::vector<AccumulatedSurfaceState<LayerType> >* accumulated_surface_state, |
+ int current_render_surface_layer_list_id) { |
// This function computes the new matrix transformations recursively for this |
// layer and all its descendants. It also computes the appropriate render |
// surfaces. |
@@ -1935,6 +1980,8 @@ static void CalculateDrawPropertiesInternal( |
// cannot use LCD text. |
data_for_children.subtree_can_use_lcd_text = layer_can_use_lcd_text; |
+ MarkLayerWithRenderSurfaceLayerListId(layer, |
danakj
2014/05/06 21:02:36
We were discussing this and enne@ pointed out that
|
+ current_render_surface_layer_list_id); |
render_surface_layer_list->push_back(layer); |
} else { |
DCHECK(layer->parent()); |
@@ -2011,8 +2058,11 @@ static void CalculateDrawPropertiesInternal( |
// and should be included in the sorting process. |
size_t sorting_start_index = descendants.size(); |
- if (!LayerShouldBeSkipped(layer, layer_is_drawn)) |
+ if (!LayerShouldBeSkipped(layer, layer_is_drawn)) { |
+ MarkLayerWithRenderSurfaceLayerListId(layer, |
+ current_render_surface_layer_list_id); |
descendants.push_back(layer); |
+ } |
// Any layers that are appended after this point may need to be sorted if we |
// visit the children out of order. |
@@ -2072,15 +2122,23 @@ static void CalculateDrawPropertiesInternal( |
child->draw_properties().index_of_first_render_surface_layer_list_addition = |
render_surface_layer_list->size(); |
- CalculateDrawPropertiesInternal<LayerType>(child, |
- globals, |
- data_for_children, |
- render_surface_layer_list, |
- &descendants, |
- accumulated_surface_state); |
+ CalculateDrawPropertiesInternal<LayerType>( |
+ child, |
+ globals, |
+ data_for_children, |
+ render_surface_layer_list, |
+ &descendants, |
+ accumulated_surface_state, |
+ current_render_surface_layer_list_id); |
if (child->render_surface() && |
!child->render_surface()->layer_list().empty() && |
!child->render_surface()->content_rect().IsEmpty()) { |
+ // We don't need to mark this child with the draw properties id, since it |
+ // should've already been marked when it was pushed into the top level |
+ // render surface list. |
+ DCHECK(std::find(render_surface_layer_list->begin(), |
+ render_surface_layer_list->end(), |
+ child) != render_surface_layer_list->end()); |
descendants.push_back(child); |
} |
@@ -2328,12 +2386,14 @@ void LayerTreeHostCommon::CalculateDrawProperties( |
PreCalculateMetaInformationRecursiveData recursive_data; |
PreCalculateMetaInformation(inputs->root_layer, &recursive_data); |
std::vector<AccumulatedSurfaceState<Layer> > accumulated_surface_state; |
- CalculateDrawPropertiesInternal<Layer>(inputs->root_layer, |
- globals, |
- data_for_recursion, |
- inputs->render_surface_layer_list, |
- &dummy_layer_list, |
- &accumulated_surface_state); |
+ CalculateDrawPropertiesInternal<Layer>( |
+ inputs->root_layer, |
+ globals, |
+ data_for_recursion, |
+ inputs->render_surface_layer_list, |
+ &dummy_layer_list, |
+ &accumulated_surface_state, |
+ inputs->current_render_surface_layer_list_id); |
// The dummy layer list should not have been used. |
DCHECK_EQ(0u, dummy_layer_list.size()); |
@@ -2356,12 +2416,14 @@ void LayerTreeHostCommon::CalculateDrawProperties( |
PreCalculateMetaInformation(inputs->root_layer, &recursive_data); |
std::vector<AccumulatedSurfaceState<LayerImpl> > |
accumulated_surface_state; |
- CalculateDrawPropertiesInternal<LayerImpl>(inputs->root_layer, |
- globals, |
- data_for_recursion, |
- inputs->render_surface_layer_list, |
- &dummy_layer_list, |
- &accumulated_surface_state); |
+ CalculateDrawPropertiesInternal<LayerImpl>( |
+ inputs->root_layer, |
+ globals, |
+ data_for_recursion, |
+ inputs->render_surface_layer_list, |
+ &dummy_layer_list, |
+ &accumulated_surface_state, |
+ inputs->current_render_surface_layer_list_id); |
// The dummy layer list should not have been used. |
DCHECK_EQ(0u, dummy_layer_list.size()); |