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

Unified Diff: Source/core/rendering/compositing/CompositedLayerMapping.cpp

Issue 183763016: Reduce compositing update in Silk's toggle_drawer by 20% (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix the glitch Created 6 years, 10 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: Source/core/rendering/compositing/CompositedLayerMapping.cpp
diff --git a/Source/core/rendering/compositing/CompositedLayerMapping.cpp b/Source/core/rendering/compositing/CompositedLayerMapping.cpp
index 3ce4290754caaf99725c2b7979cdb3f2ffe5c226..6b8d15ed6f449b8e6d8723e68525b0ff52386ec5 100644
--- a/Source/core/rendering/compositing/CompositedLayerMapping.cpp
+++ b/Source/core/rendering/compositing/CompositedLayerMapping.cpp
@@ -421,7 +421,7 @@ void CompositedLayerMapping::updateAfterLayout(UpdateAfterLayoutFlags flags)
layerCompositor->updateCompositingDescendantGeometry(m_owningLayer->stackingNode(), m_owningLayer, flags & CompositingChildrenOnly);
if (flags & IsUpdateRoot) {
- updateGraphicsLayerGeometry();
+ updateGraphicsLayerGeometry(GraphicsLayerUpdater::ForceUpdate);
ojan 2014/03/05 18:29:51 Should this have a FIXME to get rid of the ForceUp
abarth-chromium 2014/03/05 23:12:19 The idea is that this will go away once we fix the
layerCompositor->updateRootLayerPosition();
RenderLayerStackingNode* stackingContainer = m_owningLayer->stackingNode()->enclosingStackingContainerNode();
if (!layerCompositor->compositingLayersNeedRebuild() && stackingContainer && (stackingContainer != m_owningLayer->stackingNode()))
@@ -617,11 +617,17 @@ void CompositedLayerMapping::updateSquashingLayerGeometry(const IntPoint& delta)
}
}
-void CompositedLayerMapping::updateGraphicsLayerGeometry()
+GraphicsLayerUpdater::UpdateType CompositedLayerMapping::updateGraphicsLayerGeometry(GraphicsLayerUpdater::UpdateType updateType)
{
// If we haven't built z-order lists yet, wait until later.
if (m_owningLayer->stackingNode()->isStackingContainer() && m_owningLayer->stackingNode()->zOrderListsDirty())
- return;
+ return updateType;
+
+ if (!m_needToUpdateGeometry && updateType != GraphicsLayerUpdater::ForceUpdate)
+ return updateType;
+ m_needToUpdateGeometry = false;
+ if (m_needToUpdateGeometryOfAllDecendants)
+ updateType = GraphicsLayerUpdater::ForceUpdate;
// Set transform property, if it is not animating. We have to do this here because the transform
// is affected by the layer dimensions.
@@ -783,7 +789,7 @@ void CompositedLayerMapping::updateGraphicsLayerGeometry()
if (m_owningLayer->reflectionInfo() && m_owningLayer->reflectionInfo()->reflectionLayer()->hasCompositedLayerMapping()) {
CompositedLayerMappingPtr reflectionCompositedLayerMapping = m_owningLayer->reflectionInfo()->reflectionLayer()->compositedLayerMapping();
- reflectionCompositedLayerMapping->updateGraphicsLayerGeometry();
+ reflectionCompositedLayerMapping->updateGraphicsLayerGeometry(GraphicsLayerUpdater::ForceUpdate);
// The reflection layer has the bounds of m_owningLayer->reflectionLayer(),
// but the reflected layer is the bounds of this layer, so we need to position it appropriately.
@@ -862,6 +868,8 @@ void CompositedLayerMapping::updateGraphicsLayerGeometry()
registerScrollingLayers();
updateCompositingReasons();
+
+ return updateType;
}
void CompositedLayerMapping::registerScrollingLayers()
@@ -1849,6 +1857,23 @@ void CompositedLayerMapping::setBlendMode(blink::WebBlendMode blendMode)
}
}
+void CompositedLayerMapping::setNeedsGeometryUpdate()
+{
+ m_needToUpdateGeometryOfAllDecendants = true;
+
+ for (RenderLayer* current = m_owningLayer; current; current = current->ancestorCompositingLayer()) {
ojan 2014/03/05 18:57:00 This is n^2 if it doesn't early return if m_needTo
abarth-chromium 2014/03/05 23:12:19 Ok, I'll add a FIXME.
+ ASSERT(current->hasCompositedLayerMapping());
+ CompositedLayerMappingPtr mapping = current->compositedLayerMapping();
+ mapping->m_needToUpdateGeometry = true;
+ }
+}
+
+void CompositedLayerMapping::willUpdateGeometryOfAllDecendants()
+{
+ ASSERT(!m_needToUpdateGeometry);
+ m_needToUpdateGeometryOfAllDecendants = false;
+}
+
struct SetContentsNeedsDisplayFunctor {
void operator() (GraphicsLayer* layer) const
{

Powered by Google App Engine
This is Rietveld 408576698