Diff
Modified: trunk/Source/WebCore/ChangeLog (158858 => 158859)
--- trunk/Source/WebCore/ChangeLog 2013-11-07 19:33:17 UTC (rev 158858)
+++ trunk/Source/WebCore/ChangeLog 2013-11-07 19:34:01 UTC (rev 158859)
@@ -1,3 +1,39 @@
+2013-11-07 Simon Fraser <[email protected]>
+
+ Allow customization of the contentsScale of TileController tiles
+ https://bugs.webkit.org/show_bug.cgi?id=124004
+
+ Reviewed by Tim Horton.
+
+ On some platorms, zooming out on pages with TiledBacking compositing
+ layers can cause very high memory use, because the TiledBacking retains
+ the original page scale while the zoom is in flight, but can be asked
+ to cover a large area.
+
+ Make it possible to reduce memory use in this case by allowing RenderLayerCompositor
+ to provide an additional scale factor for newly created tiles. Platforms can
+ then customize this to create low-res tiles when necessary.
+
+ * WebCore.exp.in:
+ * platform/graphics/GraphicsLayerClient.h:
+ (WebCore::GraphicsLayerClient::contentsScaleMultiplierForNewTiles):
+ * platform/graphics/ca/GraphicsLayerCA.cpp:
+ (WebCore::GraphicsLayerCA::platformCALayerContentsScaleMultiplierForNewTiles):
+ * platform/graphics/ca/GraphicsLayerCA.h:
+ * platform/graphics/ca/PlatformCALayerClient.h:
+ (WebCore::PlatformCALayerClient::platformCALayerContentsScaleMultiplierForNewTiles):
+ * platform/graphics/ca/mac/TileController.h:
+ * platform/graphics/ca/mac/TileController.mm:
+ (WebCore::TileController::TileController):
+ (WebCore::TileController::setScale):
+ (WebCore::TileController::createTileLayer):
+ * rendering/RenderLayerBacking.cpp:
+ (WebCore::RenderLayerBacking::contentsScaleMultiplierForNewTiles):
+ * rendering/RenderLayerBacking.h:
+ * rendering/RenderLayerCompositor.cpp:
+ (WebCore::RenderLayerCompositor::contentsScaleMultiplierForNewTiles):
+ * rendering/RenderLayerCompositor.h:
+
2013-11-07 Jer Noble <[email protected]>
Unreviewed Win build fix after r158855; wrap shapeInfoForFloat() in an ENABLE(CSS_SHAPES) guard.
Modified: trunk/Source/WebCore/WebCore.exp.in (158858 => 158859)
--- trunk/Source/WebCore/WebCore.exp.in 2013-11-07 19:33:17 UTC (rev 158858)
+++ trunk/Source/WebCore/WebCore.exp.in 2013-11-07 19:34:01 UTC (rev 158859)
@@ -556,6 +556,8 @@
__ZN7WebCore15GraphicsLayerCA31platformCALayerAnimationStartedEd
__ZN7WebCore15GraphicsLayerCA37flushCompositingStateForThisLayerOnlyEv
__ZN7WebCore15GraphicsLayerCA40platformCALayerSetNeedsToRevalidateTilesEv
+__ZNK7WebCore15GraphicsLayerCA49platformCALayerContentsScaleMultiplierForNewTilesEPNS_15PlatformCALayerE
+__ZThn496_NK7WebCore15GraphicsLayerCA49platformCALayerContentsScaleMultiplierForNewTilesEPNS_15PlatformCALayerE
__ZN7WebCore15GraphicsLayerCA7setNameERKN3WTF6StringE
__ZN7WebCore15GraphicsLayerCA7setSizeERKNS_9FloatSizeE
__ZN7WebCore15GraphicsLayerCA8addChildEPNS_13GraphicsLayerE
Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayerClient.h (158858 => 158859)
--- trunk/Source/WebCore/platform/graphics/GraphicsLayerClient.h 2013-11-07 19:33:17 UTC (rev 158858)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayerClient.h 2013-11-07 19:34:01 UTC (rev 158859)
@@ -88,6 +88,8 @@
// Page scale factor.
virtual float pageScaleFactor() const { return 1; }
+ virtual float contentsScaleMultiplierForNewTiles(const GraphicsLayer*) const { return 1; }
+
virtual bool isTrackingRepaints() const { return false; }
virtual bool shouldSkipLayerInDump(const GraphicsLayer*) const { return false; }
Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (158858 => 158859)
--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp 2013-11-07 19:33:17 UTC (rev 158858)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp 2013-11-07 19:34:01 UTC (rev 158859)
@@ -1233,6 +1233,11 @@
return deviceScaleFactor();
}
+float GraphicsLayerCA::platformCALayerContentsScaleMultiplierForNewTiles(PlatformCALayer*) const
+{
+ return client() ? client()->contentsScaleMultiplierForNewTiles(this) : 1;
+}
+
void GraphicsLayerCA::commitLayerChangesBeforeSublayers(CommitState& commitState, float pageScaleFactor, const FloatPoint& positionRelativeToBase, const FloatRect& oldVisibleRect, TransformationMatrix* transformFromRoot)
{
++commitState.treeDepth;
Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h (158858 => 158859)
--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h 2013-11-07 19:33:17 UTC (rev 158858)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h 2013-11-07 19:34:01 UTC (rev 158859)
@@ -177,6 +177,8 @@
virtual void platformCALayerLayerDidDisplay(PlatformLayer* layer) { return layerDidDisplay(layer); }
virtual void platformCALayerSetNeedsToRevalidateTiles() OVERRIDE;
virtual float platformCALayerDeviceScaleFactor() const OVERRIDE;
+ virtual float platformCALayerContentsScaleMultiplierForNewTiles(PlatformCALayer*) const OVERRIDE;
+
virtual bool isCommittingChanges() const OVERRIDE { return m_isCommittingChanges; }
virtual double backingStoreMemoryEstimate() const;
Modified: trunk/Source/WebCore/platform/graphics/ca/PlatformCALayerClient.h (158858 => 158859)
--- trunk/Source/WebCore/platform/graphics/ca/PlatformCALayerClient.h 2013-11-07 19:33:17 UTC (rev 158858)
+++ trunk/Source/WebCore/platform/graphics/ca/PlatformCALayerClient.h 2013-11-07 19:34:01 UTC (rev 158859)
@@ -61,6 +61,7 @@
virtual void platformCALayerSetNeedsToRevalidateTiles() { }
virtual float platformCALayerDeviceScaleFactor() const = 0;
+ virtual float platformCALayerContentsScaleMultiplierForNewTiles(PlatformCALayer*) const { return 1; }
virtual bool isCommittingChanges() const { return false; }
Modified: trunk/Source/WebCore/platform/graphics/ca/mac/TileController.h (158858 => 158859)
--- trunk/Source/WebCore/platform/graphics/ca/mac/TileController.h 2013-11-07 19:33:17 UTC (rev 158858)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/TileController.h 2013-11-07 19:34:01 UTC (rev 158859)
@@ -227,6 +227,7 @@
bool m_acceleratesDrawing;
bool m_tilesAreOpaque;
bool m_clipsToExposedRect;
+ bool m_hasTilesWithTemporaryScaleFactor; // Used to make low-res tiles when zooming.
Color m_tileDebugBorderColor;
float m_tileDebugBorderWidth;
Modified: trunk/Source/WebCore/platform/graphics/ca/mac/TileController.mm (158858 => 158859)
--- trunk/Source/WebCore/platform/graphics/ca/mac/TileController.mm 2013-11-07 19:33:17 UTC (rev 158858)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/TileController.mm 2013-11-07 19:34:01 UTC (rev 158859)
@@ -66,6 +66,7 @@
, m_acceleratesDrawing(false)
, m_tilesAreOpaque(false)
, m_clipsToExposedRect(false)
+ , m_hasTilesWithTemporaryScaleFactor(false)
, m_tileDebugBorderWidth(0)
, m_indicatorMode(ThreadedScrollingIndication)
{
@@ -212,9 +213,10 @@
// Divide by the device scale factor so we'll get the page scale factor.
scale /= deviceScaleFactor;
- if (m_scale == scale && m_deviceScaleFactor == deviceScaleFactor)
+ if (m_scale == scale && m_deviceScaleFactor == deviceScaleFactor && !m_hasTilesWithTemporaryScaleFactor)
return;
+ m_hasTilesWithTemporaryScaleFactor = false;
m_deviceScaleFactor = deviceScaleFactor;
m_scale = scale;
@@ -945,7 +947,10 @@
layer->setName("Tile");
#endif
- layer->setContentsScale(m_deviceScaleFactor);
+ float temporaryScaleFactor = owningGraphicsLayer()->platformCALayerContentsScaleMultiplierForNewTiles(m_tileCacheLayer);
+ m_hasTilesWithTemporaryScaleFactor |= temporaryScaleFactor != 1;
+
+ layer->setContentsScale(m_deviceScaleFactor * temporaryScaleFactor);
layer->setAcceleratesDrawing(m_acceleratesDrawing);
layer->setNeedsDisplay();
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (158858 => 158859)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2013-11-07 19:33:17 UTC (rev 158858)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2013-11-07 19:34:01 UTC (rev 158859)
@@ -2116,6 +2116,11 @@
return compositor().deviceScaleFactor();
}
+float RenderLayerBacking::contentsScaleMultiplierForNewTiles(const GraphicsLayer* layer) const
+{
+ return compositor().contentsScaleMultiplierForNewTiles(layer);
+}
+
void RenderLayerBacking::didCommitChangesForLayer(const GraphicsLayer* layer) const
{
compositor().didFlushChangesForLayer(m_owningLayer, layer);
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.h (158858 => 158859)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.h 2013-11-07 19:33:17 UTC (rev 158858)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.h 2013-11-07 19:34:01 UTC (rev 158859)
@@ -165,6 +165,8 @@
virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const IntRect& clip) OVERRIDE;
virtual float deviceScaleFactor() const OVERRIDE;
+ virtual float contentsScaleMultiplierForNewTiles(const GraphicsLayer*) const OVERRIDE;
+
virtual float pageScaleFactor() const OVERRIDE;
virtual void didCommitChangesForLayer(const GraphicsLayer*) const OVERRIDE;
virtual bool getCurrentTransform(const GraphicsLayer*, TransformationMatrix&) const OVERRIDE;
Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (158858 => 158859)
--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2013-11-07 19:33:17 UTC (rev 158858)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2013-11-07 19:34:01 UTC (rev 158859)
@@ -2480,6 +2480,11 @@
return page ? page->pageScaleFactor() : 1;
}
+float RenderLayerCompositor::contentsScaleMultiplierForNewTiles(const GraphicsLayer*) const
+{
+ return 1;
+}
+
void RenderLayerCompositor::didCommitChangesForLayer(const GraphicsLayer*) const
{
// Nothing to do here yet.
Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.h (158858 => 158859)
--- trunk/Source/WebCore/rendering/RenderLayerCompositor.h 2013-11-07 19:33:17 UTC (rev 158858)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.h 2013-11-07 19:34:01 UTC (rev 158859)
@@ -244,6 +244,7 @@
String layerTreeAsText(LayerTreeFlags);
virtual float deviceScaleFactor() const OVERRIDE;
+ virtual float contentsScaleMultiplierForNewTiles(const GraphicsLayer*) const OVERRIDE;
virtual float pageScaleFactor() const OVERRIDE;
virtual void didCommitChangesForLayer(const GraphicsLayer*) const OVERRIDE;
virtual void notifyFlushBeforeDisplayRefresh(const GraphicsLayer*) OVERRIDE;