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

Unified Diff: cc/trees/layer_tree_host_common.cc

Issue 265883013: cc: Add a flag to layers that returns true if the layer is in RSLL. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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/layer_tree_host_common.h ('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 655b4052a8b367f8383098c71a96960e13165a13..cb9f5212bf40ff8662fd782014b4c1d5856abba7 100644
--- a/cc/trees/layer_tree_host_common.cc
+++ b/cc/trees/layer_tree_host_common.cc
@@ -1129,6 +1129,39 @@ 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()->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,
@@ -1141,10 +1174,17 @@ static inline void RemoveSurfaceForEarlyExit(
// things to crash. So here we proactively remove any additional
// layers from the end of the list.
while (render_surface_layer_list->back() != layer_to_remove) {
+ MarkLayerListWithRenderSurfaceLayerListId(
+ &render_surface_layer_list->back()->render_surface()->layer_list(), 0);
+ MarkLayerWithRenderSurfaceLayerListId(render_surface_layer_list->back(), 0);
+
render_surface_layer_list->back()->ClearRenderSurfaceLayerList();
render_surface_layer_list->pop_back();
}
DCHECK_EQ(render_surface_layer_list->back(), layer_to_remove);
+ MarkLayerListWithRenderSurfaceLayerListId(
+ &layer_to_remove->render_surface()->layer_list(), 0);
+ MarkLayerWithRenderSurfaceLayerListId(layer_to_remove, 0);
render_surface_layer_list->pop_back();
layer_to_remove->ClearRenderSurfaceLayerList();
}
@@ -1423,8 +1463,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.
@@ -1934,7 +1974,6 @@ static void CalculateDrawPropertiesInternal(
// translation then the subtree that gets drawn on this render surface
// cannot use LCD text.
data_for_children.subtree_can_use_lcd_text = layer_can_use_lcd_text;
-
danakj 2014/05/06 22:48:02 nit: keep this whitespace i guess, separates it fr
vmpstr 2014/05/06 23:24:46 Done.
render_surface_layer_list->push_back(layer);
} else {
DCHECK(layer->parent());
@@ -2011,8 +2050,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 +2114,29 @@ 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()) {
+ // This child will contribute its render surface, which means
+ // we need to mark just the mask layer (and replica mask layer)
+ // with the id.
+ if (child->mask_layer()) {
+ MarkLayerWithRenderSurfaceLayerListId(
+ child->mask_layer(), current_render_surface_layer_list_id);
+ }
+ if (child->replica_layer() && child->replica_layer()->mask_layer()) {
+ MarkLayerWithRenderSurfaceLayerListId(
+ child->replica_layer()->mask_layer(),
+ current_render_surface_layer_list_id);
+ }
descendants.push_back(child);
}
@@ -2328,12 +2384,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 +2414,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());
« no previous file with comments | « cc/trees/layer_tree_host_common.h ('k') | cc/trees/layer_tree_host_common_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698