Title: [136774] trunk/Source/WebCore
Revision
136774
Author
simon.fra...@apple.com
Date
2012-12-05 16:07:02 -0800 (Wed, 05 Dec 2012)

Log Message

Fix some repaint/paintCounter confusion, and reset it when getting layers out of the layer pool
https://bugs.webkit.org/show_bug.cgi?id=104180

Reviewed by Tim Horton.

Layers retrieved from the LayerPool by TileCache need to have their
repaint counters reset, otherwise the scroll performance logging gets
confused.

Also, the counter counts paints, not repaints (invalidations), so
rename it accordingly.

* page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm:
(WebCore::ScrollingTreeScrollingNodeMac::logExposedUnfilledArea): Whitespace fix.
* platform/graphics/GraphicsLayer.h:
* platform/graphics/ca/mac/TileCache.mm:
(WebCore::TileCache::blankPixelCountForTiles):
(WebCore::TileCache::createTileLayer):
(WebCore::TileCache::drawRepaintCounter):
* platform/graphics/ca/mac/WebTileLayer.h:
* platform/graphics/ca/mac/WebTileLayer.mm:
(-[WebTileLayer resetPaintCount]):
(-[WebTileLayer incrementPaintCount]):
(-[WebTileLayer paintCount]):
(-[WebTileLayer logFilledFreshTile]):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (136773 => 136774)


--- trunk/Source/WebCore/ChangeLog	2012-12-05 23:43:06 UTC (rev 136773)
+++ trunk/Source/WebCore/ChangeLog	2012-12-06 00:07:02 UTC (rev 136774)
@@ -1,3 +1,31 @@
+2012-12-05  Simon Fraser  <simon.fra...@apple.com>
+
+        Fix some repaint/paintCounter confusion, and reset it when getting layers out of the layer pool
+        https://bugs.webkit.org/show_bug.cgi?id=104180
+
+        Reviewed by Tim Horton.
+
+        Layers retrieved from the LayerPool by TileCache need to have their
+        repaint counters reset, otherwise the scroll performance logging gets
+        confused.
+        
+        Also, the counter counts paints, not repaints (invalidations), so
+        rename it accordingly.
+
+        * page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm:
+        (WebCore::ScrollingTreeScrollingNodeMac::logExposedUnfilledArea): Whitespace fix.
+        * platform/graphics/GraphicsLayer.h:
+        * platform/graphics/ca/mac/TileCache.mm:
+        (WebCore::TileCache::blankPixelCountForTiles):
+        (WebCore::TileCache::createTileLayer):
+        (WebCore::TileCache::drawRepaintCounter):
+        * platform/graphics/ca/mac/WebTileLayer.h:
+        * platform/graphics/ca/mac/WebTileLayer.mm:
+        (-[WebTileLayer resetPaintCount]):
+        (-[WebTileLayer incrementPaintCount]):
+        (-[WebTileLayer paintCount]):
+        (-[WebTileLayer logFilledFreshTile]):
+
 2012-12-05  Oliver Hunt  <oli...@apple.com>
 
         Empty parse cache when receiving a low memory warning

Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm (136773 => 136774)


--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm	2012-12-05 23:43:06 UTC (rev 136773)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm	2012-12-06 00:07:02 UTC (rev 136774)
@@ -330,7 +330,7 @@
     layerQueue.append(m_scrollLayer.get());
     WebTileLayerList tiles;
 
-    while(!layerQueue.isEmpty() && tiles.isEmpty()) {
+    while (!layerQueue.isEmpty() && tiles.isEmpty()) {
         CALayer* layer = layerQueue.takeFirst();
         NSArray* sublayers = [[layer sublayers] copy];
 

Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.h (136773 => 136774)


--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.h	2012-12-05 23:43:06 UTC (rev 136773)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.h	2012-12-06 00:07:02 UTC (rev 136774)
@@ -372,6 +372,7 @@
     virtual void setShowRepaintCounter(bool show) { m_showRepaintCounter = show; }
     bool isShowingRepaintCounter() const { return m_showRepaintCounter; }
 
+    // FIXME: this is really a paint count.
     int repaintCount() const { return m_repaintCount; }
     int incrementRepaintCount() { return ++m_repaintCount; }
 

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


--- trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.mm	2012-12-05 23:43:06 UTC (rev 136773)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.mm	2012-12-06 00:07:02 UTC (rev 136774)
@@ -410,7 +410,7 @@
         IntRect visiblePart(CGRectOffset([tileLayer frame], tileTranslation.x(), tileTranslation.y()));
         visiblePart.intersect(visibleRect);
 
-        if (!visiblePart.isEmpty() && [tileLayer repaintCount])
+        if (!visiblePart.isEmpty() && [tileLayer paintCount])
             paintedVisibleTiles.unite(visiblePart);
     }
 
@@ -601,6 +601,7 @@
     if (layer) {
         // If we were able to restore a layer from the LayerPool, we should call setNeedsDisplay to
         // ensure we avoid stale content.
+        [layer resetPaintCount];
         [layer setNeedsDisplay];
     } else
         layer = adoptNS([[WebTileLayer alloc] init]);
@@ -639,13 +640,13 @@
 
 void TileCache::drawRepaintCounter(WebTileLayer *layer, CGContextRef context)
 {
-    unsigned repaintCount = [layer incrementRepaintCount];
+    unsigned paintCount = [layer incrementPaintCount];
     if (!shouldShowRepaintCounters())
         return;
 
     // FIXME: Some of this code could be shared with WebLayer.
     char text[16]; // that's a lot of repaints
-    snprintf(text, sizeof(text), "%d", repaintCount);
+    snprintf(text, sizeof(text), "%d", paintCount);
 
     CGRect indicatorBox = [layer bounds];
     indicatorBox.size.width = 12 + 10 * strlen(text);

Modified: trunk/Source/WebCore/platform/graphics/ca/mac/WebTileLayer.h (136773 => 136774)


--- trunk/Source/WebCore/platform/graphics/ca/mac/WebTileLayer.h	2012-12-05 23:43:06 UTC (rev 136773)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/WebTileLayer.h	2012-12-06 00:07:02 UTC (rev 136774)
@@ -32,12 +32,13 @@
 
 @interface WebTileLayer : CALayer {
     WebCore::TileCache* _tileCache;
-    unsigned _repaintCount;
+    unsigned _paintCount;
 }
 
 - (void)setTileCache:(WebCore::TileCache*)tileCache;
-- (unsigned)incrementRepaintCount;
-- (unsigned)repaintCount;
+- (void)resetPaintCount;
+- (unsigned)incrementPaintCount;
+- (unsigned)paintCount;
 @end
 
 

Modified: trunk/Source/WebCore/platform/graphics/ca/mac/WebTileLayer.mm (136773 => 136774)


--- trunk/Source/WebCore/platform/graphics/ca/mac/WebTileLayer.mm	2012-12-05 23:43:06 UTC (rev 136773)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/WebTileLayer.mm	2012-12-06 00:07:02 UTC (rev 136774)
@@ -61,22 +61,27 @@
     _tileCache = tileCache;
 }
 
-- (unsigned)incrementRepaintCount
+- (void)resetPaintCount
 {
-    return ++_repaintCount;
+    _paintCount = 0;
 }
 
-- (unsigned)repaintCount
+- (unsigned)incrementPaintCount
 {
-    return _repaintCount;
+    return ++_paintCount;
 }
 
+- (unsigned)paintCount
+{
+    return _paintCount;
+}
+
 - (void)logFilledFreshTile
 {
     IntRect visiblePart(enclosingIntRect([self frame]));
     visiblePart.intersect(_tileCache->visibleRect());
 
-    if ([self repaintCount] == 1 && !visiblePart.isEmpty())
+    if ([self paintCount] == 1 && !visiblePart.isEmpty())
         WTFLogAlways("SCROLLING: Filled visible fresh tile. Time: %f Unfilled Pixels: %u\n", WTF::monotonicallyIncreasingTime(), _tileCache->blankPixelCount());
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to