Title: [138997] trunk/Source/WebCore
Revision
138997
Author
timothy_hor...@apple.com
Date
2013-01-07 15:17:36 -0800 (Mon, 07 Jan 2013)

Log Message

Tiled-layer TileCaches shouldn't unparent offscreen tiles
https://bugs.webkit.org/show_bug.cgi?id=106258
<rdar://problem/12969116>

Reviewed by Simon Fraser.

Add a setting on TiledBacking (implemented on TileCache) that controls whether or not
the TileCache should unparent offscreen tiles. We can't use this behavior for tiled-layer TileCaches
currently because m_isInWindow is not updated for tiled-layer TileCaches, and because we haven't
decided exactly what their behavior should be. So, revert to the old behavior for them.

* platform/graphics/TiledBacking.h:
* platform/graphics/ca/mac/TileCache.h:
(TileCache): Add setUnparentsOffscreenTiles/unparentsOffscreenTiles.
* platform/graphics/ca/mac/TileCache.mm:
(WebCore::TileCache::TileCache): m_unparentsOffscreenTiles defaults to false.
(WebCore::TileCache::revalidateTiles):
Return to the old behavior of always adding new layers to the layer tree regardless of m_isInWindow if m_unparentsOffscreenTiles is false.
Return to the old behavior of never unparenting tiles regardless of m_isInWindow if m_unparentsOffscreenTiles is false.
(WebCore::TileCache::ensureTilesForRect): Return to the old behavior of always ensuring tiles regardless of m_isInWindow if m_unparentsOffscreen$
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::RenderLayerBacking): Tell primary TileCaches that it's OK to unparent offscreen tiles.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (138996 => 138997)


--- trunk/Source/WebCore/ChangeLog	2013-01-07 23:04:52 UTC (rev 138996)
+++ trunk/Source/WebCore/ChangeLog	2013-01-07 23:17:36 UTC (rev 138997)
@@ -1,3 +1,28 @@
+2013-01-07  Tim Horton  <timothy_hor...@apple.com>
+
+        Tiled-layer TileCaches shouldn't unparent offscreen tiles
+        https://bugs.webkit.org/show_bug.cgi?id=106258
+        <rdar://problem/12969116>
+
+        Reviewed by Simon Fraser.
+
+        Add a setting on TiledBacking (implemented on TileCache) that controls whether or not
+        the TileCache should unparent offscreen tiles. We can't use this behavior for tiled-layer TileCaches
+        currently because m_isInWindow is not updated for tiled-layer TileCaches, and because we haven't
+        decided exactly what their behavior should be. So, revert to the old behavior for them.
+
+        * platform/graphics/TiledBacking.h:
+        * platform/graphics/ca/mac/TileCache.h:
+        (TileCache): Add setUnparentsOffscreenTiles/unparentsOffscreenTiles.
+        * platform/graphics/ca/mac/TileCache.mm:
+        (WebCore::TileCache::TileCache): m_unparentsOffscreenTiles defaults to false.
+        (WebCore::TileCache::revalidateTiles):
+        Return to the old behavior of always adding new layers to the layer tree regardless of m_isInWindow if m_unparentsOffscreenTiles is false.
+        Return to the old behavior of never unparenting tiles regardless of m_isInWindow if m_unparentsOffscreenTiles is false.
+        (WebCore::TileCache::ensureTilesForRect): Return to the old behavior of always ensuring tiles regardless of m_isInWindow if m_unparentsOffscreenTiles is false.
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::RenderLayerBacking): Tell primary TileCaches that it's OK to unparent offscreen tiles.
+
 2013-01-07  Justin Novosad  <ju...@google.com>
 
         Fixing memory read after free in CanvasRenderingContext2D::accessFont

Modified: trunk/Source/WebCore/platform/graphics/TiledBacking.h (138996 => 138997)


--- trunk/Source/WebCore/platform/graphics/TiledBacking.h	2013-01-07 23:04:52 UTC (rev 138996)
+++ trunk/Source/WebCore/platform/graphics/TiledBacking.h	2013-01-07 23:17:36 UTC (rev 138997)
@@ -72,6 +72,9 @@
     
     virtual void setAggressivelyRetainsTiles(bool) = 0;
     virtual bool aggressivelyRetainsTiles() const = 0;
+    
+    virtual void setUnparentsOffscreenTiles(bool) = 0;
+    virtual bool unparentsOffscreenTiles() const = 0;
 
     // Exposed for testing
     virtual IntRect tileCoverageRect() const = 0;

Modified: trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.h (138996 => 138997)


--- trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.h	2013-01-07 23:04:52 UTC (rev 138996)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.h	2013-01-07 23:17:36 UTC (rev 138997)
@@ -117,6 +117,8 @@
     virtual bool scrollingPerformanceLoggingEnabled() const OVERRIDE { return m_scrollingPerformanceLoggingEnabled; }
     virtual void setAggressivelyRetainsTiles(bool flag) OVERRIDE { m_aggressivelyRetainsTiles = flag; }
     virtual bool aggressivelyRetainsTiles() const OVERRIDE { return m_aggressivelyRetainsTiles; }
+    virtual void setUnparentsOffscreenTiles(bool flag) OVERRIDE { m_unparentsOffscreenTiles = flag; }
+    virtual bool unparentsOffscreenTiles() const OVERRIDE { return m_unparentsOffscreenTiles; }
     virtual IntRect tileCoverageRect() const OVERRIDE;
     virtual CALayer *tiledScrollingIndicatorLayer() OVERRIDE;
     virtual void setScrollingModeIndication(ScrollingModeIndication) OVERRIDE;
@@ -192,6 +194,7 @@
     bool m_isInWindow;
     bool m_scrollingPerformanceLoggingEnabled;
     bool m_aggressivelyRetainsTiles;
+    bool m_unparentsOffscreenTiles;
     bool m_acceleratesDrawing;
     bool m_tilesAreOpaque;
 

Modified: trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.mm (138996 => 138997)


--- trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.mm	2013-01-07 23:04:52 UTC (rev 138996)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.mm	2013-01-07 23:17:36 UTC (rev 138997)
@@ -106,6 +106,7 @@
     , m_isInWindow(false)
     , m_scrollingPerformanceLoggingEnabled(false)
     , m_aggressivelyRetainsTiles(false)
+    , m_unparentsOffscreenTiles(false)
     , m_acceleratesDrawing(false)
     , m_tilesAreOpaque(false)
     , m_tileDebugBorderWidth(0)
@@ -586,7 +587,9 @@
                 if (tileInfo.cohort == VisibleTileCohort) {
                     tileInfo.cohort = currCohort;
                     ++tilesInCohort;
-                    [tileInfo.layer.get() removeFromSuperlayer];
+                    
+                    if (m_unparentsOffscreenTiles)
+                        [tileInfo.layer.get() removeFromSuperlayer];
                 }
             }
         }
@@ -617,10 +620,10 @@
             TileInfo& tileInfo = m_tiles.add(tileIndex, TileInfo()).iterator->value;
             if (!tileInfo.layer) {
                 tileInfo.layer = createTileLayer(tileRect);
-                if (m_isInWindow)
+                if (!m_unparentsOffscreenTiles || m_isInWindow)
                     [m_tileContainerLayer.get() addSublayer:tileInfo.layer.get()];
             } else {
-                if (m_isInWindow && ![tileInfo.layer.get() superlayer])
+                if ((!m_unparentsOffscreenTiles || m_isInWindow) && ![tileInfo.layer.get() superlayer])
                     [m_tileContainerLayer.get() addSublayer:tileInfo.layer.get()];
 
                 // We already have a layer for this tile. Ensure that its size is correct.
@@ -642,7 +645,7 @@
         m_cohortList.clear();
     }
 
-    if (validationPolicy & UnparentAllTiles) {
+    if (m_unparentsOffscreenTiles && (validationPolicy & UnparentAllTiles)) {
         for (TileMap::iterator it = m_tiles.begin(), end = m_tiles.end(); it != end; ++it)
             [it->value.layer.get() removeFromSuperlayer];
     }
@@ -710,7 +713,7 @@
 
 void TileCache::ensureTilesForRect(const IntRect& rect)
 {
-    if (!m_isInWindow)
+    if (m_unparentsOffscreenTiles && !m_isInWindow)
         return;
 
     PlatformCALayer* platformLayer = PlatformCALayer::platformCALayer(m_tileCacheLayer);

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (138996 => 138997)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2013-01-07 23:04:52 UTC (rev 138996)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2013-01-07 23:17:36 UTC (rev 138997)
@@ -130,6 +130,10 @@
         if (Page* page = renderer()->frame()->page()) {
             Frame* frame = renderer()->frame();
             tiledBacking->setIsInWindow(page->isOnscreen());
+
+            if (m_isMainFrameRenderViewLayer)
+                tiledBacking->setUnparentsOffscreenTiles(true);
+
             tiledBacking->setScrollingPerformanceLoggingEnabled(frame->settings() && frame->settings()->scrollingPerformanceLoggingEnabled());
             adjustTileCacheCoverage();
         }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to