cc: Make UpdateTilePriorities a separate step
This will make it more obvious in traces where work is really being done
and make it possible to optimize this further.
Comparing average times spent in the renderer compositor while scrolling
Wikipedia's List of Pokemon page on an N4 in two different runs:
Before change:
UpdateDrawProperties: 0.754ms
After change:
UpdateDrawProperties: 0.249ms
UpdateTilePriorities: 0.553ms
[email protected]
BUG=308244
Review URL: https://codereview.chromium.org/26880009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@229590 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/cc/trees/layer_tree_impl.cc b/cc/trees/layer_tree_impl.cc
index 471a1331..d124a63 100644
--- a/cc/trees/layer_tree_impl.cc
+++ b/cc/trees/layer_tree_impl.cc
@@ -385,6 +385,37 @@
LayerTreeHostCommon::CalculateDrawProperties(&inputs);
}
+ {
+ TRACE_EVENT2("cc",
+ "LayerTreeImpl::UpdateTilePriorities",
+ "IsActive",
+ IsActiveTree(),
+ "SourceFrameNumber",
+ source_frame_number_);
+ // LayerIterator is used here instead of CallFunctionForSubtree to only
+ // UpdateTilePriorities on layers that will be visible (and thus have valid
+ // draw properties) and not because any ordering is required.
+ typedef LayerIterator<LayerImpl,
+ LayerImplList,
+ RenderSurfaceImpl,
+ LayerIteratorActions::FrontToBack> LayerIteratorType;
+ LayerIteratorType end = LayerIteratorType::End(&render_surface_layer_list_);
+ for (LayerIteratorType it =
+ LayerIteratorType::Begin(&render_surface_layer_list_);
+ it != end;
+ ++it) {
+ if (!it.represents_itself())
+ continue;
+ LayerImpl* layer = *it;
+
+ layer->UpdateTilePriorities();
+ if (layer->mask_layer())
+ layer->mask_layer()->UpdateTilePriorities();
+ if (layer->replica_layer() && layer->replica_layer()->mask_layer())
+ layer->replica_layer()->mask_layer()->UpdateTilePriorities();
+ }
+ }
+
DCHECK(!needs_update_draw_properties_) <<
"CalcDrawProperties should not set_needs_update_draw_properties()";
}