<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[167041] trunk/Source/WebCore</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/167041">167041</a></dd>
<dt>Author</dt> <dd>antti@apple.com</dd>
<dt>Date</dt> <dd>2014-04-09 15:29:15 -0700 (Wed, 09 Apr 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>TileGrid should be PlatformCALayerClient instead of TileController
https://bugs.webkit.org/show_bug.cgi?id=131456
Reviewed by Tim Horton.
The client interface is for the tiles in the grid.
* platform/graphics/ca/mac/TileController.h:
* platform/graphics/ca/mac/TileController.mm:
(WebCore::TileController::setContentsScale):
(WebCore::TileController::createTileLayer):
(WebCore::TileController::platformCALayerPaintContents): Deleted.
(WebCore::TileController::platformCALayerDeviceScaleFactor): Deleted.
(WebCore::TileController::platformCALayerShowDebugBorders): Deleted.
(WebCore::TileController::platformCALayerShowRepaintCounter): Deleted.
(WebCore::TileController::platformCALayerIncrementRepaintCount): Deleted.
* platform/graphics/ca/mac/TileGrid.h:
Move repaint counter to TileGrid too.
* platform/graphics/ca/mac/TileGrid.mm:
(WebCore::TileGrid::removeTiles):
(WebCore::TileGrid::removeAllSecondaryTiles):
(WebCore::TileGrid::removeTilesInCohort):
Cleaned up tile removal.
(WebCore::TileGrid::revalidateTiles):
(WebCore::TileGrid::ensureTilesForRect):
(WebCore::TileGrid::platformCALayerPaintContents):
(WebCore::TileGrid::platformCALayerDeviceScaleFactor):
(WebCore::TileGrid::platformCALayerShowDebugBorders):
(WebCore::TileGrid::platformCALayerShowRepaintCounter):
(WebCore::TileGrid::platformCALayerContentsOpaque):
(WebCore::TileGrid::platformCALayerIncrementRepaintCount):
(WebCore::queueTileForRemoval): Deleted.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscamacTileControllerh">trunk/Source/WebCore/platform/graphics/ca/mac/TileController.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscamacTileControllermm">trunk/Source/WebCore/platform/graphics/ca/mac/TileController.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscamacTileGridh">trunk/Source/WebCore/platform/graphics/ca/mac/TileGrid.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscamacTileGridmm">trunk/Source/WebCore/platform/graphics/ca/mac/TileGrid.mm</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (167040 => 167041)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-04-09 22:24:42 UTC (rev 167040)
+++ trunk/Source/WebCore/ChangeLog        2014-04-09 22:29:15 UTC (rev 167041)
</span><span class="lines">@@ -1,3 +1,42 @@
</span><ins>+2014-04-09 Antti Koivisto <antti@apple.com>
+
+ TileGrid should be PlatformCALayerClient instead of TileController
+ https://bugs.webkit.org/show_bug.cgi?id=131456
+
+ Reviewed by Tim Horton.
+
+ The client interface is for the tiles in the grid.
+
+ * platform/graphics/ca/mac/TileController.h:
+ * platform/graphics/ca/mac/TileController.mm:
+ (WebCore::TileController::setContentsScale):
+ (WebCore::TileController::createTileLayer):
+ (WebCore::TileController::platformCALayerPaintContents): Deleted.
+ (WebCore::TileController::platformCALayerDeviceScaleFactor): Deleted.
+ (WebCore::TileController::platformCALayerShowDebugBorders): Deleted.
+ (WebCore::TileController::platformCALayerShowRepaintCounter): Deleted.
+ (WebCore::TileController::platformCALayerIncrementRepaintCount): Deleted.
+ * platform/graphics/ca/mac/TileGrid.h:
+
+ Move repaint counter to TileGrid too.
+
+ * platform/graphics/ca/mac/TileGrid.mm:
+ (WebCore::TileGrid::removeTiles):
+ (WebCore::TileGrid::removeAllSecondaryTiles):
+ (WebCore::TileGrid::removeTilesInCohort):
+
+ Cleaned up tile removal.
+
+ (WebCore::TileGrid::revalidateTiles):
+ (WebCore::TileGrid::ensureTilesForRect):
+ (WebCore::TileGrid::platformCALayerPaintContents):
+ (WebCore::TileGrid::platformCALayerDeviceScaleFactor):
+ (WebCore::TileGrid::platformCALayerShowDebugBorders):
+ (WebCore::TileGrid::platformCALayerShowRepaintCounter):
+ (WebCore::TileGrid::platformCALayerContentsOpaque):
+ (WebCore::TileGrid::platformCALayerIncrementRepaintCount):
+ (WebCore::queueTileForRemoval): Deleted.
+
</ins><span class="cx"> 2014-04-09 Alexey Proskuryakov <ap@apple.com>
</span><span class="cx">
</span><span class="cx"> Rename some dragging functions
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscamacTileControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/ca/mac/TileController.h (167040 => 167041)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/ca/mac/TileController.h        2014-04-09 22:24:42 UTC (rev 167040)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/TileController.h        2014-04-09 22:29:15 UTC (rev 167041)
</span><span class="lines">@@ -48,9 +48,8 @@
</span><span class="cx">
</span><span class="cx"> typedef Vector<RetainPtr<PlatformLayer>> PlatformLayerList;
</span><span class="cx">
</span><del>-class TileController final : public TiledBacking, public PlatformCALayerClient {
- WTF_MAKE_NONCOPYABLE(TileController);
-
</del><ins>+class TileController final : public TiledBacking {
+ WTF_MAKE_NONCOPYABLE(TileController); WTF_MAKE_FAST_ALLOCATED;
</ins><span class="cx"> public:
</span><span class="cx"> static PassOwnPtr<TileController> create(PlatformCALayer*);
</span><span class="cx"> ~TileController();
</span><span class="lines">@@ -104,6 +103,7 @@
</span><span class="cx"> virtual int rightMarginWidth() const override;
</span><span class="cx"> virtual TileCoverage tileCoverage() const override { return m_tileCoverage; }
</span><span class="cx"> virtual bool unparentsOffscreenTiles() const override { return m_unparentsOffscreenTiles; }
</span><ins>+ virtual bool scrollingPerformanceLoggingEnabled() const override { return m_scrollingPerformanceLoggingEnabled; }
</ins><span class="cx">
</span><span class="cx"> IntRect boundsWithoutMargin() const;
</span><span class="cx">
</span><span class="lines">@@ -117,12 +117,9 @@
</span><span class="cx"> bool shouldAggressivelyRetainTiles() const;
</span><span class="cx"> bool shouldTemporarilyRetainTileCohorts() const;
</span><span class="cx">
</span><del>- typedef HashMap<PlatformCALayer*, int> RepaintCountMap;
- RepaintCountMap& repaintCountMap() { return m_tileRepaintCounts; }
-
</del><span class="cx"> void updateTileCoverageMap();
</span><span class="cx">
</span><del>- RefPtr<PlatformCALayer> createTileLayer(const IntRect&);
</del><ins>+ RefPtr<PlatformCALayer> createTileLayer(const IntRect&, TileGrid&);
</ins><span class="cx">
</span><span class="cx"> const TileGrid& tileGrid() const { return *m_tileGrid; }
</span><span class="cx">
</span><span class="lines">@@ -144,7 +141,6 @@
</span><span class="cx"> virtual void forceRepaint() override;
</span><span class="cx"> virtual IntRect tileGridExtent() const override;
</span><span class="cx"> virtual void setScrollingPerformanceLoggingEnabled(bool flag) override { m_scrollingPerformanceLoggingEnabled = flag; }
</span><del>- virtual bool scrollingPerformanceLoggingEnabled() const override { return m_scrollingPerformanceLoggingEnabled; }
</del><span class="cx"> virtual void setUnparentsOffscreenTiles(bool flag) override { m_unparentsOffscreenTiles = flag; }
</span><span class="cx"> virtual double retainedTileBackingStoreMemory() const override;
</span><span class="cx"> virtual IntRect tileCoverageRect() const override;
</span><span class="lines">@@ -152,15 +148,6 @@
</span><span class="cx"> virtual void setScrollingModeIndication(ScrollingModeIndication) override;
</span><span class="cx"> virtual void setTileMargins(int marginTop, int marginBottom, int marginLeft, int marginRight) override;
</span><span class="cx">
</span><del>- // PlatformCALayerClient
- virtual void platformCALayerPaintContents(PlatformCALayer*, GraphicsContext&, const FloatRect&) override;
- virtual bool platformCALayerShowDebugBorders() const override;
- virtual bool platformCALayerShowRepaintCounter(PlatformCALayer*) const override;
- virtual int platformCALayerIncrementRepaintCount(PlatformCALayer*) override;
- virtual bool platformCALayerContentsOpaque() const override { return m_tilesAreOpaque; }
- virtual bool platformCALayerDrawsContent() const override { return true; }
- virtual float platformCALayerDeviceScaleFactor() const override;
-
</del><span class="cx"> void scheduleTileRevalidation(double interval);
</span><span class="cx"> void tileRevalidationTimerFired(Timer<TileController>*);
</span><span class="cx">
</span><span class="lines">@@ -181,8 +168,6 @@
</span><span class="cx">
</span><span class="cx"> Timer<TileController> m_tileRevalidationTimer;
</span><span class="cx">
</span><del>- RepaintCountMap m_tileRepaintCounts;
-
</del><span class="cx"> float m_contentsScale;
</span><span class="cx"> float m_deviceScaleFactor;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscamacTileControllermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/ca/mac/TileController.mm (167040 => 167041)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/ca/mac/TileController.mm        2014-04-09 22:24:42 UTC (rev 167040)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/TileController.mm        2014-04-09 22:29:15 UTC (rev 167041)
</span><span class="lines">@@ -26,7 +26,6 @@
</span><span class="cx"> #import "config.h"
</span><span class="cx"> #import "TileController.h"
</span><span class="cx">
</span><del>-#import "GraphicsContext.h"
</del><span class="cx"> #import "IntRect.h"
</span><span class="cx"> #import "PlatformCALayer.h"
</span><span class="cx"> #import "Region.h"
</span><span class="lines">@@ -35,7 +34,6 @@
</span><span class="cx"> #if !PLATFORM(IOS)
</span><span class="cx"> #import "LayerPool.h"
</span><span class="cx"> #endif
</span><del>-#import "WebLayer.h"
</del><span class="cx"> #import <wtf/MainThread.h>
</span><span class="cx"> #import <utility>
</span><span class="cx">
</span><span class="lines">@@ -103,59 +101,13 @@
</span><span class="cx"> tileGrid().setNeedsDisplayInRect(rect);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void TileController::platformCALayerPaintContents(PlatformCALayer* platformCALayer, GraphicsContext& context, const FloatRect&)
-{
-#if PLATFORM(IOS)
- if (pthread_main_np())
- WebThreadLock();
-#endif
-
- {
- GraphicsContextStateSaver stateSaver(context);
-
- FloatPoint3D layerOrigin = platformCALayer->position();
- context.translate(-layerOrigin.x(), -layerOrigin.y());
- context.scale(FloatSize(tileGrid().scale(), tileGrid().scale()));
-
- RepaintRectList dirtyRects = collectRectsToPaint(context.platformContext(), platformCALayer);
- drawLayerContents(context.platformContext(), m_tileCacheLayer, dirtyRects);
- }
-
- int repaintCount = platformCALayerIncrementRepaintCount(platformCALayer);
- if (owningGraphicsLayer()->platformCALayerShowRepaintCounter(0))
- drawRepaintIndicator(context.platformContext(), platformCALayer, repaintCount, cachedCGColor(m_tileDebugBorderColor, ColorSpaceDeviceRGB));
-
- if (scrollingPerformanceLoggingEnabled()) {
- FloatRect visiblePart(platformCALayer->position().x(), platformCALayer->position().y(), platformCALayer->bounds().size().width(), platformCALayer->bounds().size().height());
- visiblePart.intersect(visibleRect());
-
- if (repaintCount == 1 && !visiblePart.isEmpty())
- WTFLogAlways("SCROLLING: Filled visible fresh tile. Time: %f Unfilled Pixels: %u\n", WTF::monotonicallyIncreasingTime(), blankPixelCount());
- }
-}
-
-float TileController::platformCALayerDeviceScaleFactor() const
-{
- return owningGraphicsLayer()->platformCALayerDeviceScaleFactor();
-}
-
-bool TileController::platformCALayerShowDebugBorders() const
-{
- return owningGraphicsLayer()->platformCALayerShowDebugBorders();
-}
-
-bool TileController::platformCALayerShowRepaintCounter(PlatformCALayer*) const
-{
- return owningGraphicsLayer()->platformCALayerShowRepaintCounter(0);
-}
-
</del><span class="cx"> void TileController::setContentsScale(float scale)
</span><span class="cx"> {
</span><span class="cx"> m_contentsScale = scale;
</span><span class="cx">
</span><span class="cx"> ASSERT(owningGraphicsLayer()->isCommittingChanges());
</span><span class="cx">
</span><del>- float deviceScaleFactor = platformCALayerDeviceScaleFactor();
</del><ins>+ float deviceScaleFactor = owningGraphicsLayer()->platformCALayerDeviceScaleFactor();
</ins><span class="cx">
</span><span class="cx"> // The scale we get is the product of the page scale factor and device scale factor.
</span><span class="cx"> // Divide by the device scale factor so we'll get the page scale factor.
</span><span class="lines">@@ -478,7 +430,7 @@
</span><span class="cx"> return m_marginRight;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<PlatformCALayer> TileController::createTileLayer(const IntRect& tileRect)
</del><ins>+RefPtr<PlatformCALayer> TileController::createTileLayer(const IntRect& tileRect, TileGrid& grid)
</ins><span class="cx"> {
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx"> RefPtr<PlatformCALayer> layer;
</span><span class="lines">@@ -486,11 +438,10 @@
</span><span class="cx"> RefPtr<PlatformCALayer> layer = LayerPool::sharedPool()->takeLayerWithSize(tileRect.size());
</span><span class="cx"> #endif
</span><span class="cx">
</span><del>- if (layer) {
- m_tileRepaintCounts.remove(layer.get());
- layer->setOwner(this);
- } else
- layer = m_tileCacheLayer->createCompatibleLayer(PlatformCALayer::LayerTypeTiledBackingTileLayer, this);
</del><ins>+ if (layer)
+ layer->setOwner(&grid);
+ else
+ layer = m_tileCacheLayer->createCompatibleLayer(PlatformCALayer::LayerTypeTiledBackingTileLayer, &grid);
</ins><span class="cx">
</span><span class="cx"> layer->setAnchorPoint(FloatPoint3D());
</span><span class="cx"> layer->setBounds(FloatRect(FloatPoint(), tileRect.size()));
</span><span class="lines">@@ -514,18 +465,6 @@
</span><span class="cx"> return layer;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-int TileController::platformCALayerIncrementRepaintCount(PlatformCALayer* platformCALayer)
-{
- int repaintCount = 0;
-
- if (m_tileRepaintCounts.contains(platformCALayer))
- repaintCount = m_tileRepaintCounts.get(platformCALayer);
-
- m_tileRepaintCounts.set(platformCALayer, ++repaintCount);
-
- return repaintCount;
-}
-
</del><span class="cx"> Vector<RefPtr<PlatformCALayer>> TileController::containerLayers()
</span><span class="cx"> {
</span><span class="cx"> Vector<RefPtr<PlatformCALayer>> layerList(1);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscamacTileGridh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/ca/mac/TileGrid.h (167040 => 167041)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/ca/mac/TileGrid.h        2014-04-09 22:24:42 UTC (rev 167040)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/TileGrid.h        2014-04-09 22:29:15 UTC (rev 167041)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx">
</span><span class="cx"> #include "IntPointHash.h"
</span><span class="cx"> #include "IntRect.h"
</span><ins>+#include "PlatformCALayerClient.h"
</ins><span class="cx"> #include "Timer.h"
</span><span class="cx"> #include <wtf/Deque.h>
</span><span class="cx"> #include <wtf/HashMap.h>
</span><span class="lines">@@ -36,11 +37,12 @@
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><ins>+class GraphicsContext;
</ins><span class="cx"> class PlatformCALayer;
</span><span class="cx"> class TileController;
</span><span class="cx">
</span><del>-class TileGrid {
- WTF_MAKE_NONCOPYABLE(TileGrid);
</del><ins>+class TileGrid : public PlatformCALayerClient {
+ WTF_MAKE_NONCOPYABLE(TileGrid); WTF_MAKE_FAST_ALLOCATED;
</ins><span class="cx"> public:
</span><span class="cx"> TileGrid(TileController&);
</span><span class="cx"> ~TileGrid();
</span><span class="lines">@@ -109,6 +111,17 @@
</span><span class="cx"> TileCohort newestTileCohort() const;
</span><span class="cx"> TileCohort oldestTileCohort() const;
</span><span class="cx">
</span><ins>+ void removeTiles(Vector<TileGrid::TileIndex>& toRemove);
+
+ // PlatformCALayerClient
+ virtual void platformCALayerPaintContents(PlatformCALayer*, GraphicsContext&, const FloatRect&) override;
+ virtual bool platformCALayerShowDebugBorders() const override;
+ virtual bool platformCALayerShowRepaintCounter(PlatformCALayer*) const override;
+ virtual int platformCALayerIncrementRepaintCount(PlatformCALayer*) override;
+ virtual bool platformCALayerContentsOpaque() const override;
+ virtual bool platformCALayerDrawsContent() const override { return true; }
+ virtual float platformCALayerDeviceScaleFactor() const override;
+
</ins><span class="cx"> TileController& m_controller;
</span><span class="cx"> Ref<PlatformCALayer> m_containerLayer;
</span><span class="cx">
</span><span class="lines">@@ -132,6 +145,9 @@
</span><span class="cx"> TileCohortList m_cohortList;
</span><span class="cx">
</span><span class="cx"> Timer<TileGrid> m_cohortRemovalTimer;
</span><ins>+
+ typedef HashMap<PlatformCALayer*, int> RepaintCountMap;
+ RepaintCountMap m_tileRepaintCounts;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscamacTileGridmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/ca/mac/TileGrid.mm (167040 => 167041)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/ca/mac/TileGrid.mm        2014-04-09 22:24:42 UTC (rev 167040)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/TileGrid.mm        2014-04-09 22:29:15 UTC (rev 167041)
</span><span class="lines">@@ -26,9 +26,11 @@
</span><span class="cx"> #import "config.h"
</span><span class="cx"> #import "TileGrid.h"
</span><span class="cx">
</span><ins>+#import "GraphicsContext.h"
</ins><span class="cx"> #import "LayerPool.h"
</span><span class="cx"> #import "PlatformCALayer.h"
</span><span class="cx"> #import "TileController.h"
</span><ins>+#import "WebLayer.h"
</ins><span class="cx"> #import <wtf/MainThread.h>
</span><span class="cx">
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="lines">@@ -280,31 +282,30 @@
</span><span class="cx"> return TileController::blankPixelCountForTiles(tiles, m_controller.visibleRect(), IntPoint(0,0));
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static inline void queueTileForRemoval(const TileGrid::TileIndex& tileIndex, const TileGrid::TileInfo& tileInfo, Vector<TileGrid::TileIndex>& tilesToRemove, TileController::RepaintCountMap& repaintCounts)
</del><ins>+void TileGrid::removeTiles(Vector<TileGrid::TileIndex>& toRemove)
</ins><span class="cx"> {
</span><del>- tileInfo.layer->removeFromSuperlayer();
- repaintCounts.remove(tileInfo.layer.get());
- tilesToRemove.append(tileIndex);
</del><ins>+ for (size_t i = 0; i < toRemove.size(); ++i) {
+ TileInfo tileInfo = m_tiles.take(toRemove[i]);
+ tileInfo.layer->removeFromSuperlayer();
+ m_tileRepaintCounts.remove(tileInfo.layer.get());
+#if !PLATFORM(IOS)
+ LayerPool::sharedPool()->addLayer(tileInfo.layer);
+#endif
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void TileGrid::removeAllSecondaryTiles()
</span><span class="cx"> {
</span><span class="cx"> Vector<TileIndex> tilesToRemove;
</span><span class="cx">
</span><del>- for (TileMap::iterator it = m_tiles.begin(), end = m_tiles.end(); it != end; ++it) {
- const TileInfo& tileInfo = it->value;
</del><ins>+ for (auto& entry : m_tiles) {
+ const TileInfo& tileInfo = entry.value;
</ins><span class="cx"> if (tileInfo.cohort == VisibleTileCohort)
</span><span class="cx"> continue;
</span><del>-
- queueTileForRemoval(it->key, it->value, tilesToRemove, m_controller.repaintCountMap());
</del><ins>+ tilesToRemove.append(entry.key);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- for (size_t i = 0; i < tilesToRemove.size(); ++i) {
- TileInfo tileInfo = m_tiles.take(tilesToRemove[i]);
-#if !PLATFORM(IOS)
- LayerPool::sharedPool()->addLayer(tileInfo.layer);
-#endif
- }
</del><ins>+ removeTiles(tilesToRemove);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void TileGrid::removeTilesInCohort(TileCohort cohort)
</span><span class="lines">@@ -312,20 +313,14 @@
</span><span class="cx"> ASSERT(cohort != VisibleTileCohort);
</span><span class="cx"> Vector<TileIndex> tilesToRemove;
</span><span class="cx">
</span><del>- for (TileMap::iterator it = m_tiles.begin(), end = m_tiles.end(); it != end; ++it) {
- const TileInfo& tileInfo = it->value;
</del><ins>+ for (auto& entry : m_tiles) {
+ const TileInfo& tileInfo = entry.value;
</ins><span class="cx"> if (tileInfo.cohort != cohort)
</span><span class="cx"> continue;
</span><del>-
- queueTileForRemoval(it->key, it->value, tilesToRemove, m_controller.repaintCountMap());
</del><ins>+ tilesToRemove.append(entry.key);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- for (size_t i = 0; i < tilesToRemove.size(); ++i) {
- TileInfo tileInfo = m_tiles.take(tilesToRemove[i]);
-#if !PLATFORM(IOS)
- LayerPool::sharedPool()->addLayer(tileInfo.layer);
-#endif
- }
</del><ins>+ removeTiles(tilesToRemove);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void TileGrid::revalidateTiles(TileValidationPolicyFlags validationPolicy)
</span><span class="lines">@@ -429,13 +424,9 @@
</span><span class="cx"> getTileIndexRangeForRect(boundsInTileCoords, topLeftForBounds, bottomRightForBounds);
</span><span class="cx">
</span><span class="cx"> Vector<TileIndex> tilesToRemove;
</span><del>- for (TileMap::iterator it = m_tiles.begin(), end = m_tiles.end(); it != end; ++it) {
- const TileIndex& index = it->key;
- if (index.y() < topLeftForBounds.y()
- || index.y() > bottomRightForBounds.y()
- || index.x() < topLeftForBounds.x()
- || index.x() > bottomRightForBounds.x())
- queueTileForRemoval(index, it->value, tilesToRemove, m_controller.repaintCountMap());
</del><ins>+ for (auto& index : m_tiles.keys()) {
+ if (index.y() < topLeftForBounds.y() || index.y() > bottomRightForBounds.y() || index.x() < topLeftForBounds.x() || index.x() > bottomRightForBounds.x())
+ tilesToRemove.append(index);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> for (size_t i = 0, size = tilesToRemove.size(); i < size; ++i) {
</span><span class="lines">@@ -532,9 +523,10 @@
</span><span class="cx">
</span><span class="cx"> bool shouldChangeTileLayerFrame = false;
</span><span class="cx">
</span><del>- if (!tileInfo.layer)
- tileInfo.layer = m_controller.createTileLayer(tileRect);
- else {
</del><ins>+ if (!tileInfo.layer) {
+ tileInfo.layer = m_controller.createTileLayer(tileRect, *this);
+ ASSERT(!m_tileRepaintCounts.contains(tileInfo.layer.get()));
+ } else {
</ins><span class="cx"> // We already have a layer for this tile. Ensure that its size is correct.
</span><span class="cx"> FloatSize tileLayerSize(tileInfo.layer->bounds().size());
</span><span class="cx"> shouldChangeTileLayerFrame = tileLayerSize != FloatSize(tileRect.size());
</span><span class="lines">@@ -644,7 +636,70 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void TileGrid::platformCALayerPaintContents(PlatformCALayer* platformCALayer, GraphicsContext& context, const FloatRect&)
+{
</ins><span class="cx"> #if PLATFORM(IOS)
</span><ins>+ if (pthread_main_np())
+ WebThreadLock();
+#endif
+
+ {
+ GraphicsContextStateSaver stateSaver(context);
+
+ FloatPoint3D layerOrigin = platformCALayer->position();
+ context.translate(-layerOrigin.x(), -layerOrigin.y());
+ context.scale(FloatSize(m_scale, m_scale));
+
+ RepaintRectList dirtyRects = collectRectsToPaint(context.platformContext(), platformCALayer);
+ drawLayerContents(context.platformContext(), &m_controller.rootLayer(), dirtyRects);
+ }
+
+ int repaintCount = platformCALayerIncrementRepaintCount(platformCALayer);
+ if (m_controller.rootLayer().owner()->platformCALayerShowRepaintCounter(0))
+ drawRepaintIndicator(context.platformContext(), platformCALayer, repaintCount, cachedCGColor(m_controller.tileDebugBorderColor(), ColorSpaceDeviceRGB));
+
+ if (m_controller.scrollingPerformanceLoggingEnabled()) {
+ FloatRect visiblePart(platformCALayer->position().x(), platformCALayer->position().y(), platformCALayer->bounds().size().width(), platformCALayer->bounds().size().height());
+ visiblePart.intersect(m_controller.visibleRect());
+
+ if (repaintCount == 1 && !visiblePart.isEmpty())
+ WTFLogAlways("SCROLLING: Filled visible fresh tile. Time: %f Unfilled Pixels: %u\n", WTF::monotonicallyIncreasingTime(), blankPixelCount());
+ }
+}
+
+float TileGrid::platformCALayerDeviceScaleFactor() const
+{
+ return m_controller.rootLayer().owner()->platformCALayerDeviceScaleFactor();
+}
+
+bool TileGrid::platformCALayerShowDebugBorders() const
+{
+ return m_controller.rootLayer().owner()->platformCALayerShowDebugBorders();
+}
+
+bool TileGrid::platformCALayerShowRepaintCounter(PlatformCALayer*) const
+{
+ return m_controller.rootLayer().owner()->platformCALayerShowRepaintCounter(0);
+}
+
+bool TileGrid::platformCALayerContentsOpaque() const
+{
+ return m_controller.tilesAreOpaque();
+}
+
+int TileGrid::platformCALayerIncrementRepaintCount(PlatformCALayer* platformCALayer)
+{
+ int repaintCount = 0;
+
+ if (m_tileRepaintCounts.contains(platformCALayer))
+ repaintCount = m_tileRepaintCounts.get(platformCALayer);
+
+ m_tileRepaintCounts.set(platformCALayer, ++repaintCount);
+
+ return repaintCount;
+}
+
+#if PLATFORM(IOS)
</ins><span class="cx"> void TileGrid::removeUnparentedTilesNow()
</span><span class="cx"> {
</span><span class="cx"> while (!m_cohortList.isEmpty()) {
</span></span></pre>
</div>
</div>
</body>
</html>