Title: [111604] trunk/Source/WebCore
- Revision
- 111604
- Author
- [email protected]
- Date
- 2012-03-21 14:05:22 -0700 (Wed, 21 Mar 2012)
Log Message
Evict tiles from pages in background tabs
https://bugs.webkit.org/show_bug.cgi?id=81829
<rdar://problem/10866152>
Reviewed by Andreas Kling.
When the tile cache for a page is no longer in a window (which happens when it's moved to
a background tab), schedule a tile revalidation after 4 seconds. This tile revalidation
will ensure that tiles outside of the visible rect will be dropped.
* platform/graphics/ca/mac/TileCache.h:
(TileCache):
* platform/graphics/ca/mac/TileCache.mm:
(WebCore::TileCache::tileCacheLayerBoundsChanged):
(WebCore::TileCache::setIsInWindow):
(WebCore::TileCache::tileCoverageRect):
(WebCore):
(WebCore::TileCache::scheduleTileRevalidation):
(WebCore::TileCache::revalidateTiles):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (111603 => 111604)
--- trunk/Source/WebCore/ChangeLog 2012-03-21 20:55:41 UTC (rev 111603)
+++ trunk/Source/WebCore/ChangeLog 2012-03-21 21:05:22 UTC (rev 111604)
@@ -1,3 +1,25 @@
+2012-03-21 Anders Carlsson <[email protected]>
+
+ Evict tiles from pages in background tabs
+ https://bugs.webkit.org/show_bug.cgi?id=81829
+ <rdar://problem/10866152>
+
+ Reviewed by Andreas Kling.
+
+ When the tile cache for a page is no longer in a window (which happens when it's moved to
+ a background tab), schedule a tile revalidation after 4 seconds. This tile revalidation
+ will ensure that tiles outside of the visible rect will be dropped.
+
+ * platform/graphics/ca/mac/TileCache.h:
+ (TileCache):
+ * platform/graphics/ca/mac/TileCache.mm:
+ (WebCore::TileCache::tileCacheLayerBoundsChanged):
+ (WebCore::TileCache::setIsInWindow):
+ (WebCore::TileCache::tileCoverageRect):
+ (WebCore):
+ (WebCore::TileCache::scheduleTileRevalidation):
+ (WebCore::TileCache::revalidateTiles):
+
2012-03-21 Stephen Chenney <[email protected]>
SVG layout leaves objects still needing layout
Modified: trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.h (111603 => 111604)
--- trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.h 2012-03-21 20:55:41 UTC (rev 111603)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.h 2012-03-21 21:05:22 UTC (rev 111604)
@@ -81,7 +81,9 @@
IntRect rectForTileIndex(const TileIndex&) const;
void getTileIndexRangeForRect(const IntRect&, TileIndex& topLeft, TileIndex& bottomRight);
- void scheduleTileRevalidation();
+ IntRect tileCoverageRect() const;
+
+ void scheduleTileRevalidation(double interval);
void tileRevalidationTimerFired(Timer<TileCache>*);
void revalidateTiles();
Modified: trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.mm (111603 => 111604)
--- trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.mm 2012-03-21 20:55:41 UTC (rev 111603)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.mm 2012-03-21 21:05:22 UTC (rev 111604)
@@ -80,7 +80,7 @@
return;
}
- scheduleTileRevalidation();
+ scheduleTileRevalidation(0);
}
void TileCache::setNeedsDisplay()
@@ -227,6 +227,12 @@
return;
m_isInWindow = isInWindow;
+
+ if (!m_isInWindow) {
+ // Schedule a timeout to drop tiles that are outside of the visible rect in 4 seconds.
+ const double tileRevalidationTimeout = 4;
+ scheduleTileRevalidation(tileRevalidationTimeout);
+ }
}
void TileCache::setTileDebugBorderWidth(float borderWidth)
@@ -277,12 +283,27 @@
bottomRight.setY(max(clampedRect.maxY() / m_tileSize.height(), 0));
}
-void TileCache::scheduleTileRevalidation()
+IntRect TileCache::tileCoverageRect() const
{
- if (m_tileRevalidationTimer.isActive())
+ IntRect tileCoverageRect = m_visibleRect;
+
+ if (m_isInWindow) {
+ // Inflate the coverage rect so that it covers 2x of the visible width and 3x of the visible height.
+ // These values were chosen because it's more common to have tall pages and to scroll vertically,
+ // so we keep more tiles above and below the current area.
+ tileCoverageRect.inflateX(tileCoverageRect.width() / 2);
+ tileCoverageRect.inflateY(tileCoverageRect.height());
+ }
+
+ return tileCoverageRect;
+}
+
+void TileCache::scheduleTileRevalidation(double interval)
+{
+ if (m_tileRevalidationTimer.isActive() && m_tileRevalidationTimer.nextFireInterval() < interval)
return;
- m_tileRevalidationTimer.startOneShot(0);
+ m_tileRevalidationTimer.startOneShot(interval);
}
void TileCache::tileRevalidationTimerFired(Timer<TileCache>*)
@@ -301,14 +322,8 @@
if (m_visibleRect.isEmpty() || bounds().isEmpty())
return;
- IntRect tileCoverageRect = m_visibleRect;
+ IntRect tileCoverageRect = this->tileCoverageRect();
- // Inflate the coverage rect so that it covers 2x of the visible width and 3x of the visible height.
- // These values were chosen because it's more common to have tall pages and to scroll vertically,
- // so we keep more tiles above and below the current area.
- tileCoverageRect.inflateX(tileCoverageRect.width() / 2);
- tileCoverageRect.inflateY(tileCoverageRect.height());
-
Vector<TileIndex> tilesToRemove;
for (TileMap::iterator it = m_tiles.begin(), end = m_tiles.end(); it != end; ++it) {
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes