Commit 594133f9 authored by abarth@chromium.org's avatar abarth@chromium.org

Remove histogram from GraphicsLayerUpdater::rebuildTree

This CL removes a histgram from GraphicsLayerUpdater::rebuildTree. This
histogram accounts for 9.2% of the time spent in
GraphicsLayerUpdater::rebuildTree and 1.6% of the total compositing update in
Polymer's calculator.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/210093005

git-svn-id: svn://svn.chromium.org/blink/trunk@169908 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 817e6c6c
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
namespace WebCore { namespace WebCore {
bool shouldAppendLayer(const RenderLayer& layer) static bool shouldAppendLayer(const RenderLayer& layer)
{ {
if (!RuntimeEnabledFeatures::overlayFullscreenVideoEnabled()) if (!RuntimeEnabledFeatures::overlayFullscreenVideoEnabled())
return true; return true;
...@@ -48,10 +48,7 @@ bool shouldAppendLayer(const RenderLayer& layer) ...@@ -48,10 +48,7 @@ bool shouldAppendLayer(const RenderLayer& layer)
return true; return true;
} }
GraphicsLayerUpdater::GraphicsLayerUpdater(RenderView& renderView) GraphicsLayerUpdater::GraphicsLayerUpdater()
: m_renderView(renderView)
, m_pixelsWithoutPromotingAllTransitions(0.0)
, m_pixelsAddedByPromotingAllTransitions(0.0)
{ {
} }
...@@ -59,7 +56,7 @@ GraphicsLayerUpdater::~GraphicsLayerUpdater() ...@@ -59,7 +56,7 @@ GraphicsLayerUpdater::~GraphicsLayerUpdater()
{ {
} }
void GraphicsLayerUpdater::rebuildTree(RenderLayer& layer, UpdateType updateType, GraphicsLayerVector& childLayersOfEnclosingLayer, int depth) void GraphicsLayerUpdater::rebuildTree(RenderLayer& layer, UpdateType updateType, GraphicsLayerVector& childLayersOfEnclosingLayer)
{ {
// Make the layer compositing if necessary, and set up clipping and content layers. // Make the layer compositing if necessary, and set up clipping and content layers.
// Note that we can only do work here that is independent of whether the descendant layers // Note that we can only do work here that is independent of whether the descendant layers
...@@ -73,16 +70,6 @@ void GraphicsLayerUpdater::rebuildTree(RenderLayer& layer, UpdateType updateType ...@@ -73,16 +70,6 @@ void GraphicsLayerUpdater::rebuildTree(RenderLayer& layer, UpdateType updateType
updateType = update(layer, updateType); updateType = update(layer, updateType);
// Grab some stats for histograms.
if (hasCompositedLayerMapping) {
m_pixelsWithoutPromotingAllTransitions += layer.size().height() * layer.size().width();
} else {
if ((layer.renderer()->style()->transitionForProperty(CSSPropertyOpacity) ||
layer.renderer()->style()->transitionForProperty(CSSPropertyWebkitTransform)) &&
m_renderView.viewRect().intersects(layer.absoluteBoundingBox()))
m_pixelsAddedByPromotingAllTransitions += layer.size().height() * layer.size().width();
}
// If this layer has a compositedLayerMapping, then that is where we place subsequent children GraphicsLayers. // If this layer has a compositedLayerMapping, then that is where we place subsequent children GraphicsLayers.
// Otherwise children continue to append to the child list of the enclosing layer. // Otherwise children continue to append to the child list of the enclosing layer.
GraphicsLayerVector layerChildren; GraphicsLayerVector layerChildren;
...@@ -95,7 +82,7 @@ void GraphicsLayerUpdater::rebuildTree(RenderLayer& layer, UpdateType updateType ...@@ -95,7 +82,7 @@ void GraphicsLayerUpdater::rebuildTree(RenderLayer& layer, UpdateType updateType
if (layer.stackingNode()->isStackingContainer()) { if (layer.stackingNode()->isStackingContainer()) {
RenderLayerStackingNodeIterator iterator(*layer.stackingNode(), NegativeZOrderChildren); RenderLayerStackingNodeIterator iterator(*layer.stackingNode(), NegativeZOrderChildren);
while (RenderLayerStackingNode* curNode = iterator.next()) while (RenderLayerStackingNode* curNode = iterator.next())
rebuildTree(*curNode->layer(), updateType, childList, depth + 1); rebuildTree(*curNode->layer(), updateType, childList);
// If a negative z-order child is compositing, we get a foreground layer which needs to get parented. // If a negative z-order child is compositing, we get a foreground layer which needs to get parented.
if (hasCompositedLayerMapping && currentCompositedLayerMapping->foregroundLayer()) if (hasCompositedLayerMapping && currentCompositedLayerMapping->foregroundLayer())
...@@ -104,7 +91,7 @@ void GraphicsLayerUpdater::rebuildTree(RenderLayer& layer, UpdateType updateType ...@@ -104,7 +91,7 @@ void GraphicsLayerUpdater::rebuildTree(RenderLayer& layer, UpdateType updateType
RenderLayerStackingNodeIterator iterator(*layer.stackingNode(), NormalFlowChildren | PositiveZOrderChildren); RenderLayerStackingNodeIterator iterator(*layer.stackingNode(), NormalFlowChildren | PositiveZOrderChildren);
while (RenderLayerStackingNode* curNode = iterator.next()) while (RenderLayerStackingNode* curNode = iterator.next())
rebuildTree(*curNode->layer(), updateType, childList, depth + 1); rebuildTree(*curNode->layer(), updateType, childList);
if (hasCompositedLayerMapping) { if (hasCompositedLayerMapping) {
bool parented = false; bool parented = false;
...@@ -136,11 +123,6 @@ void GraphicsLayerUpdater::rebuildTree(RenderLayer& layer, UpdateType updateType ...@@ -136,11 +123,6 @@ void GraphicsLayerUpdater::rebuildTree(RenderLayer& layer, UpdateType updateType
if (shouldAppendLayer(layer)) if (shouldAppendLayer(layer))
childLayersOfEnclosingLayer.append(currentCompositedLayerMapping->childForSuperlayers()); childLayersOfEnclosingLayer.append(currentCompositedLayerMapping->childForSuperlayers());
} }
if (!depth) {
int percentageIncreaseInPixels = static_cast<int>(m_pixelsAddedByPromotingAllTransitions / m_pixelsWithoutPromotingAllTransitions * 100);
blink::Platform::current()->histogramCustomCounts("Renderer.PixelIncreaseFromTransitions", percentageIncreaseInPixels, 0, 1000, 50);
}
} }
// This just updates layer geometry without changing the hierarchy. // This just updates layer geometry without changing the hierarchy.
......
...@@ -38,7 +38,7 @@ class RenderView; ...@@ -38,7 +38,7 @@ class RenderView;
class GraphicsLayerUpdater { class GraphicsLayerUpdater {
public: public:
explicit GraphicsLayerUpdater(RenderView&); GraphicsLayerUpdater();
~GraphicsLayerUpdater(); ~GraphicsLayerUpdater();
enum UpdateType { enum UpdateType {
...@@ -47,17 +47,10 @@ public: ...@@ -47,17 +47,10 @@ public:
}; };
void updateRecursive(RenderLayer&, UpdateType); void updateRecursive(RenderLayer&, UpdateType);
void rebuildTree(RenderLayer&, UpdateType, GraphicsLayerVector& childLayersOfEnclosingLayer, int depth); void rebuildTree(RenderLayer&, UpdateType, GraphicsLayerVector& childLayersOfEnclosingLayer);
private: private:
UpdateType update(RenderLayer&, UpdateType); UpdateType update(RenderLayer&, UpdateType);
RenderView& m_renderView;
// Used for gathering UMA data about the effect on memory usage of promoting all layers
// that have a webkit-transition on opacity or transform and intersect the viewport.
double m_pixelsWithoutPromotingAllTransitions;
double m_pixelsAddedByPromotingAllTransitions;
}; };
} // namespace WebCore } // namespace WebCore
......
...@@ -535,7 +535,7 @@ void RenderLayerCompositor::updateCompositingLayersInternal() ...@@ -535,7 +535,7 @@ void RenderLayerCompositor::updateCompositingLayersInternal()
GraphicsLayerVector childList; GraphicsLayerVector childList;
{ {
TRACE_EVENT0("blink_rendering", "GraphicsLayerUpdater::rebuildTree"); TRACE_EVENT0("blink_rendering", "GraphicsLayerUpdater::rebuildTree");
GraphicsLayerUpdater(m_renderView).rebuildTree(*updateRoot, updateType, childList, 0); GraphicsLayerUpdater().rebuildTree(*updateRoot, updateType, childList);
} }
// Host the document layer in the RenderView's root layer. // Host the document layer in the RenderView's root layer.
...@@ -555,7 +555,7 @@ void RenderLayerCompositor::updateCompositingLayersInternal() ...@@ -555,7 +555,7 @@ void RenderLayerCompositor::updateCompositingLayersInternal()
// We just need to do a geometry update. This is only used for position:fixed scrolling; // We just need to do a geometry update. This is only used for position:fixed scrolling;
// most of the time, geometry is updated via RenderLayer::styleChanged(). // most of the time, geometry is updated via RenderLayer::styleChanged().
TRACE_EVENT0("blink_rendering", "GraphicsLayerUpdater::updateRecursive"); TRACE_EVENT0("blink_rendering", "GraphicsLayerUpdater::updateRecursive");
GraphicsLayerUpdater(m_renderView).updateRecursive(*updateRoot, updateType); GraphicsLayerUpdater().updateRecursive(*updateRoot, updateType);
} }
ASSERT(updateRoot || !m_compositingLayersNeedRebuild); ASSERT(updateRoot || !m_compositingLayersNeedRebuild);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment