<!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>[166529] trunk/Source</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/166529">166529</a></dd>
<dt>Author</dt> <dd>antti@apple.com</dd>
<dt>Date</dt> <dd>2014-03-31 14:18:23 -0700 (Mon, 31 Mar 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Rename TileCache to LegacyTileCache
https://bugs.webkit.org/show_bug.cgi?id=130986

Reviewed by Simon Fraser.

../WebCore: 

Rename iOS WebKit1 tile cache classes to reflect its status.
This also frees some good type names.

TileCache -&gt; LegacyTileCache
TileGrid -&gt; LegacyTileGrid
TileGridTile -&gt; LegacyTileGridTile
etc.

../WebKit/mac: 

* WebView/WebView.mm:
(+[WebView drainLayerPool]):
(+[WebView _setTileCacheLayerPoolCapacity:]):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCoreexpin">trunk/Source/WebCore/WebCore.exp.in</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCorepageFrameViewcpp">trunk/Source/WebCore/page/FrameView.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformScrollViewh">trunk/Source/WebCore/platform/ScrollView.h</a></li>
<li><a href="#trunkSourceWebCoreplatformiosScrollViewIOSmm">trunk/Source/WebCore/platform/ios/ScrollViewIOS.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformioswakWAKWindowh">trunk/Source/WebCore/platform/ios/wak/WAKWindow.h</a></li>
<li><a href="#trunkSourceWebCoreplatformioswakWAKWindowmm">trunk/Source/WebCore/platform/ios/wak/WAKWindow.mm</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayerCompositorcpp">trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp</a></li>
<li><a href="#trunkSourceWebKitmacChangeLog">trunk/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebViewmm">trunk/Source/WebKit/mac/WebView/WebView.mm</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreplatformiosLegacyTileCacheh">trunk/Source/WebCore/platform/ios/LegacyTileCache.h</a></li>
<li><a href="#trunkSourceWebCoreplatformiosLegacyTileCachemm">trunk/Source/WebCore/platform/ios/LegacyTileCache.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformiosLegacyTileGridh">trunk/Source/WebCore/platform/ios/LegacyTileGrid.h</a></li>
<li><a href="#trunkSourceWebCoreplatformiosLegacyTileGridmm">trunk/Source/WebCore/platform/ios/LegacyTileGrid.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformiosLegacyTileGridTileh">trunk/Source/WebCore/platform/ios/LegacyTileGridTile.h</a></li>
<li><a href="#trunkSourceWebCoreplatformiosLegacyTileGridTilemm">trunk/Source/WebCore/platform/ios/LegacyTileGridTile.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformiosLegacyTileLayerh">trunk/Source/WebCore/platform/ios/LegacyTileLayer.h</a></li>
<li><a href="#trunkSourceWebCoreplatformiosLegacyTileLayermm">trunk/Source/WebCore/platform/ios/LegacyTileLayer.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformiosLegacyTileLayerPoolh">trunk/Source/WebCore/platform/ios/LegacyTileLayerPool.h</a></li>
<li><a href="#trunkSourceWebCoreplatformiosLegacyTileLayerPoolmm">trunk/Source/WebCore/platform/ios/LegacyTileLayerPool.mm</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreplatformiosTileCacheh">trunk/Source/WebCore/platform/ios/TileCache.h</a></li>
<li><a href="#trunkSourceWebCoreplatformiosTileCachemm">trunk/Source/WebCore/platform/ios/TileCache.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformiosTileGridh">trunk/Source/WebCore/platform/ios/TileGrid.h</a></li>
<li><a href="#trunkSourceWebCoreplatformiosTileGridmm">trunk/Source/WebCore/platform/ios/TileGrid.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformiosTileGridTileh">trunk/Source/WebCore/platform/ios/TileGridTile.h</a></li>
<li><a href="#trunkSourceWebCoreplatformiosTileGridTilemm">trunk/Source/WebCore/platform/ios/TileGridTile.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformiosTileLayerh">trunk/Source/WebCore/platform/ios/TileLayer.h</a></li>
<li><a href="#trunkSourceWebCoreplatformiosTileLayermm">trunk/Source/WebCore/platform/ios/TileLayer.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformiosTileLayerPoolh">trunk/Source/WebCore/platform/ios/TileLayerPool.h</a></li>
<li><a href="#trunkSourceWebCoreplatformiosTileLayerPoolmm">trunk/Source/WebCore/platform/ios/TileLayerPool.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (166528 => 166529)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-03-31 21:10:44 UTC (rev 166528)
+++ trunk/Source/WebCore/ChangeLog        2014-03-31 21:18:23 UTC (rev 166529)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2014-03-31  Antti Koivisto  &lt;antti@apple.com&gt;
+
+        Rename TileCache to LegacyTileCache
+        https://bugs.webkit.org/show_bug.cgi?id=130986
+
+        Reviewed by Simon Fraser.
+
+        Rename iOS WebKit1 tile cache classes to reflect its status.
+        This also frees some good type names.
+
+        TileCache -&gt; LegacyTileCache
+        TileGrid -&gt; LegacyTileGrid
+        TileGridTile -&gt; LegacyTileGridTile
+        etc.
+
</ins><span class="cx"> 2014-03-31  Tim Horton  &lt;timothy_horton@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Small adjustments to WebCore::IOSurface
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.exp.in (166528 => 166529)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.exp.in        2014-03-31 21:10:44 UTC (rev 166528)
+++ trunk/Source/WebCore/WebCore.exp.in        2014-03-31 21:18:23 UTC (rev 166529)
</span><span class="lines">@@ -2482,6 +2482,8 @@
</span><span class="cx"> __ZN7WebCore15GraphicsContext22setEmojiDrawingEnabledEb
</span><span class="cx"> __ZN7WebCore15GraphicsContext23setIsAcceleratedContextEb
</span><span class="cx"> __ZN7WebCore15GraphicsContextC1EP9CGContextb
</span><ins>+__ZN7WebCore15LegacyTileCache14drainLayerPoolEv
+__ZN7WebCore15LegacyTileCache20setLayerPoolCapacityEj
</ins><span class="cx"> __ZN7WebCore15QuickLookHandle10nsResponseEv
</span><span class="cx"> __ZN7WebCore15QuickLookHandle14didReceiveDataEPK8__CFData
</span><span class="cx"> __ZN7WebCore15QuickLookHandle16didFinishLoadingEv
</span><span class="lines">@@ -2636,8 +2638,6 @@
</span><span class="cx"> __ZN7WebCore9FrameView35setUseCustomFixedPositionLayoutRectEb
</span><span class="cx"> __ZN7WebCore9FrameView36scheduleLayerFlushAllowingThrottlingEv
</span><span class="cx"> __ZN7WebCore9PageGroup17removeVisitedLinkERKNS_3URLE
</span><del>-__ZN7WebCore9TileCache14drainLayerPoolEv
-__ZN7WebCore9TileCache20setLayerPoolCapacityEj
</del><span class="cx"> __ZNK7WebCore10FloatPointcv7CGPointEv
</span><span class="cx"> __ZNK7WebCore10ScrollView21unobscuredContentRectENS_14ScrollableArea36VisibleContentRectIncludesScrollbarsE
</span><span class="cx"> __ZNK7WebCore14DocumentLoader16responseMIMETypeEv
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (166528 => 166529)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-03-31 21:10:44 UTC (rev 166528)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-03-31 21:18:23 UTC (rev 166529)
</span><span class="lines">@@ -5975,8 +5975,8 @@
</span><span class="cx">                 E1FF8F6C180DB5BE00132674 /* CryptoAlgorithmRegistry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1FF8F6A180DB5BE00132674 /* CryptoAlgorithmRegistry.cpp */; };
</span><span class="cx">                 E1FF8F6D180DB5BE00132674 /* CryptoAlgorithmRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = E1FF8F6B180DB5BE00132674 /* CryptoAlgorithmRegistry.h */; };
</span><span class="cx">                 E401C27517CE53EC00C41A35 /* ElementIteratorAssertions.h in Headers */ = {isa = PBXBuildFile; fileRef = E401C27417CE53EC00C41A35 /* ElementIteratorAssertions.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><del>-                E424A39E1330DF0100CF6DC9 /* TileGridTile.h in Headers */ = {isa = PBXBuildFile; fileRef = E424A39D1330DF0100CF6DC9 /* TileGridTile.h */; };
-                E424A3A01330DF1E00CF6DC9 /* TileGridTile.mm in Sources */ = {isa = PBXBuildFile; fileRef = E424A39F1330DF1E00CF6DC9 /* TileGridTile.mm */; };
</del><ins>+                E424A39E1330DF0100CF6DC9 /* LegacyTileGridTile.h in Headers */ = {isa = PBXBuildFile; fileRef = E424A39D1330DF0100CF6DC9 /* LegacyTileGridTile.h */; };
+                E424A3A01330DF1E00CF6DC9 /* LegacyTileGridTile.mm in Sources */ = {isa = PBXBuildFile; fileRef = E424A39F1330DF1E00CF6DC9 /* LegacyTileGridTile.mm */; };
</ins><span class="cx">                 E425A49A18292B840020CFCF /* CollectionIndexCache.h in Headers */ = {isa = PBXBuildFile; fileRef = E425A49918292B840020CFCF /* CollectionIndexCache.h */; };
</span><span class="cx">                 E4295FA412B0614E00D1ACE0 /* ResourceLoadPriority.h in Headers */ = {isa = PBXBuildFile; fileRef = E4295FA312B0614E00D1ACE0 /* ResourceLoadPriority.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 E43105B816750F0C00DB2FB8 /* NodeTraversal.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E43105B716750F0C00DB2FB8 /* NodeTraversal.cpp */; };
</span><span class="lines">@@ -6057,10 +6057,10 @@
</span><span class="cx">                 E4AFD00E0DAF335500F5F55C /* SMILTimeContainer.h in Headers */ = {isa = PBXBuildFile; fileRef = E4AFD0080DAF335400F5F55C /* SMILTimeContainer.h */; };
</span><span class="cx">                 E4AFD00F0DAF335500F5F55C /* SVGSMILElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4AFD0090DAF335400F5F55C /* SVGSMILElement.cpp */; };
</span><span class="cx">                 E4AFD0100DAF335500F5F55C /* SVGSMILElement.h in Headers */ = {isa = PBXBuildFile; fileRef = E4AFD00A0DAF335400F5F55C /* SVGSMILElement.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><del>-                E4B65A58132FA8E70070E7BE /* TileGrid.h in Headers */ = {isa = PBXBuildFile; fileRef = E4B65A57132FA8E70070E7BE /* TileGrid.h */; };
-                E4B65A5A132FAAF90070E7BE /* TileGrid.mm in Sources */ = {isa = PBXBuildFile; fileRef = E4B65A59132FAAF90070E7BE /* TileGrid.mm */; };
-                E4B65A5C132FACB00070E7BE /* TileLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = E4B65A5B132FACB00070E7BE /* TileLayer.h */; };
-                E4B65A5E132FADB60070E7BE /* TileLayer.mm in Sources */ = {isa = PBXBuildFile; fileRef = E4B65A5D132FADB60070E7BE /* TileLayer.mm */; };
</del><ins>+                E4B65A58132FA8E70070E7BE /* LegacyTileGrid.h in Headers */ = {isa = PBXBuildFile; fileRef = E4B65A57132FA8E70070E7BE /* LegacyTileGrid.h */; };
+                E4B65A5A132FAAF90070E7BE /* LegacyTileGrid.mm in Sources */ = {isa = PBXBuildFile; fileRef = E4B65A59132FAAF90070E7BE /* LegacyTileGrid.mm */; };
+                E4B65A5C132FACB00070E7BE /* LegacyTileLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = E4B65A5B132FACB00070E7BE /* LegacyTileLayer.h */; };
+                E4B65A5E132FADB60070E7BE /* LegacyTileLayer.mm in Sources */ = {isa = PBXBuildFile; fileRef = E4B65A5D132FADB60070E7BE /* LegacyTileLayer.mm */; };
</ins><span class="cx">                 E4BBED0E14F4025D003F0B98 /* PropertySetCSSStyleDeclaration.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4BBED0C14F4025D003F0B98 /* PropertySetCSSStyleDeclaration.cpp */; };
</span><span class="cx">                 E4BBED0F14F4025D003F0B98 /* PropertySetCSSStyleDeclaration.h in Headers */ = {isa = PBXBuildFile; fileRef = E4BBED0D14F4025D003F0B98 /* PropertySetCSSStyleDeclaration.h */; };
</span><span class="cx">                 E4BBED4C14FCDBA1003F0B98 /* StyleRule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4BBED4A14FCDBA1003F0B98 /* StyleRule.cpp */; };
</span><span class="lines">@@ -6069,8 +6069,8 @@
</span><span class="cx">                 E4C1789B0EE6903800824D69 /* CSSSelectorList.h in Headers */ = {isa = PBXBuildFile; fileRef = E4C178960EE6903800824D69 /* CSSSelectorList.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 E4C279580CF9741900E97B98 /* RenderMedia.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4C279560CF9741900E97B98 /* RenderMedia.cpp */; };
</span><span class="cx">                 E4C279590CF9741900E97B98 /* RenderMedia.h in Headers */ = {isa = PBXBuildFile; fileRef = E4C279570CF9741900E97B98 /* RenderMedia.h */; };
</span><del>-                E4C3B1FA0F0E4161009693F6 /* TileCache.h in Headers */ = {isa = PBXBuildFile; fileRef = E4C3B1F90F0E4161009693F6 /* TileCache.h */; settings = {ATTRIBUTES = (Private, ); }; };
-                E4C3B1FC0F0E4170009693F6 /* TileCache.mm in Sources */ = {isa = PBXBuildFile; fileRef = E4C3B1FB0F0E4170009693F6 /* TileCache.mm */; };
</del><ins>+                E4C3B1FA0F0E4161009693F6 /* LegacyTileCache.h in Headers */ = {isa = PBXBuildFile; fileRef = E4C3B1F90F0E4161009693F6 /* LegacyTileCache.h */; settings = {ATTRIBUTES = (Private, ); }; };
+                E4C3B1FC0F0E4170009693F6 /* LegacyTileCache.mm in Sources */ = {isa = PBXBuildFile; fileRef = E4C3B1FB0F0E4170009693F6 /* LegacyTileCache.mm */; };
</ins><span class="cx">                 E4C91A0E1802343100A17F6D /* TextPaintStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = E4C91A0D1802343100A17F6D /* TextPaintStyle.h */; };
</span><span class="cx">                 E4C91A101802343900A17F6D /* TextPaintStyle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4C91A0F1802343900A17F6D /* TextPaintStyle.cpp */; };
</span><span class="cx">                 E4C91A16180999F100A17F6D /* RenderTextLineBoxes.h in Headers */ = {isa = PBXBuildFile; fileRef = E4C91A15180999F100A17F6D /* RenderTextLineBoxes.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -6086,8 +6086,8 @@
</span><span class="cx">                 E4D988B617BFEB210084FB88 /* TextNodeTraversal.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4D988B517BFEB210084FB88 /* TextNodeTraversal.cpp */; };
</span><span class="cx">                 E4DEAA1717A93DC3000E0430 /* StyleResolveTree.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4DEAA1517A93DC3000E0430 /* StyleResolveTree.cpp */; };
</span><span class="cx">                 E4DEAA1817A93DC3000E0430 /* StyleResolveTree.h in Headers */ = {isa = PBXBuildFile; fileRef = E4DEAA1617A93DC3000E0430 /* StyleResolveTree.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><del>-                E4E39AFB1330EFA8003AB274 /* TileLayerPool.h in Headers */ = {isa = PBXBuildFile; fileRef = E4E39AFA1330EFA8003AB274 /* TileLayerPool.h */; };
-                E4E39AFD1330EFC6003AB274 /* TileLayerPool.mm in Sources */ = {isa = PBXBuildFile; fileRef = E4E39AFC1330EFC5003AB274 /* TileLayerPool.mm */; };
</del><ins>+                E4E39AFB1330EFA8003AB274 /* LegacyTileLayerPool.h in Headers */ = {isa = PBXBuildFile; fileRef = E4E39AFA1330EFA8003AB274 /* LegacyTileLayerPool.h */; };
+                E4E39AFD1330EFC6003AB274 /* LegacyTileLayerPool.mm in Sources */ = {isa = PBXBuildFile; fileRef = E4E39AFC1330EFC5003AB274 /* LegacyTileLayerPool.mm */; };
</ins><span class="cx">                 E4E9B1191810916F003ACCDF /* SimpleLineLayoutResolver.h in Headers */ = {isa = PBXBuildFile; fileRef = E4E9B1181810916F003ACCDF /* SimpleLineLayoutResolver.h */; };
</span><span class="cx">                 E4E9B11B18145692003ACCDF /* SimpleLineLayoutFunctions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4E9B11A18145692003ACCDF /* SimpleLineLayoutFunctions.cpp */; };
</span><span class="cx">                 E4E9B11D1814569C003ACCDF /* SimpleLineLayoutFunctions.h in Headers */ = {isa = PBXBuildFile; fileRef = E4E9B11C1814569C003ACCDF /* SimpleLineLayoutFunctions.h */; };
</span><span class="lines">@@ -13365,8 +13365,8 @@
</span><span class="cx">                 E406F3FB1198307D009D59D6 /* ColorData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ColorData.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E41EA038119836DB00710BC5 /* CSSPropertyNames.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSPropertyNames.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E41EA0391198374900710BC5 /* CSSValueKeywords.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSValueKeywords.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                E424A39D1330DF0100CF6DC9 /* TileGridTile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TileGridTile.h; path = ios/TileGridTile.h; sourceTree = &quot;&lt;group&gt;&quot;; };
-                E424A39F1330DF1E00CF6DC9 /* TileGridTile.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = TileGridTile.mm; path = ios/TileGridTile.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><ins>+                E424A39D1330DF0100CF6DC9 /* LegacyTileGridTile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LegacyTileGridTile.h; path = ios/LegacyTileGridTile.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                E424A39F1330DF1E00CF6DC9 /* LegacyTileGridTile.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = LegacyTileGridTile.mm; path = ios/LegacyTileGridTile.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 E425A49918292B840020CFCF /* CollectionIndexCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CollectionIndexCache.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E4295FA312B0614E00D1ACE0 /* ResourceLoadPriority.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceLoadPriority.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E43105B716750F0C00DB2FB8 /* NodeTraversal.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NodeTraversal.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -13456,10 +13456,10 @@
</span><span class="cx">                 E4B423800CBFB73C00AF2ECE /* JSHTMLMediaElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSHTMLMediaElement.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E4B423850CBFB73C00AF2ECE /* JSProgressEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSProgressEvent.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E4B423860CBFB73C00AF2ECE /* JSProgressEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSProgressEvent.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                E4B65A57132FA8E70070E7BE /* TileGrid.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TileGrid.h; path = ios/TileGrid.h; sourceTree = &quot;&lt;group&gt;&quot;; };
-                E4B65A59132FAAF90070E7BE /* TileGrid.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = TileGrid.mm; path = ios/TileGrid.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
-                E4B65A5B132FACB00070E7BE /* TileLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TileLayer.h; path = ios/TileLayer.h; sourceTree = &quot;&lt;group&gt;&quot;; };
-                E4B65A5D132FADB60070E7BE /* TileLayer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = TileLayer.mm; path = ios/TileLayer.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><ins>+                E4B65A57132FA8E70070E7BE /* LegacyTileGrid.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LegacyTileGrid.h; path = ios/LegacyTileGrid.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                E4B65A59132FAAF90070E7BE /* LegacyTileGrid.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = LegacyTileGrid.mm; path = ios/LegacyTileGrid.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
+                E4B65A5B132FACB00070E7BE /* LegacyTileLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LegacyTileLayer.h; path = ios/LegacyTileLayer.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                E4B65A5D132FADB60070E7BE /* LegacyTileLayer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = LegacyTileLayer.mm; path = ios/LegacyTileLayer.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 E4BBED0C14F4025D003F0B98 /* PropertySetCSSStyleDeclaration.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PropertySetCSSStyleDeclaration.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E4BBED0D14F4025D003F0B98 /* PropertySetCSSStyleDeclaration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PropertySetCSSStyleDeclaration.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E4BBED4A14FCDBA1003F0B98 /* StyleRule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StyleRule.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -13468,8 +13468,8 @@
</span><span class="cx">                 E4C178960EE6903800824D69 /* CSSSelectorList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSSelectorList.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E4C279560CF9741900E97B98 /* RenderMedia.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderMedia.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E4C279570CF9741900E97B98 /* RenderMedia.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderMedia.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                E4C3B1F90F0E4161009693F6 /* TileCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TileCache.h; path = ios/TileCache.h; sourceTree = &quot;&lt;group&gt;&quot;; };
-                E4C3B1FB0F0E4170009693F6 /* TileCache.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = TileCache.mm; path = ios/TileCache.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><ins>+                E4C3B1F90F0E4161009693F6 /* LegacyTileCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LegacyTileCache.h; path = ios/LegacyTileCache.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                E4C3B1FB0F0E4170009693F6 /* LegacyTileCache.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = LegacyTileCache.mm; path = ios/LegacyTileCache.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 E4C91A0D1802343100A17F6D /* TextPaintStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextPaintStyle.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E4C91A0F1802343900A17F6D /* TextPaintStyle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextPaintStyle.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E4C91A15180999F100A17F6D /* RenderTextLineBoxes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderTextLineBoxes.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -13485,8 +13485,8 @@
</span><span class="cx">                 E4D988B517BFEB210084FB88 /* TextNodeTraversal.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextNodeTraversal.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E4DEAA1517A93DC3000E0430 /* StyleResolveTree.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StyleResolveTree.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E4DEAA1617A93DC3000E0430 /* StyleResolveTree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleResolveTree.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                E4E39AFA1330EFA8003AB274 /* TileLayerPool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TileLayerPool.h; path = ios/TileLayerPool.h; sourceTree = &quot;&lt;group&gt;&quot;; };
-                E4E39AFC1330EFC5003AB274 /* TileLayerPool.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = TileLayerPool.mm; path = ios/TileLayerPool.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><ins>+                E4E39AFA1330EFA8003AB274 /* LegacyTileLayerPool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LegacyTileLayerPool.h; path = ios/LegacyTileLayerPool.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                E4E39AFC1330EFC5003AB274 /* LegacyTileLayerPool.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = LegacyTileLayerPool.mm; path = ios/LegacyTileLayerPool.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 E4E9B1181810916F003ACCDF /* SimpleLineLayoutResolver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SimpleLineLayoutResolver.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E4E9B11A18145692003ACCDF /* SimpleLineLayoutFunctions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SimpleLineLayoutFunctions.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E4E9B11C1814569C003ACCDF /* SimpleLineLayoutFunctions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SimpleLineLayoutFunctions.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -18140,18 +18140,18 @@
</span><span class="cx">                                 E45390AD0EAFF4B5003695C8 /* SystemMemoryIOS.cpp */,
</span><span class="cx">                                 44C9919D0F3D210E00586670 /* ThemeIOS.h */,
</span><span class="cx">                                 44C9919E0F3D210E00586670 /* ThemeIOS.mm */,
</span><del>-                                E4C3B1F90F0E4161009693F6 /* TileCache.h */,
-                                E4C3B1FB0F0E4170009693F6 /* TileCache.mm */,
</del><ins>+                                E4C3B1F90F0E4161009693F6 /* LegacyTileCache.h */,
+                                E4C3B1FB0F0E4170009693F6 /* LegacyTileCache.mm */,
</ins><span class="cx">                                 1F72BF08187FD4270009BCB3 /* TileControllerMemoryHandlerIOS.cpp */,
</span><span class="cx">                                 1F72BF09187FD4270009BCB3 /* TileControllerMemoryHandlerIOS.h */,
</span><del>-                                E4B65A57132FA8E70070E7BE /* TileGrid.h */,
-                                E4B65A59132FAAF90070E7BE /* TileGrid.mm */,
-                                E424A39D1330DF0100CF6DC9 /* TileGridTile.h */,
-                                E424A39F1330DF1E00CF6DC9 /* TileGridTile.mm */,
-                                E4B65A5B132FACB00070E7BE /* TileLayer.h */,
-                                E4B65A5D132FADB60070E7BE /* TileLayer.mm */,
-                                E4E39AFA1330EFA8003AB274 /* TileLayerPool.h */,
-                                E4E39AFC1330EFC5003AB274 /* TileLayerPool.mm */,
</del><ins>+                                E4B65A57132FA8E70070E7BE /* LegacyTileGrid.h */,
+                                E4B65A59132FAAF90070E7BE /* LegacyTileGrid.mm */,
+                                E424A39D1330DF0100CF6DC9 /* LegacyTileGridTile.h */,
+                                E424A39F1330DF1E00CF6DC9 /* LegacyTileGridTile.mm */,
+                                E4B65A5B132FACB00070E7BE /* LegacyTileLayer.h */,
+                                E4B65A5D132FADB60070E7BE /* LegacyTileLayer.mm */,
+                                E4E39AFA1330EFA8003AB274 /* LegacyTileLayerPool.h */,
+                                E4E39AFC1330EFC5003AB274 /* LegacyTileLayerPool.mm */,
</ins><span class="cx">                                 31403797124BEA7F00AF40E4 /* WebCoreMotionManager.h */,
</span><span class="cx">                                 31403798124BEA7F00AF40E4 /* WebCoreMotionManager.mm */,
</span><span class="cx">                                 44C3CFE71556BE5D00013609 /* WebCoreSystemInterfaceIOS.h */,
</span><span class="lines">@@ -25955,14 +25955,14 @@
</span><span class="cx">                                 0F6383DE18615B29003E5DB5 /* ThreadedScrollingTree.h in Headers */,
</span><span class="cx">                                 E1FF57A30F01255B00891EBB /* ThreadGlobalData.h in Headers */,
</span><span class="cx">                                 185BCF290F3279CE000EA262 /* ThreadTimers.h in Headers */,
</span><del>-                                E4C3B1FA0F0E4161009693F6 /* TileCache.h in Headers */,
</del><ins>+                                E4C3B1FA0F0E4161009693F6 /* LegacyTileCache.h in Headers */,
</ins><span class="cx">                                 1AA7160B149BC4DB0016EC19 /* TileController.h in Headers */,
</span><span class="cx">                                 1F72BF0B187FD45C0009BCB3 /* TileControllerMemoryHandlerIOS.h in Headers */,
</span><span class="cx">                                 1AF89A421518FDEA00E547B5 /* TiledBacking.h in Headers */,
</span><del>-                                E4B65A58132FA8E70070E7BE /* TileGrid.h in Headers */,
-                                E424A39E1330DF0100CF6DC9 /* TileGridTile.h in Headers */,
-                                E4B65A5C132FACB00070E7BE /* TileLayer.h in Headers */,
-                                E4E39AFB1330EFA8003AB274 /* TileLayerPool.h in Headers */,
</del><ins>+                                E4B65A58132FA8E70070E7BE /* LegacyTileGrid.h in Headers */,
+                                E424A39E1330DF0100CF6DC9 /* LegacyTileGridTile.h in Headers */,
+                                E4B65A5C132FACB00070E7BE /* LegacyTileLayer.h in Headers */,
+                                E4E39AFB1330EFA8003AB274 /* LegacyTileLayerPool.h in Headers */,
</ins><span class="cx">                                 498770F31242C535002226BA /* TilingData.h in Headers */,
</span><span class="cx">                                 F55B3DDC1251F12D003EF269 /* TimeInputType.h in Headers */,
</span><span class="cx">                                 7553CFE8108F473F00EA281E /* TimelineRecordFactory.h in Headers */,
</span><span class="lines">@@ -29207,13 +29207,13 @@
</span><span class="cx">                                 0F6383DD18615B29003E5DB5 /* ThreadedScrollingTree.cpp in Sources */,
</span><span class="cx">                                 E1FF57A60F01256B00891EBB /* ThreadGlobalData.cpp in Sources */,
</span><span class="cx">                                 185BCF280F3279CE000EA262 /* ThreadTimers.cpp in Sources */,
</span><del>-                                E4C3B1FC0F0E4170009693F6 /* TileCache.mm in Sources */,
</del><ins>+                                E4C3B1FC0F0E4170009693F6 /* LegacyTileCache.mm in Sources */,
</ins><span class="cx">                                 1AA7160A149BC4DB0016EC19 /* TileController.mm in Sources */,
</span><span class="cx">                                 1F72BF0A187FD4490009BCB3 /* TileControllerMemoryHandlerIOS.cpp in Sources */,
</span><del>-                                E4B65A5A132FAAF90070E7BE /* TileGrid.mm in Sources */,
-                                E424A3A01330DF1E00CF6DC9 /* TileGridTile.mm in Sources */,
-                                E4B65A5E132FADB60070E7BE /* TileLayer.mm in Sources */,
-                                E4E39AFD1330EFC6003AB274 /* TileLayerPool.mm in Sources */,
</del><ins>+                                E4B65A5A132FAAF90070E7BE /* LegacyTileGrid.mm in Sources */,
+                                E424A3A01330DF1E00CF6DC9 /* LegacyTileGridTile.mm in Sources */,
+                                E4B65A5E132FADB60070E7BE /* LegacyTileLayer.mm in Sources */,
+                                E4E39AFD1330EFC6003AB274 /* LegacyTileLayerPool.mm in Sources */,
</ins><span class="cx">                                 498770F21242C535002226BA /* TilingData.cpp in Sources */,
</span><span class="cx">                                 F55B3DDB1251F12D003EF269 /* TimeInputType.cpp in Sources */,
</span><span class="cx">                                 7553CFE9108F473F00EA281E /* TimelineRecordFactory.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCorepageFrameViewcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/FrameView.cpp (166528 => 166529)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/FrameView.cpp        2014-03-31 21:10:44 UTC (rev 166528)
+++ trunk/Source/WebCore/page/FrameView.cpp        2014-03-31 21:18:23 UTC (rev 166529)
</span><span class="lines">@@ -95,11 +95,11 @@
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx"> #include &quot;DocumentLoader.h&quot;
</span><ins>+#include &quot;LegacyTileCache.h&quot;
</ins><span class="cx"> #include &quot;Logging.h&quot;
</span><span class="cx"> #include &quot;MemoryCache.h&quot;
</span><span class="cx"> #include &quot;MemoryPressureHandler.h&quot;
</span><span class="cx"> #include &quot;SystemMemory.h&quot;
</span><del>-#include &quot;TileCache.h&quot;
</del><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
</span><span class="lines">@@ -378,8 +378,8 @@
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx">     // To avoid flashes of white, disable tile updates immediately when view is cleared at the beginning of a page load.
</span><span class="cx">     // Tiling will be re-enabled from UIKit via [WAKWindow setTilingMode:] when we have content to draw.
</span><del>-    if (TileCache* tileCache = this-&gt;tileCache())
-        tileCache-&gt;setTilingMode(TileCache::Disabled);
</del><ins>+    if (LegacyTileCache* tileCache = legacyTileCache())
+        tileCache-&gt;setTilingMode(LegacyTileCache::Disabled);
</ins><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -860,7 +860,7 @@
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span><del>-    if (TileCache* tileCache = this-&gt;tileCache())
</del><ins>+    if (LegacyTileCache* tileCache = legacyTileCache())
</ins><span class="cx">         tileCache-&gt;doPendingRepaints();
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="lines">@@ -2243,7 +2243,7 @@
</span><span class="cx">     if (renderView &amp;&amp; renderView-&gt;layer()-&gt;backing())
</span><span class="cx">         renderView-&gt;layer()-&gt;backing()-&gt;adjustTiledBackingCoverage();
</span><span class="cx"> #if PLATFORM(IOS)
</span><del>-    if (TileCache* tileCache = this-&gt;tileCache())
</del><ins>+    if (LegacyTileCache* tileCache = legacyTileCache())
</ins><span class="cx">         tileCache-&gt;setSpeculativeTileCreationEnabled(m_speculativeTilingEnabled);
</span><span class="cx"> #endif
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformScrollViewh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ScrollView.h (166528 => 166529)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ScrollView.h        2014-03-31 21:10:44 UTC (rev 166528)
+++ trunk/Source/WebCore/platform/ScrollView.h        2014-03-31 21:18:23 UTC (rev 166529)
</span><span class="lines">@@ -60,8 +60,8 @@
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> class HostWindow;
</span><ins>+class LegacyTileCache;
</ins><span class="cx"> class Scrollbar;
</span><del>-class TileCache;
</del><span class="cx"> 
</span><span class="cx"> class ScrollView : public Widget, public ScrollableArea {
</span><span class="cx"> public:
</span><span class="lines">@@ -190,7 +190,7 @@
</span><span class="cx">     FloatRect computeCoverageRect(double horizontalMargin, double verticalMargin) const;
</span><span class="cx"> 
</span><span class="cx">     void setActualScrollPosition(const IntPoint&amp;);
</span><del>-    TileCache* tileCache();
</del><ins>+    LegacyTileCache* legacyTileCache();
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     // visibleContentRect().size() is computed from unscaledUnobscuredVisibleContentSize() divided by the value of visibleContentScaleFactor.
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformiosLegacyTileCachehfromrev166453trunkSourceWebCoreplatformiosTileCacheh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/ios/LegacyTileCache.h (from rev 166453, trunk/Source/WebCore/platform/ios/TileCache.h) (0 => 166529)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/LegacyTileCache.h                                (rev 0)
+++ trunk/Source/WebCore/platform/ios/LegacyTileCache.h        2014-03-31 21:18:23 UTC (rev 166529)
</span><span class="lines">@@ -0,0 +1,218 @@
</span><ins>+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef LegacyTileCache_h
+#define LegacyTileCache_h
+
+#if PLATFORM(IOS)
+
+#include &quot;Color.h&quot;
+#include &quot;FloatRect.h&quot;
+#include &quot;IntRect.h&quot;
+#include &quot;IntSize.h&quot;
+#include &quot;Timer.h&quot;
+#include &lt;wtf/Noncopyable.h&gt;
+#include &lt;wtf/OwnPtr.h&gt;
+#include &lt;wtf/PassOwnPtr.h&gt;
+#include &lt;wtf/PassRefPtr.h&gt;
+#include &lt;wtf/RetainPtr.h&gt;
+#include &lt;wtf/Threading.h&gt;
+#include &lt;wtf/Vector.h&gt;
+
+#ifdef __OBJC__
+@class CALayer;
+@class LegacyTileCacheTombstone;
+@class LegacyTileLayer;
+@class WAKWindow;
+#else
+class CALayer;
+class LegacyTileCacheTombstone;
+class LegacyTileLayer;
+class WAKWindow;
+#endif
+
+namespace WebCore {
+
+class LegacyTileGrid;
+
+class LegacyTileCache {
+    WTF_MAKE_NONCOPYABLE(LegacyTileCache);
+public:
+    LegacyTileCache(WAKWindow*);
+    ~LegacyTileCache();
+
+    CGFloat screenScale() const;
+
+    void setNeedsDisplay();
+    void setNeedsDisplayInRect(const IntRect&amp;);
+    
+    void layoutTiles();
+    void layoutTilesNow();
+    void layoutTilesNowForRect(const IntRect&amp;);
+    void removeAllNonVisibleTiles();
+    void removeAllTiles();
+    void removeForegroundTiles();
+
+    // If 'contentReplacementImage' is not NULL, drawLayer() draws
+    // contentReplacementImage instead of the page content. We assume the
+    // image is to be drawn at the origin and scaled to match device pixels.
+    void setContentReplacementImage(RetainPtr&lt;CGImageRef&gt;);
+    RetainPtr&lt;CGImageRef&gt; contentReplacementImage() const;
+
+    void setTileBordersVisible(bool);
+    bool tileBordersVisible() const { return m_tileBordersVisible; }
+
+    void setTilePaintCountersVisible(bool);
+    bool tilePaintCountersVisible() const { return m_tilePaintCountersVisible; }
+
+    void setAcceleratedDrawingEnabled(bool enabled) { m_acceleratedDrawingEnabled = enabled; }
+    bool acceleratedDrawingEnabled() const { return m_acceleratedDrawingEnabled; }
+
+    void setKeepsZoomedOutTiles(bool);
+    bool keepsZoomedOutTiles() const { return m_keepsZoomedOutTiles; }
+
+    void setZoomedOutScale(float);
+    float zoomedOutScale() const;
+    
+    void setCurrentScale(float);
+    float currentScale() const;
+    
+    bool tilesOpaque() const;
+    void setTilesOpaque(bool);
+    
+    enum TilingMode {
+        Normal,
+        Minimal,
+        Panning,
+        Zooming,
+        Disabled,
+        ScrollToTop
+    };
+    TilingMode tilingMode() const { return m_tilingMode; }
+    void setTilingMode(TilingMode);
+
+    typedef enum {
+        TilingDirectionUp,
+        TilingDirectionDown,
+        TilingDirectionLeft,
+        TilingDirectionRight,
+    } TilingDirection;
+    void setTilingDirection(TilingDirection);
+    TilingDirection tilingDirection() const;
+
+    bool hasPendingDraw() const;
+
+    void hostLayerSizeChanged();
+
+    static void setLayerPoolCapacity(unsigned);
+    static void drainLayerPool();
+
+    // Logging
+    void dumpTiles();
+
+    // Internal
+    void doLayoutTiles();
+    void drawLayer(LegacyTileLayer*, CGContextRef);
+    void prepareToDraw();
+    void finishedCreatingTiles(bool didCreateTiles, bool createMore);
+    FloatRect visibleRectInLayer(CALayer *) const;
+    CALayer* hostLayer() const;
+    unsigned tileCapacityForGrid(LegacyTileGrid*);
+    Color colorForGridTileBorder(LegacyTileGrid*) const;
+
+    void doPendingRepaints();
+
+    bool isSpeculativeTileCreationEnabled() const { return m_isSpeculativeTileCreationEnabled; }
+    void setSpeculativeTileCreationEnabled(bool);
+    
+    enum SynchronousTileCreationMode { CoverVisibleOnly, CoverSpeculative };
+
+private:
+    LegacyTileGrid* activeTileGrid() const;
+    LegacyTileGrid* inactiveTileGrid() const;
+
+    void updateTilingMode();
+    bool isTileInvalidationSuspended() const;
+    bool isTileCreationSuspended() const;
+    void flushSavedDisplayRects();
+    void invalidateTiles(const IntRect&amp; dirtyRect);
+    void setZoomedOutScaleInternal(float);
+    void commitScaleChange();
+    void bringActiveTileGridToFront();
+    void adjustTileGridTransforms();
+    void removeAllNonVisibleTilesInternal();
+    void createTilesInActiveGrid(SynchronousTileCreationMode);
+    void scheduleLayerFlushForPendingRepaint();
+
+    void tileCreationTimerFired(Timer&lt;LegacyTileCache&gt;*);
+
+    void drawReplacementImage(LegacyTileLayer*, CGContextRef, CGImageRef);
+    void drawWindowContent(LegacyTileLayer*, CGContextRef, CGRect dirtyRect);
+
+    WAKWindow* m_window;
+
+    RetainPtr&lt;CGImageRef&gt; m_contentReplacementImage;
+
+    bool m_keepsZoomedOutTiles;
+
+    bool m_hasPendingLayoutTiles;
+    bool m_hasPendingUpdateTilingMode;
+    // Ensure there are no async calls on a dead tile cache.
+    RetainPtr&lt;LegacyTileCacheTombstone&gt; m_tombstone;
+
+    TilingMode m_tilingMode;
+    TilingDirection m_tilingDirection;
+
+    IntSize m_tileSize;
+    bool m_tilesOpaque;
+
+    bool m_tileBordersVisible;
+    bool m_tilePaintCountersVisible;
+    bool m_acceleratedDrawingEnabled;
+    bool m_isSpeculativeTileCreationEnabled;
+
+    bool m_didCallWillStartScrollingOrZooming;
+    OwnPtr&lt;LegacyTileGrid&gt; m_zoomedOutTileGrid;
+    OwnPtr&lt;LegacyTileGrid&gt; m_zoomedInTileGrid;
+
+    Timer&lt;LegacyTileCache&gt; m_tileCreationTimer;
+
+    Vector&lt;IntRect&gt; m_savedDisplayRects;
+
+    float m_currentScale;
+
+    float m_pendingScale;
+    float m_pendingZoomedOutScale;
+
+    mutable Mutex m_tileMutex;
+    mutable Mutex m_savedDisplayRectMutex;
+    mutable Mutex m_contentReplacementImageMutex;
+};
+
+} // namespace WebCore
+
+#endif // PLATFORM(IOS)
+
+#endif // TileCache_h
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformiosLegacyTileCachemmfromrev166453trunkSourceWebCoreplatformiosTileCachemm"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/ios/LegacyTileCache.mm (from rev 166453, trunk/Source/WebCore/platform/ios/TileCache.mm) (0 => 166529)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/LegacyTileCache.mm                                (rev 0)
+++ trunk/Source/WebCore/platform/ios/LegacyTileCache.mm        2014-03-31 21:18:23 UTC (rev 166529)
</span><span class="lines">@@ -0,0 +1,822 @@
</span><ins>+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;LegacyTileCache.h&quot;
+
+#if PLATFORM(IOS)
+
+#include &quot;LegacyTileGrid.h&quot;
+#include &quot;LegacyTileGridTile.h&quot;
+#include &quot;LegacyTileLayer.h&quot;
+#include &quot;LegacyTileLayerPool.h&quot;
+#include &quot;Logging.h&quot;
+#include &quot;MemoryPressureHandler.h&quot;
+#include &quot;SystemMemory.h&quot;
+#include &quot;WAKWindow.h&quot;
+#include &quot;WKGraphics.h&quot;
+#include &quot;WebCoreSystemInterface.h&quot;
+#include &quot;WebCoreThreadRun.h&quot;
+#include &lt;QuartzCore/QuartzCore.h&gt;
+#include &lt;QuartzCore/QuartzCorePrivate.h&gt;
+#include &lt;wtf/CurrentTime.h&gt;
+
+@interface WAKView (WebViewExtras)
+- (void)_dispatchTileDidDraw:(CALayer*)tile;
+- (void)_willStartScrollingOrZooming;
+- (void)_didFinishScrollingOrZooming;
+- (void)_dispatchTileDidDraw;
+- (void)_scheduleLayerFlushForPendingTileCacheRepaint;
+@end
+
+@interface LegacyTileCacheTombstone : NSObject {
+    BOOL dead;
+}
+@property(getter=isDead) BOOL dead;
+
+@end
+
+@implementation LegacyTileCacheTombstone
+
+@synthesize dead;
+
+@end
+
+namespace WebCore {
+
+LegacyTileCache::LegacyTileCache(WAKWindow* window)
+    : m_window(window)
+    , m_keepsZoomedOutTiles(false)
+    , m_hasPendingLayoutTiles(false)
+    , m_hasPendingUpdateTilingMode(false)
+    , m_tombstone(adoptNS([[LegacyTileCacheTombstone alloc] init]))
+    , m_tilingMode(Normal)
+    , m_tilingDirection(TilingDirectionDown)
+    , m_tileSize(512, 512)
+    , m_tilesOpaque(true)
+    , m_tileBordersVisible(false)
+    , m_tilePaintCountersVisible(false)
+    , m_acceleratedDrawingEnabled(false)
+    , m_isSpeculativeTileCreationEnabled(true)
+    , m_didCallWillStartScrollingOrZooming(false)
+    , m_zoomedOutTileGrid(PassOwnPtr&lt;LegacyTileGrid&gt;())
+    , m_zoomedInTileGrid(PassOwnPtr&lt;LegacyTileGrid&gt;())
+    , m_tileCreationTimer(this, &amp;LegacyTileCache::tileCreationTimerFired)
+    , m_currentScale(1.f)
+    , m_pendingScale(0)
+    , m_pendingZoomedOutScale(0)
+{
+    m_zoomedOutTileGrid = LegacyTileGrid::create(this, m_tileSize);
+    [hostLayer() insertSublayer:m_zoomedOutTileGrid-&gt;tileHostLayer() atIndex:0];
+    hostLayerSizeChanged();
+}
+
+LegacyTileCache::~LegacyTileCache()
+{
+    [m_tombstone.get() setDead:true];
+}
+
+CGFloat LegacyTileCache::screenScale() const
+{
+    return [m_window screenScale];
+}
+
+CALayer* LegacyTileCache::hostLayer() const
+{
+    return [m_window hostLayer];
+}
+
+FloatRect LegacyTileCache::visibleRectInLayer(CALayer *layer) const
+{
+    return [layer convertRect:[m_window extendedVisibleRect] fromLayer:hostLayer()];
+}
+
+bool LegacyTileCache::tilesOpaque() const
+{
+    return m_tilesOpaque;
+}
+    
+LegacyTileGrid* LegacyTileCache::activeTileGrid() const
+{
+    if (!m_keepsZoomedOutTiles)
+        return m_zoomedOutTileGrid.get();
+    if (m_tilingMode == Zooming)
+        return m_zoomedOutTileGrid.get();
+    if (m_zoomedInTileGrid &amp;&amp; m_currentScale == m_zoomedInTileGrid-&gt;scale())
+        return m_zoomedInTileGrid.get();
+    return m_zoomedOutTileGrid.get();
+}
+
+LegacyTileGrid* LegacyTileCache::inactiveTileGrid() const
+{
+    return activeTileGrid() == m_zoomedOutTileGrid ? m_zoomedInTileGrid.get() : m_zoomedOutTileGrid.get();
+}
+
+void LegacyTileCache::setTilesOpaque(bool opaque)
+{
+    if (m_tilesOpaque == opaque)
+        return;
+
+    MutexLocker locker(m_tileMutex);
+
+    m_tilesOpaque = opaque;
+    m_zoomedOutTileGrid-&gt;updateTileOpacity();
+    if (m_zoomedInTileGrid)
+        m_zoomedInTileGrid-&gt;updateTileOpacity();
+}
+
+void LegacyTileCache::doLayoutTiles()
+{
+    if (isTileCreationSuspended())
+        return;
+
+    MutexLocker locker(m_tileMutex);
+    LegacyTileGrid* activeGrid = activeTileGrid();
+    // Even though we aren't actually creating tiles in the inactive grid, we
+    // still need to drop invalid tiles in response to a layout.
+    // See &lt;rdar://problem/9839867&gt;.
+    if (LegacyTileGrid* inactiveGrid = inactiveTileGrid())
+        inactiveGrid-&gt;dropInvalidTiles();
+    if (activeGrid-&gt;checkDoSingleTileLayout())
+        return;
+    createTilesInActiveGrid(CoverVisibleOnly);
+}
+
+void LegacyTileCache::hostLayerSizeChanged()
+{
+    m_zoomedOutTileGrid-&gt;updateHostLayerSize();
+    if (m_zoomedInTileGrid)
+        m_zoomedInTileGrid-&gt;updateHostLayerSize();
+}
+
+void LegacyTileCache::setKeepsZoomedOutTiles(bool keep)
+{
+    m_keepsZoomedOutTiles = keep;
+}
+
+void LegacyTileCache::setCurrentScale(float scale)
+{
+    ASSERT(scale &gt; 0);
+
+    if (currentScale() == scale) {
+        m_pendingScale = 0;
+        return;
+    }
+    m_pendingScale = scale;
+    if (m_tilingMode == Disabled)
+        return;
+    commitScaleChange();
+
+    if (!keepsZoomedOutTiles() &amp;&amp; !isTileInvalidationSuspended()) {
+        // Tile invalidation is normally suspended during zooming by UIKit but some applications
+        // using custom scrollviews may zoom without triggering the callbacks. Invalidate the tiles explicitly.
+        MutexLocker locker(m_tileMutex);
+        activeTileGrid()-&gt;dropAllTiles();
+        activeTileGrid()-&gt;createTiles(CoverVisibleOnly);
+    }
+}
+
+void LegacyTileCache::setZoomedOutScale(float scale)
+{
+    ASSERT(scale &gt; 0);
+
+    if (zoomedOutScale() == scale) {
+        m_pendingZoomedOutScale = 0;
+        return;
+    }
+    m_pendingZoomedOutScale = scale;
+    if (m_tilingMode == Disabled)
+        return;
+    commitScaleChange();
+}
+    
+void LegacyTileCache::commitScaleChange()
+{
+    ASSERT(m_pendingZoomedOutScale || m_pendingScale);
+    ASSERT(m_tilingMode != Disabled);
+    
+    MutexLocker locker(m_tileMutex);
+
+    if (m_pendingZoomedOutScale) {
+        m_zoomedOutTileGrid-&gt;setScale(m_pendingZoomedOutScale);
+        m_pendingZoomedOutScale = 0;
+    }
+    
+    if (!m_keepsZoomedOutTiles) {
+        ASSERT(activeTileGrid() == m_zoomedOutTileGrid);
+        if (m_pendingScale) {
+            m_currentScale = m_pendingScale;
+            m_zoomedOutTileGrid-&gt;setScale(m_currentScale);
+        }
+        m_pendingScale = 0;
+        return;
+    }
+
+    if (m_pendingScale) {
+        m_currentScale = m_pendingScale;
+        m_pendingScale = 0;
+    }
+
+    if (m_currentScale != m_zoomedOutTileGrid-&gt;scale()) {
+        if (!m_zoomedInTileGrid) {
+            m_zoomedInTileGrid = LegacyTileGrid::create(this, m_tileSize);
+            [hostLayer() addSublayer:m_zoomedInTileGrid-&gt;tileHostLayer()];
+            hostLayerSizeChanged();
+        }
+        m_zoomedInTileGrid-&gt;setScale(m_currentScale);
+    }
+
+    // Keep the current ordering during zooming.
+    if (m_tilingMode != Zooming)
+        bringActiveTileGridToFront();
+
+    adjustTileGridTransforms();
+    layoutTiles();
+}
+
+void LegacyTileCache::bringActiveTileGridToFront()
+{
+    LegacyTileGrid* activeGrid = activeTileGrid();
+    LegacyTileGrid* otherGrid = inactiveTileGrid();
+    if (!otherGrid)
+        return;
+    CALayer* frontLayer = activeGrid-&gt;tileHostLayer();
+    CALayer* otherLayer = otherGrid-&gt;tileHostLayer();
+    [hostLayer() insertSublayer:frontLayer above:otherLayer];
+}
+    
+void LegacyTileCache::adjustTileGridTransforms()
+{
+    CALayer* zoomedOutHostLayer = m_zoomedOutTileGrid-&gt;tileHostLayer();
+    float transformScale = currentScale() / zoomedOutScale();
+    [zoomedOutHostLayer setTransform:CATransform3DMakeScale(transformScale, transformScale, 1.0f)];
+    m_zoomedOutTileGrid-&gt;updateHostLayerSize();
+}
+
+void LegacyTileCache::layoutTiles()
+{
+    if (m_hasPendingLayoutTiles)
+        return;
+    m_hasPendingLayoutTiles = true;
+
+    LegacyTileCacheTombstone *tombstone = m_tombstone.get();
+    WebThreadRun(^{
+        if ([tombstone isDead])
+            return;
+        m_hasPendingLayoutTiles = false;
+        doLayoutTiles();
+    });
+}
+
+void LegacyTileCache::layoutTilesNow()
+{
+    ASSERT(WebThreadIsLockedOrDisabled());
+
+    // layoutTilesNow() is called after a zoom, while the tile mode is still set to Zooming.
+    // If we checked for isTileCreationSuspended here, that would cause &lt;rdar://problem/8434112&gt; (Page flashes after zooming in/out).
+    if (m_tilingMode == Disabled)
+        return;
+    
+    // FIXME: layoutTilesNow should be called after state has been set to non-zooming and the active grid is the final one. 
+    // Fix this in UIKit side (perhaps also getting rid of this call) and remove this code afterwards.
+    // &lt;rdar://problem/9672993&gt;
+    TilingMode savedTilingMode = m_tilingMode;
+    if (m_tilingMode == Zooming)
+        m_tilingMode = Minimal;
+
+    MutexLocker locker(m_tileMutex);
+    LegacyTileGrid* activeGrid = activeTileGrid();
+    if (activeGrid-&gt;checkDoSingleTileLayout()) {
+        m_tilingMode = savedTilingMode;
+        return;
+    }
+    createTilesInActiveGrid(CoverVisibleOnly);
+    m_tilingMode = savedTilingMode;
+}
+
+void LegacyTileCache::layoutTilesNowForRect(const IntRect&amp; rect)
+{
+    ASSERT(WebThreadIsLockedOrDisabled());
+    MutexLocker locker(m_tileMutex);
+
+    activeTileGrid()-&gt;addTilesCoveringRect(rect);
+}
+
+void LegacyTileCache::removeAllNonVisibleTiles()
+{
+    MutexLocker locker(m_tileMutex);
+    removeAllNonVisibleTilesInternal();
+}
+
+void LegacyTileCache::removeAllNonVisibleTilesInternal()
+{
+    LegacyTileGrid* activeGrid = activeTileGrid();
+    if (keepsZoomedOutTiles() &amp;&amp; activeGrid == m_zoomedInTileGrid &amp;&amp; activeGrid-&gt;hasTiles())
+        m_zoomedOutTileGrid-&gt;dropAllTiles();
+
+    IntRect activeTileBounds = activeGrid-&gt;bounds();
+    if (activeTileBounds.width() &lt;= m_tileSize.width() &amp;&amp; activeTileBounds.height() &lt;= m_tileSize.height()) {
+        // If the view is smaller than a tile, keep the tile even if it is not visible.
+        activeGrid-&gt;dropTilesOutsideRect(activeTileBounds);
+        return;
+    }
+
+    activeGrid-&gt;dropTilesOutsideRect(activeGrid-&gt;visibleRect());
+}
+
+void LegacyTileCache::removeAllTiles()
+{
+    MutexLocker locker(m_tileMutex);
+    m_zoomedOutTileGrid-&gt;dropAllTiles();
+    if (m_zoomedInTileGrid)
+        m_zoomedInTileGrid-&gt;dropAllTiles();
+}
+
+void LegacyTileCache::removeForegroundTiles()
+{
+    MutexLocker locker(m_tileMutex);
+    if (!keepsZoomedOutTiles())
+        m_zoomedOutTileGrid-&gt;dropAllTiles();
+    if (m_zoomedInTileGrid)
+        m_zoomedInTileGrid-&gt;dropAllTiles();
+}
+
+void LegacyTileCache::setContentReplacementImage(RetainPtr&lt;CGImageRef&gt; contentReplacementImage)
+{
+    MutexLocker locker(m_contentReplacementImageMutex);
+    m_contentReplacementImage = contentReplacementImage;
+}
+
+RetainPtr&lt;CGImageRef&gt; LegacyTileCache::contentReplacementImage() const
+{
+    MutexLocker locker(m_contentReplacementImageMutex);
+    return m_contentReplacementImage;
+}
+
+void LegacyTileCache::setTileBordersVisible(bool flag)
+{
+    if (flag == m_tileBordersVisible)
+        return;
+
+    m_tileBordersVisible = flag;
+    m_zoomedOutTileGrid-&gt;updateTileBorderVisibility();
+    if (m_zoomedInTileGrid)
+        m_zoomedInTileGrid-&gt;updateTileBorderVisibility();
+}
+
+void LegacyTileCache::setTilePaintCountersVisible(bool flag)
+{
+    m_tilePaintCountersVisible = flag;
+    // The numbers will show up the next time the tiles paint.
+}
+
+void LegacyTileCache::finishedCreatingTiles(bool didCreateTiles, bool createMore)
+{
+    // We need to ensure that all tiles are showing the same version of the content.
+    if (didCreateTiles &amp;&amp; !m_savedDisplayRects.isEmpty())
+        flushSavedDisplayRects();
+
+    if (keepsZoomedOutTiles()) {
+        if (m_zoomedInTileGrid &amp;&amp; activeTileGrid() == m_zoomedOutTileGrid &amp;&amp; m_tilingMode != Zooming &amp;&amp; m_zoomedInTileGrid-&gt;hasTiles()) {
+            // This CA transaction will cover the screen with top level tiles.
+            // We can remove zoomed-in tiles without flashing.
+            m_zoomedInTileGrid-&gt;dropAllTiles();
+        } else if (activeTileGrid() == m_zoomedInTileGrid) {
+            // Pass the minimum possible distance to consider all tiles, even visible ones.
+            m_zoomedOutTileGrid-&gt;dropDistantTiles(0, std::numeric_limits&lt;double&gt;::min());
+        }
+    }
+
+    // Keep creating tiles until the whole coverRect is covered.
+    if (createMore)
+        m_tileCreationTimer.startOneShot(0);
+}
+
+void LegacyTileCache::tileCreationTimerFired(Timer&lt;LegacyTileCache&gt;*)
+{
+    if (isTileCreationSuspended())
+        return;
+    MutexLocker locker(m_tileMutex);
+    createTilesInActiveGrid(CoverSpeculative);
+}
+
+void LegacyTileCache::createTilesInActiveGrid(SynchronousTileCreationMode mode)
+{
+    if (memoryPressureHandler().hasReceivedMemoryPressure()) {
+        LOG(MemoryPressure, &quot;Under memory pressure at: %s&quot;, __PRETTY_FUNCTION__);
+        removeAllNonVisibleTilesInternal();
+    }
+    activeTileGrid()-&gt;createTiles(mode);
+}
+
+unsigned LegacyTileCache::tileCapacityForGrid(LegacyTileGrid* grid)
+{
+    static unsigned capacity;
+    if (!capacity) {
+        size_t totalMemory = systemTotalMemory();
+        totalMemory /= 1024 * 1024;
+        if (totalMemory &gt;= 1024)
+            capacity = 128 * 1024 * 1024;
+        else if (totalMemory &gt;= 512)
+            capacity = 64 * 1024 * 1024;
+        else
+            capacity = 32 * 1024 * 1024;
+    }
+
+    int gridCapacity;
+
+    int memoryLevel = systemMemoryLevel();
+    if (memoryLevel &lt; 15)
+        gridCapacity = capacity / 4;
+    else if (memoryLevel &lt; 20)
+        gridCapacity = capacity / 2;
+    else if (memoryLevel &lt; 30) 
+        gridCapacity = capacity * 3 / 4;
+    else
+        gridCapacity = capacity;
+
+    if (keepsZoomedOutTiles() &amp;&amp; grid == m_zoomedOutTileGrid) {
+        if (activeTileGrid() == m_zoomedOutTileGrid)
+            return gridCapacity;
+        return gridCapacity / 4;
+    }
+    return gridCapacity * 3 / 4;
+}
+
+Color LegacyTileCache::colorForGridTileBorder(LegacyTileGrid* grid) const
+{
+    if (grid == m_zoomedOutTileGrid)
+        return Color(.3f, .0f, 0.4f, 0.5f);
+
+    return Color(.0f, .0f, 0.4f, 0.5f);
+}
+
+static bool shouldRepaintInPieces(const CGRect&amp; dirtyRect, CGSRegionObj dirtyRegion, CGFloat contentsScale)
+{
+    // Estimate whether or not we should use the unioned rect or the individual rects.
+    // We do this by computing the percentage of &quot;wasted space&quot; in the union. If that wasted space
+    // is too large, then we will do individual rect painting instead.
+    float singlePixels = 0;
+    unsigned rectCount = 0;
+
+    CGSRegionEnumeratorObj enumerator = CGSRegionEnumerator(dirtyRegion);
+    CGRect *subRect;
+    while ((subRect = CGSNextRect(enumerator))) {
+        ++rectCount;
+        singlePixels += subRect-&gt;size.width * subRect-&gt;size.height;
+    }
+    singlePixels /= (contentsScale * contentsScale);
+    CGSReleaseRegionEnumerator(enumerator);
+
+    const unsigned cRectThreshold = 10;
+    if (rectCount &lt; 2 || rectCount &gt; cRectThreshold)
+        return false;
+
+    const float cWastedSpaceThreshold = 0.50f;
+    float unionPixels = dirtyRect.size.width * dirtyRect.size.height;
+    float wastedSpace = 1.f - (singlePixels / unionPixels);
+    return wastedSpace &gt; cWastedSpaceThreshold;
+}
+
+void LegacyTileCache::drawReplacementImage(LegacyTileLayer* layer, CGContextRef context, CGImageRef image)
+{
+    CGContextSetRGBFillColor(context, 1, 1, 1, 1);
+    CGContextFillRect(context, CGContextGetClipBoundingBox(context));
+
+    CGFloat contentsScale = [layer contentsScale];
+    CGContextScaleCTM(context, 1 / contentsScale, -1 / contentsScale);
+    CGRect imageRect = CGRectMake(0, 0, CGImageGetWidth(image), CGImageGetHeight(image));
+    CGContextTranslateCTM(context, 0, -imageRect.size.height);
+    CGContextDrawImage(context, imageRect, image);
+}
+
+void LegacyTileCache::drawWindowContent(LegacyTileLayer* layer, CGContextRef context, CGRect dirtyRect)
+{
+    CGRect frame = [layer frame];
+    WKFontAntialiasingStateSaver fontAntialiasingState(context, [m_window useOrientationDependentFontAntialiasing] &amp;&amp; [layer isOpaque]);
+    fontAntialiasingState.setup([WAKWindow hasLandscapeOrientation]);
+
+    CGSRegionObj drawRegion = (CGSRegionObj)[layer regionBeingDrawn];
+    CGFloat contentsScale = [layer contentsScale];
+    if (drawRegion &amp;&amp; shouldRepaintInPieces(dirtyRect, drawRegion, contentsScale)) {
+        // Use fine grained repaint rectangles to minimize the amount of painted pixels.
+        CGSRegionEnumeratorObj enumerator = CGSRegionEnumerator(drawRegion);
+        CGRect *subRect;
+        while ((subRect = CGSNextRect(enumerator))) {
+            CGRect adjustedSubRect = *subRect;
+            adjustedSubRect.origin.x /= contentsScale;
+            adjustedSubRect.origin.y = frame.size.height - (adjustedSubRect.origin.y + adjustedSubRect.size.height) / contentsScale;
+            adjustedSubRect.size.width /= contentsScale;
+            adjustedSubRect.size.height /= contentsScale;
+
+            CGRect subRectInSuper = [hostLayer() convertRect:adjustedSubRect fromLayer:layer];
+            [m_window displayRect:subRectInSuper];
+        }
+        CGSReleaseRegionEnumerator(enumerator);
+    } else {
+        // Simple repaint
+        CGRect dirtyRectInSuper = [hostLayer() convertRect:dirtyRect fromLayer:layer];
+        [m_window displayRect:dirtyRectInSuper];
+    }
+
+    fontAntialiasingState.restore();
+}
+
+void LegacyTileCache::drawLayer(LegacyTileLayer* layer, CGContextRef context)
+{
+    // The web lock unlock observer runs after CA commit observer.
+    if (!WebThreadIsLockedOrDisabled()) {
+        LOG_ERROR(&quot;Drawing without holding the web thread lock&quot;);
+        ASSERT_NOT_REACHED();
+    }
+
+    WKSetCurrentGraphicsContext(context);
+
+    CGRect dirtyRect = CGContextGetClipBoundingBox(context);
+    CGRect frame = [layer frame];
+    CGContextTranslateCTM(context, -frame.origin.x, -frame.origin.y);
+    CGRect scaledFrame = [hostLayer() convertRect:[layer bounds] fromLayer:layer];
+    CGContextScaleCTM(context, frame.size.width / scaledFrame.size.width, frame.size.height / scaledFrame.size.height);
+
+    if (RetainPtr&lt;CGImage&gt; contentReplacementImage = this-&gt;contentReplacementImage())
+        drawReplacementImage(layer, context, contentReplacementImage.get());
+    else
+        drawWindowContent(layer, context, dirtyRect);
+
+    ++layer.paintCount;
+    if (m_tilePaintCountersVisible) {
+        char text[16];
+        snprintf(text, sizeof(text), &quot;%d&quot;, layer.paintCount);
+
+        CGContextSaveGState(context);
+
+        CGContextTranslateCTM(context, frame.origin.x, frame.origin.y);
+        CGContextSetFillColorWithColor(context, cachedCGColor(colorForGridTileBorder([layer tileGrid]), ColorSpaceDeviceRGB));
+        
+        CGRect labelBounds = [layer bounds];
+        labelBounds.size.width = 10 + 12 * strlen(text);
+        labelBounds.size.height = 25;
+        CGContextFillRect(context, labelBounds);
+
+        if (acceleratedDrawingEnabled())
+            CGContextSetRGBFillColor(context, 1, 0, 0, 0.4f);
+        else
+            CGContextSetRGBFillColor(context, 1, 1, 1, 0.6f);
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored &quot;-Wdeprecated-declarations&quot;
+        CGContextSetTextMatrix(context, CGAffineTransformMakeScale(1, -1));
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored &quot;-Wdeprecated-declarations&quot;
+        CGContextSelectFont(context, &quot;Helvetica&quot;, 25, kCGEncodingMacRoman);
+        CGContextShowTextAtPoint(context, labelBounds.origin.x + 3, labelBounds.origin.y + 20, text, strlen(text));
+#pragma clang diagnostic pop
+    
+        CGContextRestoreGState(context);        
+    }
+
+    WAKView* view = [m_window contentView];
+    [view performSelector:@selector(_dispatchTileDidDraw:) withObject:layer afterDelay:0.0];
+}
+
+void LegacyTileCache::setNeedsDisplay()
+{
+    setNeedsDisplayInRect(IntRect(0, 0, std::numeric_limits&lt;int&gt;::max(), std::numeric_limits&lt;int&gt;::max()));
+}
+
+void LegacyTileCache::scheduleLayerFlushForPendingRepaint()
+{
+    WAKView* view = [m_window contentView];
+    [view _scheduleLayerFlushForPendingTileCacheRepaint];
+}
+
+void LegacyTileCache::setNeedsDisplayInRect(const IntRect&amp; dirtyRect)
+{
+    MutexLocker locker(m_savedDisplayRectMutex);
+    bool addedFirstRect = m_savedDisplayRects.isEmpty();
+    m_savedDisplayRects.append(dirtyRect);
+    if (!addedFirstRect)
+        return;
+    // Compositing layer flush will call back to doPendingRepaints(). The flush may be throttled and not happen immediately.
+    scheduleLayerFlushForPendingRepaint();
+}
+
+void LegacyTileCache::invalidateTiles(const IntRect&amp; dirtyRect)
+{
+    ASSERT(!m_tileMutex.tryLock());
+
+    LegacyTileGrid* activeGrid = activeTileGrid();
+    if (!keepsZoomedOutTiles()) {
+        activeGrid-&gt;invalidateTiles(dirtyRect);
+        return;
+    }
+    FloatRect scaledRect = dirtyRect;
+    scaledRect.scale(zoomedOutScale() / currentScale());
+    IntRect zoomedOutDirtyRect = enclosingIntRect(scaledRect);
+    if (activeGrid == m_zoomedOutTileGrid) {
+        bool dummy;
+        IntRect coverRect = m_zoomedOutTileGrid-&gt;calculateCoverRect(m_zoomedOutTileGrid-&gt;visibleRect(), dummy);
+        // Instead of repainting a tile outside the cover rect, just remove it.
+        m_zoomedOutTileGrid-&gt;dropTilesBetweenRects(zoomedOutDirtyRect, coverRect);
+        m_zoomedOutTileGrid-&gt;invalidateTiles(zoomedOutDirtyRect);
+        // We need to invalidate zoomed in tiles as well while zooming, since
+        // we could switch back to the zoomed in grid without dropping its
+        // tiles.  See &lt;rdar://problem/9946759&gt;.
+        if (m_tilingMode == Zooming &amp;&amp; m_zoomedInTileGrid)
+            m_zoomedInTileGrid-&gt;invalidateTiles(dirtyRect);
+        return;
+    }
+    if (!m_zoomedInTileGrid-&gt;hasTiles()) {
+        // If no tiles have been created yet for the zoomed in grid, we can't drop the zoomed out tiles.
+        m_zoomedOutTileGrid-&gt;invalidateTiles(zoomedOutDirtyRect);
+        return;
+    }
+    m_zoomedOutTileGrid-&gt;dropTilesIntersectingRect(zoomedOutDirtyRect);
+    m_zoomedInTileGrid-&gt;invalidateTiles(dirtyRect);
+}
+    
+bool LegacyTileCache::isTileCreationSuspended() const 
+{
+    return (!keepsZoomedOutTiles() &amp;&amp; m_tilingMode == Zooming) || m_tilingMode == Disabled;
+}
+
+bool LegacyTileCache::isTileInvalidationSuspended() const 
+{ 
+    return m_tilingMode == Zooming || m_tilingMode == Panning || m_tilingMode == ScrollToTop || m_tilingMode == Disabled; 
+}
+
+void LegacyTileCache::updateTilingMode()
+{
+    ASSERT(WebThreadIsCurrent() || !WebThreadIsEnabled());
+
+    WAKView* view = [m_window contentView];
+
+    if (m_tilingMode == Zooming || m_tilingMode == Panning || m_tilingMode == ScrollToTop) {
+        if (!m_didCallWillStartScrollingOrZooming) {
+            [view _willStartScrollingOrZooming];
+            m_didCallWillStartScrollingOrZooming = true;
+        }
+    } else {
+        if (m_didCallWillStartScrollingOrZooming) {
+            [view _didFinishScrollingOrZooming];
+            m_didCallWillStartScrollingOrZooming = false;
+        }
+        if (m_tilingMode == Disabled)
+            return;
+
+        MutexLocker locker(m_tileMutex);
+        createTilesInActiveGrid(CoverVisibleOnly);
+
+        if (!m_savedDisplayRects.isEmpty())
+            scheduleLayerFlushForPendingRepaint();
+    }
+}
+
+void LegacyTileCache::setTilingMode(TilingMode tilingMode)
+{
+    if (tilingMode == m_tilingMode)
+        return;
+    bool wasZooming = (m_tilingMode == Zooming);
+    m_tilingMode = tilingMode;
+
+    if ((m_pendingZoomedOutScale || m_pendingScale) &amp;&amp; m_tilingMode != Disabled)
+        commitScaleChange();
+    else if (wasZooming) {
+        MutexLocker locker(m_tileMutex);
+        bringActiveTileGridToFront();
+    }
+
+    if (m_hasPendingUpdateTilingMode)
+        return;
+    m_hasPendingUpdateTilingMode = true;
+
+    LegacyTileCacheTombstone *tombstone = m_tombstone.get();
+    WebThreadRun(^{
+        if ([tombstone isDead])
+            return;
+        m_hasPendingUpdateTilingMode = false;
+        updateTilingMode();
+    });
+}
+
+void LegacyTileCache::setTilingDirection(TilingDirection tilingDirection)
+{
+    m_tilingDirection = tilingDirection;
+}
+
+LegacyTileCache::TilingDirection LegacyTileCache::tilingDirection() const
+{
+    return m_tilingDirection;
+}
+    
+float LegacyTileCache::zoomedOutScale() const
+{
+    return m_zoomedOutTileGrid-&gt;scale();
+}
+
+float LegacyTileCache::currentScale() const
+{
+    return m_currentScale;
+}
+
+void LegacyTileCache::doPendingRepaints()
+{
+    if (m_savedDisplayRects.isEmpty())
+        return;
+    if (isTileInvalidationSuspended())
+        return;
+    MutexLocker locker(m_tileMutex);
+    flushSavedDisplayRects();
+}
+
+void LegacyTileCache::flushSavedDisplayRects()
+{
+    ASSERT(!m_tileMutex.tryLock());
+    ASSERT(!m_savedDisplayRects.isEmpty());
+
+    Vector&lt;IntRect&gt; rects;
+    {
+        MutexLocker locker(m_savedDisplayRectMutex);
+        m_savedDisplayRects.swap(rects);
+    }
+    size_t size = rects.size();
+    for (size_t n = 0; n &lt; size; ++n)
+        invalidateTiles(rects[n]);
+}
+
+void LegacyTileCache::setSpeculativeTileCreationEnabled(bool enabled)
+{
+    if (m_isSpeculativeTileCreationEnabled == enabled)
+        return;
+    m_isSpeculativeTileCreationEnabled = enabled;
+    if (m_isSpeculativeTileCreationEnabled)
+        m_tileCreationTimer.startOneShot(0);
+}
+
+bool LegacyTileCache::hasPendingDraw() const
+{
+    return !m_savedDisplayRects.isEmpty();
+}
+
+void LegacyTileCache::prepareToDraw()
+{
+    // This will trigger document relayout if needed.
+    [[m_window contentView] viewWillDraw];
+
+    if (!m_savedDisplayRects.isEmpty()) {
+        MutexLocker locker(m_tileMutex);
+        flushSavedDisplayRects();
+    }
+}
+
+void LegacyTileCache::setLayerPoolCapacity(unsigned capacity)
+{
+    LegacyTileLayerPool::sharedPool()-&gt;setCapacity(capacity);
+}
+
+void LegacyTileCache::drainLayerPool()
+{
+    LegacyTileLayerPool::sharedPool()-&gt;drain();
+}
+
+void LegacyTileCache::dumpTiles()
+{
+    NSLog(@&quot;=================&quot;);
+    NSLog(@&quot;ZOOMED OUT&quot;);
+    if (m_zoomedOutTileGrid == activeTileGrid())
+        NSLog(@&quot;&lt;ACTIVE&gt;&quot;);
+    m_zoomedOutTileGrid-&gt;dumpTiles();
+    NSLog(@&quot;=================&quot;);
+    if (m_zoomedInTileGrid) {
+        NSLog(@&quot;ZOOMED IN&quot;);
+        if (m_zoomedInTileGrid == activeTileGrid())
+            NSLog(@&quot;&lt;ACTIVE&gt;&quot;);
+        m_zoomedInTileGrid-&gt;dumpTiles();
+        NSLog(@&quot;=================&quot;);
+    }
+}
+
+} // namespace WebCore
+
+#endif // PLATFORM(IOS)
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformiosLegacyTileGridhfromrev166453trunkSourceWebCoreplatformiosTileGridh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/ios/LegacyTileGrid.h (from rev 166453, trunk/Source/WebCore/platform/ios/TileGrid.h) (0 => 166529)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/LegacyTileGrid.h                                (rev 0)
+++ trunk/Source/WebCore/platform/ios/LegacyTileGrid.h        2014-03-31 21:18:23 UTC (rev 166529)
</span><span class="lines">@@ -0,0 +1,143 @@
</span><ins>+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef LegacyTileGrid_h
+#define LegacyTileGrid_h
+
+#if PLATFORM(IOS)
+
+#include &quot;IntPoint.h&quot;
+#include &quot;IntPointHash.h&quot;
+#include &quot;IntRect.h&quot;
+#include &quot;IntSize.h&quot;
+#include &quot;LegacyTileCache.h&quot;
+#include &lt;wtf/HashMap.h&gt;
+#include &lt;wtf/Noncopyable.h&gt;
+#include &lt;wtf/OwnPtr.h&gt;
+#include &lt;wtf/PassOwnPtr.h&gt;
+#include &lt;wtf/PassRefPtr.h&gt;
+#include &lt;wtf/RetainPtr.h&gt;
+
+#define LOG_TILING 0
+
+@class CALayer;
+
+namespace WebCore {
+
+class LegacyTileGridTile;
+
+class LegacyTileGrid {
+    WTF_MAKE_NONCOPYABLE(LegacyTileGrid);
+public:
+    typedef IntPoint TileIndex;
+
+    static PassOwnPtr&lt;LegacyTileGrid&gt; create(LegacyTileCache* cache, const IntSize&amp; tileSize) { return adoptPtr(new LegacyTileGrid(cache, tileSize)); }
+
+    ~LegacyTileGrid();
+
+    LegacyTileCache* tileCache() const { return m_tileCache; }
+
+    CALayer *tileHostLayer() const;
+    IntRect bounds() const;
+    unsigned tileCount() const;
+
+    float scale() const { return m_scale; }
+    void setScale(float scale) { m_scale = scale; }
+
+    IntRect visibleRect() const;
+
+    void createTiles(LegacyTileCache::SynchronousTileCreationMode);
+
+    void dropAllTiles();
+    void dropInvalidTiles();
+    void dropTilesOutsideRect(const IntRect&amp;);
+    void dropTilesIntersectingRect(const IntRect&amp;);
+    // Drops tiles that intersect dropRect but do not intersect keepRect.
+    void dropTilesBetweenRects(const IntRect&amp; dropRect, const IntRect&amp; keepRect);
+    bool dropDistantTiles(unsigned tilesNeeded, double shortestDistance);
+
+    void addTilesCoveringRect(const IntRect&amp;);
+
+    bool tilesCover(const IntRect&amp;) const;
+    void centerTileGridOrigin(const IntRect&amp; visibleRect);
+    void invalidateTiles(const IntRect&amp; dirtyRect);
+
+    void updateTileOpacity();
+    void updateTileBorderVisibility();
+    void updateHostLayerSize();
+    bool checkDoSingleTileLayout();
+
+    bool hasTiles() const { return !m_tiles.isEmpty(); }
+
+    IntRect calculateCoverRect(const IntRect&amp; visibleRect, bool&amp; centerGrid);
+
+    // Logging
+    void dumpTiles();
+
+private:
+    double tileDistance2(const IntRect&amp; visibleRect, const IntRect&amp; tileRect) const;
+    unsigned tileByteSize() const;
+
+    void addTileForIndex(const TileIndex&amp;);
+
+    PassRefPtr&lt;LegacyTileGridTile&gt; tileForIndex(const TileIndex&amp;) const;
+    IntRect tileRectForIndex(const TileIndex&amp;) const;
+    PassRefPtr&lt;LegacyTileGridTile&gt; tileForPoint(const IntPoint&amp;) const;
+    TileIndex tileIndexForPoint(const IntPoint&amp;) const;
+
+    IntRect adjustCoverRectForPageBounds(const IntRect&amp;) const;
+    bool shouldUseMinimalTileCoverage() const;
+
+private:        
+    LegacyTileGrid(LegacyTileCache*, const IntSize&amp;);
+
+    LegacyTileCache* m_tileCache;
+    RetainPtr&lt;CALayer&gt; m_tileHostLayer;
+
+    IntPoint m_origin;
+    IntSize m_tileSize;
+
+    float m_scale;
+
+    typedef HashMap&lt;TileIndex, RefPtr&lt;LegacyTileGridTile&gt;&gt; TileMap;
+    TileMap m_tiles;
+
+    IntRect m_validBounds;
+};
+
+static inline IntPoint topLeft(const IntRect&amp; rect)
+{
+    return rect.location();
+}
+
+static inline IntPoint bottomRight(const IntRect&amp; rect)
+{
+    return IntPoint(rect.maxX() - 1, rect.maxY() - 1);
+}
+
+} // namespace WebCore
+
+#endif // PLATFORM(IOS)
+#endif // TileGrid_h
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformiosLegacyTileGridmmfromrev166453trunkSourceWebCoreplatformiosTileGridmm"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/ios/LegacyTileGrid.mm (from rev 166453, trunk/Source/WebCore/platform/ios/TileGrid.mm) (0 => 166529)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/LegacyTileGrid.mm                                (rev 0)
+++ trunk/Source/WebCore/platform/ios/LegacyTileGrid.mm        2014-03-31 21:18:23 UTC (rev 166529)
</span><span class="lines">@@ -0,0 +1,567 @@
</span><ins>+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;LegacyTileGrid.h&quot;
+
+#if PLATFORM(IOS)
+
+#include &quot;MemoryPressureHandler.h&quot;
+#include &quot;SystemMemory.h&quot;
+#include &quot;LegacyTileGridTile.h&quot;
+#include &quot;LegacyTileLayer.h&quot;
+#include &quot;LegacyTileLayerPool.h&quot;
+#include &quot;WAKWindow.h&quot;
+#include &lt;CoreGraphics/CoreGraphicsPrivate.h&gt;
+#include &lt;QuartzCore/QuartzCore.h&gt;
+#include &lt;QuartzCore/QuartzCorePrivate.h&gt;
+#include &lt;algorithm&gt;
+#include &lt;functional&gt;
+
+namespace WebCore {
+
+LegacyTileGrid::LegacyTileGrid(LegacyTileCache* tileCache, const IntSize&amp; tileSize)
+    : m_tileCache(tileCache)
+    , m_tileHostLayer(adoptNS([[LegacyTileHostLayer alloc] initWithTileGrid:this]))
+    , m_tileSize(tileSize)
+    , m_scale(1)
+    , m_validBounds(0, 0, std::numeric_limits&lt;int&gt;::max(), std::numeric_limits&lt;int&gt;::max()) 
+{
+}
+    
+LegacyTileGrid::~LegacyTileGrid()
+{
+    [m_tileHostLayer removeFromSuperlayer];
+}
+
+IntRect LegacyTileGrid::visibleRect() const
+{
+    IntRect visibleRect = enclosingIntRect(m_tileCache-&gt;visibleRectInLayer(m_tileHostLayer.get()));
+
+    // When fast scrolling to the top, move the visible rect there immediately so we have tiles when the scrolling completes.
+    if (m_tileCache-&gt;tilingMode() == LegacyTileCache::ScrollToTop)
+        visibleRect.setY(0);
+
+    return visibleRect;
+}
+
+void LegacyTileGrid::dropAllTiles()
+{
+    m_tiles.clear();
+}
+
+void LegacyTileGrid::dropTilesIntersectingRect(const IntRect&amp; dropRect)
+{
+    dropTilesBetweenRects(dropRect, IntRect());
+}
+
+void LegacyTileGrid::dropTilesOutsideRect(const IntRect&amp; keepRect)
+{
+    dropTilesBetweenRects(IntRect(0, 0, std::numeric_limits&lt;int&gt;::max(), std::numeric_limits&lt;int&gt;::max()), keepRect);
+}
+
+void LegacyTileGrid::dropTilesBetweenRects(const IntRect&amp; dropRect, const IntRect&amp; keepRect)
+{
+    Vector&lt;TileIndex&gt; toRemove;
+    for (const auto&amp; tile : m_tiles) {
+        const TileIndex&amp; index = tile.key;
+        IntRect tileRect = tile.value-&gt;rect();
+        if (tileRect.intersects(dropRect) &amp;&amp; !tileRect.intersects(keepRect))
+            toRemove.append(index);
+    }
+    unsigned removeCount = toRemove.size();
+    for (unsigned n = 0; n &lt; removeCount; ++n)
+        m_tiles.remove(toRemove[n]);
+}
+
+unsigned LegacyTileGrid::tileByteSize() const
+{
+    IntSize tilePixelSize = m_tileSize;
+    tilePixelSize.scale(m_tileCache-&gt;screenScale());
+    return LegacyTileLayerPool::bytesBackingLayerWithPixelSize(tilePixelSize);
+}
+
+template &lt;typename T&gt;
+static bool isFartherAway(const std::pair&lt;double, T&gt;&amp; a, const std::pair&lt;double, T&gt;&amp; b)
+{
+    return a.first &gt; b.first;
+}
+
+bool LegacyTileGrid::dropDistantTiles(unsigned tilesNeeded, double shortestDistance)
+{
+    unsigned bytesPerTile = tileByteSize();
+    unsigned bytesNeeded = tilesNeeded * bytesPerTile;
+    unsigned bytesUsed = tileCount() * bytesPerTile;
+    unsigned maximumBytes = m_tileCache-&gt;tileCapacityForGrid(this);
+
+    int bytesToReclaim = int(bytesUsed) - (int(maximumBytes) - bytesNeeded);
+    if (bytesToReclaim &lt;= 0)
+        return true;
+
+    unsigned tilesToRemoveCount = bytesToReclaim / bytesPerTile;
+
+    IntRect visibleRect = this-&gt;visibleRect();
+    Vector&lt;std::pair&lt;double, TileIndex&gt;&gt; toRemove;
+    for (const auto&amp; tile : m_tiles) {
+        const TileIndex&amp; index = tile.key;
+        const IntRect&amp; tileRect = tile.value-&gt;rect();
+        double distance = tileDistance2(visibleRect, tileRect);
+        if (distance &lt;= shortestDistance)
+            continue;
+        toRemove.append(std::make_pair(distance, index));
+        std::push_heap(toRemove.begin(), toRemove.end(), std::ptr_fun(isFartherAway&lt;TileIndex&gt;));
+        if (toRemove.size() &gt; tilesToRemoveCount) {
+            std::pop_heap(toRemove.begin(), toRemove.end(), std::ptr_fun(isFartherAway&lt;TileIndex&gt;));
+            toRemove.removeLast();
+        }
+    }
+    size_t removeCount = toRemove.size();
+    for (size_t n = 0; n &lt; removeCount; ++n)
+        m_tiles.remove(toRemove[n].second);
+
+    if (!shortestDistance)
+        return true;
+
+    return tileCount() * bytesPerTile + bytesNeeded &lt;= maximumBytes;
+}
+
+void LegacyTileGrid::addTilesCoveringRect(const IntRect&amp; rectToCover)
+{
+    // We never draw anything outside of our bounds.
+    IntRect rect(rectToCover);
+    rect.intersect(bounds());
+    if (rect.isEmpty())
+        return;
+
+    TileIndex topLeftIndex = tileIndexForPoint(topLeft(rect));
+    TileIndex bottomRightIndex = tileIndexForPoint(bottomRight(rect));
+    for (int yIndex = topLeftIndex.y(); yIndex &lt;= bottomRightIndex.y(); ++yIndex) {
+        for (int xIndex = topLeftIndex.x(); xIndex &lt;= bottomRightIndex.x(); ++xIndex) {
+            TileIndex index(xIndex, yIndex);
+            if (!tileForIndex(index))
+                addTileForIndex(index);
+        }
+    }
+}
+
+void LegacyTileGrid::addTileForIndex(const TileIndex&amp; index)
+{
+    m_tiles.set(index, LegacyTileGridTile::create(this, tileRectForIndex(index)));
+}
+
+CALayer* LegacyTileGrid::tileHostLayer() const
+{
+    return m_tileHostLayer.get();
+}
+
+IntRect LegacyTileGrid::bounds() const
+{
+    return IntRect(IntPoint(), IntSize([tileHostLayer() size]));
+}
+
+PassRefPtr&lt;LegacyTileGridTile&gt; LegacyTileGrid::tileForIndex(const TileIndex&amp; index) const
+{
+    return m_tiles.get(index);
+}
+
+IntRect LegacyTileGrid::tileRectForIndex(const TileIndex&amp; index) const
+{
+    IntRect rect(index.x() * m_tileSize.width() - (m_origin.x() ? m_tileSize.width() - m_origin.x() : 0),
+                 index.y() * m_tileSize.height() - (m_origin.y() ? m_tileSize.height() - m_origin.y() : 0),
+                 m_tileSize.width(),
+                 m_tileSize.height());
+    rect.intersect(bounds());
+    return rect;
+}
+
+LegacyTileGrid::TileIndex LegacyTileGrid::tileIndexForPoint(const IntPoint&amp; point) const
+{
+    ASSERT(m_origin.x() &lt; m_tileSize.width());
+    ASSERT(m_origin.y() &lt; m_tileSize.height());
+    int x = (point.x() + (m_origin.x() ? m_tileSize.width() - m_origin.x() : 0)) / m_tileSize.width();
+    int y = (point.y() + (m_origin.y() ? m_tileSize.height() - m_origin.y() : 0)) / m_tileSize.height();
+    return TileIndex(std::max(x, 0), std::max(y, 0));
+}
+
+void LegacyTileGrid::centerTileGridOrigin(const IntRect&amp; visibleRect)
+{
+    if (visibleRect.isEmpty())
+        return;
+
+    unsigned minimumHorizontalTiles = 1 + (visibleRect.width() - 1) / m_tileSize.width();
+    unsigned minimumVerticalTiles = 1 + (visibleRect.height() - 1) / m_tileSize.height();
+    TileIndex currentTopLeftIndex = tileIndexForPoint(topLeft(visibleRect));
+    TileIndex currentBottomRightIndex = tileIndexForPoint(bottomRight(visibleRect));
+    unsigned currentHorizontalTiles = currentBottomRightIndex.x() - currentTopLeftIndex.x() + 1;
+    unsigned currentVerticalTiles = currentBottomRightIndex.y() - currentTopLeftIndex.y() + 1;
+
+    // If we have tiles already, only center if we would get benefits from both directions (as we need to throw out existing tiles).
+    if (tileCount() &amp;&amp; (currentHorizontalTiles == minimumHorizontalTiles || currentVerticalTiles == minimumVerticalTiles))
+        return;
+
+    IntPoint newOrigin(0, 0);
+    IntSize size = bounds().size();
+    if (size.width() &gt; m_tileSize.width()) {
+        newOrigin.setX((visibleRect.x() - (minimumHorizontalTiles * m_tileSize.width() - visibleRect.width()) / 2) % m_tileSize.width());
+        if (newOrigin.x() &lt; 0)
+            newOrigin.setX(0);
+    }
+    if (size.height() &gt; m_tileSize.height()) {
+        newOrigin.setY((visibleRect.y() - (minimumVerticalTiles * m_tileSize.height() - visibleRect.height()) / 2) % m_tileSize.height());
+        if (newOrigin.y() &lt; 0)
+            newOrigin.setY(0);
+    }
+
+    // Drop all existing tiles if the origin moved.
+    if (newOrigin == m_origin)
+        return;
+    m_tiles.clear();
+    m_origin = newOrigin;
+}
+
+PassRefPtr&lt;LegacyTileGridTile&gt; LegacyTileGrid::tileForPoint(const IntPoint&amp; point) const
+{
+    return tileForIndex(tileIndexForPoint(point));
+}
+
+bool LegacyTileGrid::tilesCover(const IntRect&amp; rect) const
+{
+    return tileForPoint(rect.location()) &amp;&amp; tileForPoint(IntPoint(rect.maxX() - 1, rect.y())) &amp;&amp;
+    tileForPoint(IntPoint(rect.x(), rect.maxY() - 1)) &amp;&amp; tileForPoint(IntPoint(rect.maxX() - 1, rect.maxY() - 1));
+}
+
+void LegacyTileGrid::updateTileOpacity()
+{
+    TileMap::iterator end = m_tiles.end();
+    for (TileMap::iterator it = m_tiles.begin(); it != end; ++it)
+        [it-&gt;value-&gt;tileLayer() setOpaque:m_tileCache-&gt;tilesOpaque()];
+}
+
+void LegacyTileGrid::updateTileBorderVisibility()
+{
+    TileMap::iterator end = m_tiles.end();
+    for (TileMap::iterator it = m_tiles.begin(); it != end; ++it)
+        it-&gt;value-&gt;showBorder(m_tileCache-&gt;tileBordersVisible());
+}
+
+unsigned LegacyTileGrid::tileCount() const
+{
+    return m_tiles.size();
+}
+
+bool LegacyTileGrid::checkDoSingleTileLayout()
+{
+    IntSize size = bounds().size();
+    if (size.width() &gt; m_tileSize.width() || size.height() &gt; m_tileSize.height())
+        return false;
+
+    if (m_origin != IntPoint(0, 0)) {
+        m_tiles.clear();
+        m_origin = IntPoint(0, 0);
+    }
+
+    dropInvalidTiles();
+
+    if (size.isEmpty()) {
+        ASSERT(!m_tiles.get(TileIndex(0, 0)));
+        return true;
+    }
+
+    TileIndex originIndex(0, 0);
+    if (!m_tiles.get(originIndex))
+        m_tiles.set(originIndex, LegacyTileGridTile::create(this, tileRectForIndex(originIndex)));
+
+    return true;
+}
+
+void LegacyTileGrid::updateHostLayerSize()
+{
+    CALayer* hostLayer = m_tileCache-&gt;hostLayer();
+    CGRect tileHostBounds = [hostLayer convertRect:[hostLayer bounds] toLayer:tileHostLayer()];
+    CGSize transformedSize;
+    transformedSize.width = CGRound(tileHostBounds.size.width);
+    transformedSize.height = CGRound(tileHostBounds.size.height);
+
+    CGRect bounds = [tileHostLayer() bounds];
+    if (CGSizeEqualToSize(bounds.size, transformedSize))
+        return;
+    bounds.size = transformedSize;
+    [tileHostLayer() setBounds:bounds];
+}
+
+void LegacyTileGrid::dropInvalidTiles()
+{
+    IntRect bounds = this-&gt;bounds();
+    IntRect dropBounds = intersection(m_validBounds, bounds);
+    Vector&lt;TileIndex&gt; toRemove;
+    for (const auto&amp; tile : m_tiles) {
+        const TileIndex&amp; index = tile.key;
+        const IntRect&amp; tileRect = tile.value-&gt;rect();
+        IntRect expectedTileRect = tileRectForIndex(index);
+        if (expectedTileRect != tileRect || !dropBounds.contains(tileRect))
+            toRemove.append(index);
+    }
+    unsigned removeCount = toRemove.size();
+    for (unsigned n = 0; n &lt; removeCount; ++n)
+        m_tiles.remove(toRemove[n]);
+
+    m_validBounds = bounds;
+}
+
+void LegacyTileGrid::invalidateTiles(const IntRect&amp; dirtyRect)
+{
+    if (!hasTiles())
+        return;
+
+    IntRect bounds = this-&gt;bounds();
+    if (intersection(bounds, m_validBounds) != m_validBounds) {
+        // The bounds have got smaller. Everything outside will also be considered invalid and will be dropped by dropInvalidTiles().
+        // Due to dirtyRect being limited to current bounds the tiles that are temporarily outside might miss invalidation 
+        // completely othwerwise.
+        m_validBounds = bounds;
+    }
+
+    Vector&lt;TileIndex&gt; invalidatedTiles;
+
+    if (dirtyRect.width() &gt; m_tileSize.width() * 4 || dirtyRect.height() &gt; m_tileSize.height() * 4) {
+        // For large invalidates, iterate over live tiles.
+        TileMap::iterator end = m_tiles.end();
+        for (TileMap::iterator it = m_tiles.begin(); it != end; ++it) {
+            LegacyTileGridTile* tile = it-&gt;value.get();
+            if (!tile-&gt;rect().intersects(dirtyRect))
+               continue;
+            tile-&gt;invalidateRect(dirtyRect);
+            invalidatedTiles.append(it-&gt;key);
+        }
+    } else {
+        TileIndex topLeftIndex = tileIndexForPoint(topLeft(dirtyRect));
+        TileIndex bottomRightIndex = tileIndexForPoint(bottomRight(dirtyRect));
+        for (int yIndex = topLeftIndex.y(); yIndex &lt;= bottomRightIndex.y(); ++yIndex) {
+            for (int xIndex = topLeftIndex.x(); xIndex &lt;= bottomRightIndex.x(); ++xIndex) {
+                TileIndex index(xIndex, yIndex);
+                RefPtr&lt;LegacyTileGridTile&gt; tile = tileForIndex(index);
+                if (!tile)
+                    continue;
+                if (!tile-&gt;rect().intersects(dirtyRect))
+                    continue;
+                tile-&gt;invalidateRect(dirtyRect);
+                invalidatedTiles.append(index);
+            }
+        }
+    }
+    if (invalidatedTiles.isEmpty())
+        return;
+    // When using minimal coverage, drop speculative tiles instead of updating them.
+    if (!shouldUseMinimalTileCoverage())
+        return;
+    if (m_tileCache-&gt;tilingMode() != LegacyTileCache::Minimal &amp;&amp; m_tileCache-&gt;tilingMode() != LegacyTileCache::Normal)
+        return;
+    IntRect visibleRect = this-&gt;visibleRect();
+    unsigned count = invalidatedTiles.size();
+    for (unsigned i = 0; i &lt; count; ++i) {
+        RefPtr&lt;LegacyTileGridTile&gt; tile = tileForIndex(invalidatedTiles[i]);
+        if (!tile-&gt;rect().intersects(visibleRect))
+            m_tiles.remove(invalidatedTiles[i]);
+    }
+}
+
+bool LegacyTileGrid::shouldUseMinimalTileCoverage() const
+{
+    return m_tileCache-&gt;tilingMode() == LegacyTileCache::Minimal
+        || !m_tileCache-&gt;isSpeculativeTileCreationEnabled()
+        || memoryPressureHandler().hasReceivedMemoryPressure();
+}
+
+IntRect LegacyTileGrid::adjustCoverRectForPageBounds(const IntRect&amp; rect) const
+{
+    // Adjust the rect so that it stays within the bounds and keeps the pixel size.
+    IntRect bounds = this-&gt;bounds();
+    IntRect adjustedRect = rect;
+    adjustedRect.move(rect.x() &lt; bounds.x() ? bounds.x() - rect.x() : 0,
+              rect.y() &lt; bounds.y() ? bounds.y() - rect.y() : 0);
+    adjustedRect.move(rect.maxX() &gt; bounds.maxX() ? bounds.maxX() - rect.maxX() : 0,
+              rect.maxY() &gt; bounds.maxY() ? bounds.maxY() - rect.maxY() : 0);
+    adjustedRect = intersection(bounds, adjustedRect);
+    if (adjustedRect == rect || adjustedRect.isEmpty() || shouldUseMinimalTileCoverage())
+        return adjustedRect;
+    int pixels = adjustedRect.width() * adjustedRect.height();
+    if (adjustedRect.width() != rect.width())
+        adjustedRect.inflateY((pixels / adjustedRect.width() - adjustedRect.height()) / 2);
+    else if (adjustedRect.height() != rect.height())
+        adjustedRect.inflateX((pixels / adjustedRect.height() - adjustedRect.width()) / 2);
+    return intersection(adjustedRect, bounds);
+}
+
+IntRect LegacyTileGrid::calculateCoverRect(const IntRect&amp; visibleRect, bool&amp; centerGrid)
+{
+    // Use minimum coverRect if we are under memory pressure.
+    if (shouldUseMinimalTileCoverage()) {
+        centerGrid = true;
+        return visibleRect;
+    }
+    IntRect coverRect = visibleRect;
+    centerGrid = false;
+    coverRect.inflateX(visibleRect.width() / 2);
+    coverRect.inflateY(visibleRect.height());
+    return adjustCoverRectForPageBounds(coverRect);
+}
+
+double LegacyTileGrid::tileDistance2(const IntRect&amp; visibleRect, const IntRect&amp; tileRect) const
+{
+    // The &quot;distance&quot; calculated here is used to pick which tile to cache next. The idea is to create those
+    // closest to the current viewport first so the user is more likely to see already rendered content we she
+    // scrolls. The calculation is weighted to prefer vertical and downward direction.
+    if (visibleRect.intersects(tileRect))
+        return 0;
+    IntPoint visibleCenter = visibleRect.location() + IntSize(visibleRect.width() / 2, visibleRect.height() / 2);
+    IntPoint tileCenter = tileRect.location() + IntSize(tileRect.width() / 2, tileRect.height() / 2);
+    
+    double horizontalBias = 1.0;
+    double leftwardBias = 1.0;
+    double rightwardBias = 1.0;
+
+    double verticalBias = 1.0;
+    double upwardBias = 1.0;
+    double downwardBias = 1.0;
+
+    const double tilingBiasVeryLikely = 0.8;
+    const double tilingBiasLikely = 0.9;
+
+    switch (m_tileCache-&gt;tilingDirection()) {
+    case LegacyTileCache::TilingDirectionUp:
+        verticalBias = tilingBiasVeryLikely;
+        upwardBias = tilingBiasLikely;
+        break;
+    case LegacyTileCache::TilingDirectionDown:
+        verticalBias = tilingBiasVeryLikely;
+        downwardBias = tilingBiasLikely;
+        break;
+    case LegacyTileCache::TilingDirectionLeft:
+        horizontalBias = tilingBiasVeryLikely;
+        leftwardBias = tilingBiasLikely;
+        break;
+    case LegacyTileCache::TilingDirectionRight:
+        horizontalBias = tilingBiasVeryLikely;
+        rightwardBias = tilingBiasLikely;
+        break;
+    }
+
+    double xScale = horizontalBias * visibleRect.height() / visibleRect.width() * (tileCenter.x() &gt;= visibleCenter.x() ? rightwardBias : leftwardBias);
+    double yScale = verticalBias * visibleRect.width() / visibleRect.height() * (tileCenter.y() &gt;= visibleCenter.y() ? downwardBias : upwardBias);
+
+    double xDistance = xScale * (tileCenter.x() - visibleCenter.x());
+    double yDistance = yScale * (tileCenter.y() - visibleCenter.y());
+
+    double distance2 = xDistance * xDistance + yDistance * yDistance;
+    return distance2;
+}
+
+void LegacyTileGrid::createTiles(LegacyTileCache::SynchronousTileCreationMode creationMode)
+{
+    IntRect visibleRect = this-&gt;visibleRect();
+    if (visibleRect.isEmpty())
+        return;
+
+    // Drop tiles that are wrong size or outside the frame (because the frame has been resized).
+    dropInvalidTiles();
+
+    bool centerGrid;
+    IntRect coverRect = calculateCoverRect(visibleRect, centerGrid);
+
+    // If tile size is bigger than the view, centering minimizes the painting needed to cover the screen.
+    // This is especially useful after zooming 
+    centerGrid = centerGrid || !tileCount();
+    if (centerGrid)
+        centerTileGridOrigin(visibleRect);
+
+    double shortestDistance = std::numeric_limits&lt;double&gt;::infinity();
+    double coveredDistance = 0;
+    Vector&lt;LegacyTileGrid::TileIndex&gt; tilesToCreate;
+    unsigned pendingTileCount = 0;
+
+    LegacyTileGrid::TileIndex topLeftIndex = tileIndexForPoint(topLeft(coverRect));
+    LegacyTileGrid::TileIndex bottomRightIndex = tileIndexForPoint(bottomRight(coverRect));
+    for (int yIndex = topLeftIndex.y(); yIndex &lt;= bottomRightIndex.y(); ++yIndex) {
+        for (int xIndex = topLeftIndex.x(); xIndex &lt;= bottomRightIndex.x(); ++xIndex) {
+            LegacyTileGrid::TileIndex index(xIndex, yIndex);
+            // Currently visible tiles have distance of 0 and get all created in the same transaction.
+            double distance = tileDistance2(visibleRect, tileRectForIndex(index));
+            if (distance &gt; coveredDistance)
+                coveredDistance = distance;
+            if (tileForIndex(index))
+                continue;
+            ++pendingTileCount;
+            if (distance &gt; shortestDistance)
+                continue;
+            if (distance &lt; shortestDistance) {
+                tilesToCreate.clear();
+                shortestDistance = distance;
+            }
+            tilesToCreate.append(index);
+        }
+    }
+
+    size_t tilesToCreateCount = tilesToCreate.size();
+
+    // Tile creation timer will invoke this function again in CoverSpeculative mode.
+    bool candidateTilesAreSpeculative = shortestDistance &gt; 0;
+    if (creationMode == LegacyTileCache::CoverVisibleOnly &amp;&amp; candidateTilesAreSpeculative)
+        tilesToCreateCount = 0;
+
+    // Even if we don't create any tiles, we should still drop distant tiles
+    // in case coverRect got smaller.
+    double keepDistance = std::min(shortestDistance, coveredDistance);
+    if (!dropDistantTiles(tilesToCreateCount, keepDistance))
+        return;
+
+    ASSERT(pendingTileCount &gt;= tilesToCreateCount);
+    if (!pendingTileCount)
+        return;
+
+    for (size_t n = 0; n &lt; tilesToCreateCount; ++n)
+        addTileForIndex(tilesToCreate[n]);
+
+    bool didCreateTiles = !!tilesToCreateCount;
+    bool createMoreTiles = pendingTileCount &gt; tilesToCreateCount;
+    m_tileCache-&gt;finishedCreatingTiles(didCreateTiles, createMoreTiles);
+}
+
+void LegacyTileGrid::dumpTiles()
+{
+    IntRect visibleRect = this-&gt;visibleRect();
+    NSLog(@&quot;transformed visibleRect = [%6d %6d %6d %6d]&quot;, visibleRect.x(), visibleRect.y(), visibleRect.width(), visibleRect.height());
+    unsigned i = 0;
+    TileMap::iterator end = m_tiles.end();
+    for (TileMap::iterator it = m_tiles.begin(); it != end; ++it) {
+        TileIndex&amp; index = it-&gt;key;
+        IntRect tileRect = it-&gt;value-&gt;rect();
+        NSLog(@&quot;#%-3d (%3d %3d) - [%6d %6d %6d %6d]%@&quot;, ++i, index.x(), index.y(), tileRect.x(), tileRect.y(), tileRect.width(), tileRect.height(), tileRect.intersects(visibleRect) ? @&quot; *&quot; : @&quot;&quot;);
+        NSLog(@&quot;     %@&quot;, [it-&gt;value-&gt;tileLayer() contents]);
+    }
+}
+
+} // namespace WebCore
+
+#endif // PLATFORM(IOS)
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformiosLegacyTileGridTilehfromrev166453trunkSourceWebCoreplatformiosTileGridTileh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/ios/LegacyTileGridTile.h (from rev 166453, trunk/Source/WebCore/platform/ios/TileGridTile.h) (0 => 166529)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/LegacyTileGridTile.h                                (rev 0)
+++ trunk/Source/WebCore/platform/ios/LegacyTileGridTile.h        2014-03-31 21:18:23 UTC (rev 166529)
</span><span class="lines">@@ -0,0 +1,65 @@
</span><ins>+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef LegacyTileGridTile_h
+#define LegacyTileGridTile_h
+
+#if PLATFORM(IOS)
+
+#include &quot;IntRect.h&quot;
+#include &lt;wtf/RefCounted.h&gt;
+#include &lt;wtf/RefPtr.h&gt;
+#include &lt;wtf/RetainPtr.h&gt;
+
+@class LegacyTileLayer;
+
+namespace WebCore {
+
+class LegacyTileGrid;
+
+// Refcount the tiles so they work nicely in vector and we know when to remove the tile layer from the parent.
+class LegacyTileGridTile : public RefCounted&lt;LegacyTileGridTile&gt; {
+public:
+    static PassRefPtr&lt;LegacyTileGridTile&gt; create(LegacyTileGrid* grid, const IntRect&amp; rect) { return adoptRef&lt;LegacyTileGridTile&gt;(new LegacyTileGridTile(grid, rect)); }
+    ~LegacyTileGridTile();
+
+    LegacyTileLayer* tileLayer() const { return m_tileLayer.get(); }
+    void invalidateRect(const IntRect&amp; rectInSurface);
+    IntRect rect() const { return m_rect; }
+    void setRect(const IntRect&amp; tileRect);
+    void showBorder(bool);
+
+private:
+    LegacyTileGridTile(LegacyTileGrid*, const IntRect&amp;);
+
+    LegacyTileGrid* m_tileGrid;
+    RetainPtr&lt;LegacyTileLayer&gt; m_tileLayer;
+    IntRect m_rect;
+};
+
+} // namespace WebCore
+
+#endif // PLATFORM(IOS)
+#endif // LegacyTileGridTile_h
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformiosLegacyTileGridTilemmfromrev166453trunkSourceWebCoreplatformiosTileGridTilemm"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/ios/LegacyTileGridTile.mm (from rev 166453, trunk/Source/WebCore/platform/ios/TileGridTile.mm) (0 => 166529)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/LegacyTileGridTile.mm                                (rev 0)
+++ trunk/Source/WebCore/platform/ios/LegacyTileGridTile.mm        2014-03-31 21:18:23 UTC (rev 166529)
</span><span class="lines">@@ -0,0 +1,131 @@
</span><ins>+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;LegacyTileGridTile.h&quot;
+
+#if PLATFORM(IOS)
+
+#include &quot;Color.h&quot;
+#include &quot;LegacyTileCache.h&quot;
+#include &quot;LegacyTileGrid.h&quot;
+#include &quot;LegacyTileLayer.h&quot;
+#include &quot;LegacyTileLayerPool.h&quot;
+#include &quot;WAKWindow.h&quot;
+#include &lt;QuartzCore/QuartzCore.h&gt;
+#include &lt;QuartzCore/QuartzCorePrivate.h&gt;
+#include &lt;algorithm&gt;
+#include &lt;functional&gt;
+
+namespace WebCore {
+
+#if LOG_TILING
+static int totalTileCount;
+#endif
+
+LegacyTileGridTile::LegacyTileGridTile(LegacyTileGrid* tileGrid, const IntRect&amp; tileRect)
+    : m_tileGrid(tileGrid)
+    , m_rect(tileRect)
+{
+    ASSERT(!tileRect.isEmpty());
+    IntSize pixelSize(m_rect.size());
+    const CGFloat screenScale = m_tileGrid-&gt;tileCache()-&gt;screenScale();
+    pixelSize.scale(screenScale);
+    m_tileLayer = LegacyTileLayerPool::sharedPool()-&gt;takeLayerWithSize(pixelSize);
+    if (!m_tileLayer) {
+#if LOG_TILING
+        NSLog(@&quot;unable to reuse layer with size %d x %d, creating one&quot;, pixelSize.width(), pixelSize.height());
+#endif
+        m_tileLayer = adoptNS([[LegacyTileLayer alloc] init]);
+    }
+    LegacyTileLayer* layer = m_tileLayer.get();
+    [layer setTileGrid:tileGrid];
+    [layer setOpaque:m_tileGrid-&gt;tileCache()-&gt;tilesOpaque()];
+    [layer setEdgeAntialiasingMask:0];
+    [layer setNeedsLayoutOnGeometryChange:NO];
+    [layer setContentsScale:screenScale];
+    [layer setAcceleratesDrawing:m_tileGrid-&gt;tileCache()-&gt;acceleratedDrawingEnabled()];
+
+    // Host layer may have other sublayers. Keep the tile layers at the beginning of the array
+    // so they are painted behind everything else.
+    [tileGrid-&gt;tileHostLayer() insertSublayer:layer atIndex:tileGrid-&gt;tileCount()];
+    [layer setFrame:m_rect];
+    invalidateRect(m_rect);
+    showBorder(m_tileGrid-&gt;tileCache()-&gt;tileBordersVisible());
+
+#if LOG_TILING
+    ++totalTileCount;
+    NSLog(@&quot;new Tile (%d,%d) %d %d, count %d&quot;, tileRect.x(), tileRect.y(), tileRect.width(), tileRect.height(), totalTileCount);
+#endif
+}
+
+LegacyTileGridTile::~LegacyTileGridTile() 
+{
+    [tileLayer() setTileGrid:0];
+    [tileLayer() removeFromSuperlayer];
+    LegacyTileLayerPool::sharedPool()-&gt;addLayer(tileLayer());
+#if LOG_TILING
+    --totalTileCount;
+    NSLog(@&quot;delete Tile (%d,%d) %d %d, count %d&quot;, m_rect.x(), m_rect.y(), m_rect.width(), m_rect.height(), totalTileCount);
+#endif
+}
+
+void LegacyTileGridTile::invalidateRect(const IntRect&amp; windowDirtyRect)
+{
+    IntRect dirtyRect = intersection(windowDirtyRect, m_rect);
+    if (dirtyRect.isEmpty())
+        return;
+    dirtyRect.move(IntPoint() - m_rect.location());
+    [tileLayer() setNeedsDisplayInRect:dirtyRect];
+
+    if (m_tileGrid-&gt;tileCache()-&gt;tilePaintCountersVisible())
+        [tileLayer() setNeedsDisplayInRect:CGRectMake(0, 0, 46, 25)];
+}
+
+void LegacyTileGridTile::setRect(const IntRect&amp; tileRect)
+{
+    if (m_rect == tileRect)
+        return;
+    m_rect = tileRect;
+    LegacyTileLayer* layer = m_tileLayer.get();
+    [layer setFrame:m_rect];
+    [layer setNeedsDisplay];
+}
+
+void LegacyTileGridTile::showBorder(bool flag)
+{
+    LegacyTileLayer* layer = m_tileLayer.get();
+    if (flag) {
+        [layer setBorderColor:cachedCGColor(m_tileGrid-&gt;tileCache()-&gt;colorForGridTileBorder(m_tileGrid), ColorSpaceDeviceRGB)];
+        [layer setBorderWidth:0.5f];
+    } else {
+        [layer setBorderColor:nil];
+        [layer setBorderWidth:0];
+    }
+}
+
+} // namespace WebCore
+
+#endif // PLATFORM(IOS)
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformiosLegacyTileLayerhfromrev166453trunkSourceWebCoreplatformiosTileLayerh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/ios/LegacyTileLayer.h (from rev 166453, trunk/Source/WebCore/platform/ios/TileLayer.h) (0 => 166529)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/LegacyTileLayer.h                                (rev 0)
+++ trunk/Source/WebCore/platform/ios/LegacyTileLayer.h        2014-03-31 21:18:23 UTC (rev 166529)
</span><span class="lines">@@ -0,0 +1,53 @@
</span><ins>+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef LegacyTileLayer_h
+#define LegacyTileLayer_h
+
+#if PLATFORM(IOS)
+
+#include &lt;QuartzCore/CALayer.h&gt;
+
+namespace WebCore {
+class LegacyTileGrid;
+};
+
+@interface LegacyTileLayer : CALayer {
+    WebCore::LegacyTileGrid* _tileGrid;
+    unsigned _paintCount;
+}
+@property (nonatomic) unsigned paintCount;
+@property (nonatomic) WebCore::LegacyTileGrid* tileGrid;
++ (LegacyTileLayer *)layerBeingPainted;
+@end
+
+@interface LegacyTileHostLayer : CALayer {
+    WebCore::LegacyTileGrid* _tileGrid;
+}
+- (id)initWithTileGrid:(WebCore::LegacyTileGrid*)tileGrid;
+@end
+
+#endif // PLATFORM(IOS)
+#endif // TileLayer_h
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformiosLegacyTileLayermmfromrev166453trunkSourceWebCoreplatformiosTileLayermm"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/ios/LegacyTileLayer.mm (from rev 166453, trunk/Source/WebCore/platform/ios/TileLayer.mm) (0 => 166529)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/LegacyTileLayer.mm                                (rev 0)
+++ trunk/Source/WebCore/platform/ios/LegacyTileLayer.mm        2014-03-31 21:18:23 UTC (rev 166529)
</span><span class="lines">@@ -0,0 +1,103 @@
</span><ins>+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;LegacyTileLayer.h&quot;
+
+#if PLATFORM(IOS)
+
+#include &quot;LegacyTileCache.h&quot;
+#include &quot;LegacyTileGrid.h&quot;
+#include &quot;WebCoreThread.h&quot;
+
+@implementation LegacyTileHostLayer
+- (id)initWithTileGrid:(WebCore::LegacyTileGrid*)tileGrid
+{
+    self = [super init];
+    if (!self)
+        return nil;
+    _tileGrid = tileGrid;
+    [self setAnchorPoint:CGPointZero];
+    return self;
+}
+
+- (id&lt;CAAction&gt;)actionForKey:(NSString *)key
+{
+    UNUSED_PARAM(key);
+    // Disable all default actions
+    return nil;
+}
+
+- (void)renderInContext:(CGContextRef)context
+{
+    if (pthread_main_np())
+        WebThreadLock();
+    _tileGrid-&gt;tileCache()-&gt;doLayoutTiles();
+    [super renderInContext:context];
+}
+@end
+
+@implementation LegacyTileLayer
+@synthesize paintCount = _paintCount;
+@synthesize tileGrid = _tileGrid;
+
+static LegacyTileLayer *layerBeingPainted;
+
+- (void)setNeedsDisplayInRect:(CGRect)rect
+{
+    [self setNeedsLayout];
+    [super setNeedsDisplayInRect:rect];
+}
+
+- (void)layoutSublayers
+{
+    if (pthread_main_np())
+        WebThreadLock();
+    // This may trigger WebKit layout and generate more repaint rects.
+    if (_tileGrid)
+        _tileGrid-&gt;tileCache()-&gt;prepareToDraw();
+}
+
+- (void)drawInContext:(CGContextRef)context
+{
+    if (_tileGrid)
+        _tileGrid-&gt;tileCache()-&gt;drawLayer(self, context);
+}
+
+- (id&lt;CAAction&gt;)actionForKey:(NSString *)key
+{
+    UNUSED_PARAM(key);
+    // Disable all default actions
+    return nil;
+}
+
++ (LegacyTileLayer *)layerBeingPainted
+{
+    return layerBeingPainted;
+}
+
+@end
+
+#endif // PLATFORM(IOS)
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformiosLegacyTileLayerPoolhfromrev166453trunkSourceWebCoreplatformiosTileLayerPoolh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/ios/LegacyTileLayerPool.h (from rev 166453, trunk/Source/WebCore/platform/ios/TileLayerPool.h) (0 => 166529)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/LegacyTileLayerPool.h                                (rev 0)
+++ trunk/Source/WebCore/platform/ios/LegacyTileLayerPool.h        2014-03-31 21:18:23 UTC (rev 166529)
</span><span class="lines">@@ -0,0 +1,90 @@
</span><ins>+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef LegacyTileLayerPool_h
+#define LegacyTileLayerPool_h
+
+#if PLATFORM(IOS)
+
+#include &quot;IntSize.h&quot;
+#include &quot;IntSizeHash.h&quot;
+#include &quot;Timer.h&quot;
+#include &lt;wtf/Deque.h&gt;
+#include &lt;wtf/HashMap.h&gt;
+#include &lt;wtf/NeverDestroyed.h&gt;
+#include &lt;wtf/OwnPtr.h&gt;
+#include &lt;wtf/RetainPtr.h&gt;
+#include &lt;wtf/Threading.h&gt;
+#include &lt;wtf/Vector.h&gt;
+
+@class LegacyTileLayer;
+
+namespace WebCore {
+
+class LegacyTileLayerPool {
+    WTF_MAKE_NONCOPYABLE(LegacyTileLayerPool);
+public:
+    static LegacyTileLayerPool* sharedPool();
+
+    void addLayer(const RetainPtr&lt;LegacyTileLayer&gt;&amp;);
+    RetainPtr&lt;LegacyTileLayer&gt; takeLayerWithSize(const IntSize&amp;);
+
+    // The maximum size of all queued layers in bytes.
+    unsigned capacity() const { return m_capacity; }
+    void setCapacity(unsigned);
+    void drain();
+
+    unsigned decayedCapacity() const;
+
+    static unsigned bytesBackingLayerWithPixelSize(const IntSize&amp;);
+
+private:
+    LegacyTileLayerPool();
+
+    typedef Deque&lt;RetainPtr&lt;LegacyTileLayer&gt; &gt; LayerList;
+
+    bool canReuseLayerWithSize(const IntSize&amp; size) const { return m_capacity &amp;&amp; !size.isEmpty(); }
+    void schedulePrune();
+    void prune();
+    typedef enum { LeaveUnchanged, MarkAsUsed } AccessType;
+    LayerList&amp; listOfLayersWithSize(const IntSize&amp;, AccessType = LeaveUnchanged);
+
+    HashMap&lt;IntSize, LayerList&gt; m_reuseLists;
+    // Ordered by recent use. The last size is the most recently used.
+    Vector&lt;IntSize&gt; m_sizesInPruneOrder;
+    unsigned m_totalBytes;
+    unsigned m_capacity;
+    Mutex m_layerPoolMutex;
+
+    double m_lastAddTime;
+    bool m_needsPrune;
+
+    friend NeverDestroyed&lt;LegacyTileLayerPool&gt;;
+};
+
+} // namespace WebCore
+
+#endif // PLATFORM(IOS)
+#endif // TileLayerPool_h
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformiosLegacyTileLayerPoolmmfromrev166453trunkSourceWebCoreplatformiosTileLayerPoolmm"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/ios/LegacyTileLayerPool.mm (from rev 166453, trunk/Source/WebCore/platform/ios/TileLayerPool.mm) (0 => 166529)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/LegacyTileLayerPool.mm                                (rev 0)
+++ trunk/Source/WebCore/platform/ios/LegacyTileLayerPool.mm        2014-03-31 21:18:23 UTC (rev 166529)
</span><span class="lines">@@ -0,0 +1,174 @@
</span><ins>+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;LegacyTileLayerPool.h&quot;
+
+#if PLATFORM(IOS)
+
+#include &quot;LegacyTileLayer.h&quot;
+#include &quot;LegacyTileGrid.h&quot;
+#include &quot;Logging.h&quot;
+#include &quot;MemoryPressureHandler.h&quot;
+#include &lt;wtf/CurrentTime.h&gt;
+#include &lt;wtf/NeverDestroyed.h&gt;
+
+namespace WebCore {
+
+static const double capacityDecayTime = 5;
+
+LegacyTileLayerPool::LegacyTileLayerPool()
+    : m_totalBytes(0)
+    , m_capacity(0)
+    , m_lastAddTime(0)
+    , m_needsPrune(false)
+{
+}
+
+LegacyTileLayerPool* LegacyTileLayerPool::sharedPool()
+{
+    static NeverDestroyed&lt;LegacyTileLayerPool&gt; sharedPool;
+    return &amp;sharedPool.get();
+}
+
+unsigned LegacyTileLayerPool::bytesBackingLayerWithPixelSize(const IntSize&amp; size)
+{
+    return size.width() * size.height() * 4;
+}
+
+LegacyTileLayerPool::LayerList&amp; LegacyTileLayerPool::listOfLayersWithSize(const IntSize&amp; size, AccessType accessType)
+{
+    ASSERT(!m_layerPoolMutex.tryLock());
+    HashMap&lt;IntSize, LayerList&gt;::iterator it = m_reuseLists.find(size);
+    if (it == m_reuseLists.end()) {
+        it = m_reuseLists.add(size, LayerList()).iterator;
+        m_sizesInPruneOrder.append(size);
+    } else if (accessType == MarkAsUsed) {
+        m_sizesInPruneOrder.remove(m_sizesInPruneOrder.reverseFind(size));
+        m_sizesInPruneOrder.append(size);
+    }
+    return it-&gt;value;
+}
+
+void LegacyTileLayerPool::addLayer(const RetainPtr&lt;LegacyTileLayer&gt;&amp; layer)
+{
+    IntSize layerSize([layer.get() frame].size);
+    layerSize.scale([layer.get() contentsScale]);
+    if (!canReuseLayerWithSize(layerSize))
+        return;
+
+    if (memoryPressureHandler().hasReceivedMemoryPressure()) {
+        LOG(MemoryPressure, &quot;Under memory pressure: %s, totalBytes: %d&quot;, __PRETTY_FUNCTION__, m_totalBytes);
+        return;
+    }
+
+    MutexLocker locker(m_layerPoolMutex);
+    listOfLayersWithSize(layerSize).prepend(layer);
+    m_totalBytes += bytesBackingLayerWithPixelSize(layerSize);
+
+    m_lastAddTime = currentTime();
+    schedulePrune();
+}
+
+RetainPtr&lt;LegacyTileLayer&gt; LegacyTileLayerPool::takeLayerWithSize(const IntSize&amp; size)
+{
+    if (!canReuseLayerWithSize(size))
+        return nil;
+    MutexLocker locker(m_layerPoolMutex);
+    LayerList&amp; reuseList = listOfLayersWithSize(size, MarkAsUsed);
+    if (reuseList.isEmpty())
+        return nil;
+    m_totalBytes -= bytesBackingLayerWithPixelSize(size);
+    return reuseList.takeFirst();
+}
+
+void LegacyTileLayerPool::setCapacity(unsigned capacity)
+{
+    MutexLocker reuseLocker(m_layerPoolMutex);
+    if (capacity &lt; m_capacity)
+        schedulePrune();
+    m_capacity = capacity;
+}
+    
+unsigned LegacyTileLayerPool::decayedCapacity() const
+{
+    // Decay to one quarter over capacityDecayTime
+    double timeSinceLastAdd = currentTime() - m_lastAddTime;
+    if (timeSinceLastAdd &gt; capacityDecayTime)
+        return m_capacity / 4;
+    float decayProgess = float(timeSinceLastAdd / capacityDecayTime);
+    return m_capacity / 4 + m_capacity * 3 / 4 * (1.f - decayProgess);
+}
+
+void LegacyTileLayerPool::schedulePrune()
+{
+    ASSERT(!m_layerPoolMutex.tryLock());
+    if (m_needsPrune)
+        return;
+    m_needsPrune = true;
+    dispatch_time_t nextPruneTime = dispatch_time(DISPATCH_TIME_NOW, 1 * NSEC_PER_SEC);
+    dispatch_after(nextPruneTime, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+        prune();
+    });
+}
+
+void LegacyTileLayerPool::prune()
+{
+    MutexLocker locker(m_layerPoolMutex);
+    ASSERT(m_needsPrune);
+    m_needsPrune = false;
+    unsigned shrinkTo = decayedCapacity();
+    while (m_totalBytes &gt; shrinkTo) {
+        ASSERT(!m_sizesInPruneOrder.isEmpty());
+        IntSize sizeToDrop = m_sizesInPruneOrder.first();
+        LayerList&amp; oldestReuseList = m_reuseLists.find(sizeToDrop)-&gt;value;
+        if (oldestReuseList.isEmpty()) {
+            m_reuseLists.remove(sizeToDrop);
+            m_sizesInPruneOrder.remove(0);
+            continue;
+        }
+#if LOG_TILING
+        NSLog(@&quot;dropping layer of size %d x %d&quot;, sizeToDrop.width(), sizeToDrop.height());
+#endif
+        m_totalBytes -= bytesBackingLayerWithPixelSize(sizeToDrop);
+        // The last element in the list is the oldest, hence most likely not to
+        // still have a backing store.
+        oldestReuseList.removeLast();
+    }
+    if (currentTime() - m_lastAddTime &lt;= capacityDecayTime)
+        schedulePrune();
+}
+
+void LegacyTileLayerPool::drain()
+{
+    MutexLocker reuseLocker(m_layerPoolMutex);
+    m_reuseLists.clear();
+    m_sizesInPruneOrder.clear();
+    m_totalBytes = 0;
+}
+
+} // namespace WebCore
+
+#endif // PLATFORM(IOS)
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformiosScrollViewIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ios/ScrollViewIOS.mm (166528 => 166529)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/ScrollViewIOS.mm        2014-03-31 21:10:44 UTC (rev 166528)
+++ trunk/Source/WebCore/platform/ios/ScrollViewIOS.mm        2014-03-31 21:18:23 UTC (rev 166529)
</span><span class="lines">@@ -236,7 +236,7 @@
</span><span class="cx">     return IntSize();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-TileCache* ScrollView::tileCache()
</del><ins>+LegacyTileCache* ScrollView::legacyTileCache()
</ins><span class="cx"> {
</span><span class="cx">     // Make tile cache pointer available via the main frame only. Tile cache interaction should be managed by
</span><span class="cx">     // the main frame and this avoids having to add parent checks to all call sites.
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformiosTileCacheh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/platform/ios/TileCache.h (166528 => 166529)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/TileCache.h        2014-03-31 21:10:44 UTC (rev 166528)
+++ trunk/Source/WebCore/platform/ios/TileCache.h        2014-03-31 21:18:23 UTC (rev 166529)
</span><span class="lines">@@ -1,218 +0,0 @@
</span><del>-/*
- * Copyright (C) 2009 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef TileCache_h
-#define TileCache_h
-
-#if PLATFORM(IOS)
-
-#include &quot;Color.h&quot;
-#include &quot;FloatRect.h&quot;
-#include &quot;IntRect.h&quot;
-#include &quot;IntSize.h&quot;
-#include &quot;Timer.h&quot;
-#include &lt;wtf/Noncopyable.h&gt;
-#include &lt;wtf/OwnPtr.h&gt;
-#include &lt;wtf/PassOwnPtr.h&gt;
-#include &lt;wtf/PassRefPtr.h&gt;
-#include &lt;wtf/RetainPtr.h&gt;
-#include &lt;wtf/Threading.h&gt;
-#include &lt;wtf/Vector.h&gt;
-
-#ifdef __OBJC__
-@class CALayer;
-@class TileCacheTombstone;
-@class TileLayer;
-@class WAKWindow;
-#else
-class CALayer;
-class TileCacheTombstone;
-class TileLayer;
-class WAKWindow;
-#endif
-
-namespace WebCore {
-
-class TileGrid;
-
-class TileCache {
-    WTF_MAKE_NONCOPYABLE(TileCache);
-public:
-    TileCache(WAKWindow*);
-    ~TileCache();
-
-    CGFloat screenScale() const;
-
-    void setNeedsDisplay();
-    void setNeedsDisplayInRect(const IntRect&amp;);
-    
-    void layoutTiles();
-    void layoutTilesNow();
-    void layoutTilesNowForRect(const IntRect&amp;);
-    void removeAllNonVisibleTiles();
-    void removeAllTiles();
-    void removeForegroundTiles();
-
-    // If 'contentReplacementImage' is not NULL, drawLayer() draws
-    // contentReplacementImage instead of the page content. We assume the
-    // image is to be drawn at the origin and scaled to match device pixels.
-    void setContentReplacementImage(RetainPtr&lt;CGImageRef&gt;);
-    RetainPtr&lt;CGImageRef&gt; contentReplacementImage() const;
-
-    void setTileBordersVisible(bool);
-    bool tileBordersVisible() const { return m_tileBordersVisible; }
-
-    void setTilePaintCountersVisible(bool);
-    bool tilePaintCountersVisible() const { return m_tilePaintCountersVisible; }
-
-    void setAcceleratedDrawingEnabled(bool enabled) { m_acceleratedDrawingEnabled = enabled; }
-    bool acceleratedDrawingEnabled() const { return m_acceleratedDrawingEnabled; }
-
-    void setKeepsZoomedOutTiles(bool);
-    bool keepsZoomedOutTiles() const { return m_keepsZoomedOutTiles; }
-
-    void setZoomedOutScale(float);
-    float zoomedOutScale() const;
-    
-    void setCurrentScale(float);
-    float currentScale() const;
-    
-    bool tilesOpaque() const;
-    void setTilesOpaque(bool);
-    
-    enum TilingMode {
-        Normal,
-        Minimal,
-        Panning,
-        Zooming,
-        Disabled,
-        ScrollToTop
-    };
-    TilingMode tilingMode() const { return m_tilingMode; }
-    void setTilingMode(TilingMode);
-
-    typedef enum {
-        TilingDirectionUp,
-        TilingDirectionDown,
-        TilingDirectionLeft,
-        TilingDirectionRight,
-    } TilingDirection;
-    void setTilingDirection(TilingDirection);
-    TilingDirection tilingDirection() const;
-
-    bool hasPendingDraw() const;
-
-    void hostLayerSizeChanged();
-
-    static void setLayerPoolCapacity(unsigned);
-    static void drainLayerPool();
-
-    // Logging
-    void dumpTiles();
-
-    // Internal
-    void doLayoutTiles();
-    void drawLayer(TileLayer*, CGContextRef);
-    void prepareToDraw();
-    void finishedCreatingTiles(bool didCreateTiles, bool createMore);
-    FloatRect visibleRectInLayer(CALayer *) const;
-    CALayer* hostLayer() const;
-    unsigned tileCapacityForGrid(TileGrid*);
-    Color colorForGridTileBorder(TileGrid*) const;
-
-    void doPendingRepaints();
-
-    bool isSpeculativeTileCreationEnabled() const { return m_isSpeculativeTileCreationEnabled; }
-    void setSpeculativeTileCreationEnabled(bool);
-    
-    enum SynchronousTileCreationMode { CoverVisibleOnly, CoverSpeculative };
-
-private:
-    TileGrid* activeTileGrid() const;
-    TileGrid* inactiveTileGrid() const;
-
-    void updateTilingMode();
-    bool isTileInvalidationSuspended() const;
-    bool isTileCreationSuspended() const;
-    void flushSavedDisplayRects();
-    void invalidateTiles(const IntRect&amp; dirtyRect);
-    void setZoomedOutScaleInternal(float);
-    void commitScaleChange();
-    void bringActiveTileGridToFront();
-    void adjustTileGridTransforms();
-    void removeAllNonVisibleTilesInternal();
-    void createTilesInActiveGrid(SynchronousTileCreationMode);
-    void scheduleLayerFlushForPendingRepaint();
-
-    void tileCreationTimerFired(Timer&lt;TileCache&gt;*);
-
-    void drawReplacementImage(TileLayer*, CGContextRef, CGImageRef);
-    void drawWindowContent(TileLayer*, CGContextRef, CGRect dirtyRect);
-
-    WAKWindow* m_window;
-
-    RetainPtr&lt;CGImageRef&gt; m_contentReplacementImage;
-
-    bool m_keepsZoomedOutTiles;
-
-    bool m_hasPendingLayoutTiles;
-    bool m_hasPendingUpdateTilingMode;
-    // Ensure there are no async calls on a dead tile cache.
-    RetainPtr&lt;TileCacheTombstone&gt; m_tombstone;
-
-    TilingMode m_tilingMode;
-    TilingDirection m_tilingDirection;
-
-    IntSize m_tileSize;
-    bool m_tilesOpaque;
-
-    bool m_tileBordersVisible;
-    bool m_tilePaintCountersVisible;
-    bool m_acceleratedDrawingEnabled;
-    bool m_isSpeculativeTileCreationEnabled;
-
-    bool m_didCallWillStartScrollingOrZooming;
-    OwnPtr&lt;TileGrid&gt; m_zoomedOutTileGrid;
-    OwnPtr&lt;TileGrid&gt; m_zoomedInTileGrid;
-
-    Timer&lt;TileCache&gt; m_tileCreationTimer;
-
-    Vector&lt;IntRect&gt; m_savedDisplayRects;
-
-    float m_currentScale;
-
-    float m_pendingScale;
-    float m_pendingZoomedOutScale;
-
-    mutable Mutex m_tileMutex;
-    mutable Mutex m_savedDisplayRectMutex;
-    mutable Mutex m_contentReplacementImageMutex;
-};
-
-} // namespace WebCore
-
-#endif // PLATFORM(IOS)
-
-#endif // TileCache_h
</del></span></pre></div>
<a id="trunkSourceWebCoreplatformiosTileCachemm"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/platform/ios/TileCache.mm (166528 => 166529)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/TileCache.mm        2014-03-31 21:10:44 UTC (rev 166528)
+++ trunk/Source/WebCore/platform/ios/TileCache.mm        2014-03-31 21:18:23 UTC (rev 166529)
</span><span class="lines">@@ -1,822 +0,0 @@
</span><del>-/*
- * Copyright (C) 2009 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include &quot;config.h&quot;
-#include &quot;TileCache.h&quot;
-
-#if PLATFORM(IOS)
-
-#include &quot;Logging.h&quot;
-#include &quot;MemoryPressureHandler.h&quot;
-#include &quot;SystemMemory.h&quot;
-#include &quot;TileGrid.h&quot;
-#include &quot;TileGridTile.h&quot;
-#include &quot;TileLayer.h&quot;
-#include &quot;TileLayerPool.h&quot;
-#include &quot;WAKWindow.h&quot;
-#include &quot;WKGraphics.h&quot;
-#include &quot;WebCoreSystemInterface.h&quot;
-#include &quot;WebCoreThreadRun.h&quot;
-#include &lt;QuartzCore/QuartzCore.h&gt;
-#include &lt;QuartzCore/QuartzCorePrivate.h&gt;
-#include &lt;wtf/CurrentTime.h&gt;
-
-@interface WAKView (WebViewExtras)
-- (void)_dispatchTileDidDraw:(CALayer*)tile;
-- (void)_willStartScrollingOrZooming;
-- (void)_didFinishScrollingOrZooming;
-- (void)_dispatchTileDidDraw;
-- (void)_scheduleLayerFlushForPendingTileCacheRepaint;
-@end
-
-@interface TileCacheTombstone : NSObject {
-    BOOL dead;
-}
-@property(getter=isDead) BOOL dead;
-
-@end
-
-@implementation TileCacheTombstone
-
-@synthesize dead;
-
-@end
-
-namespace WebCore {
-
-TileCache::TileCache(WAKWindow* window)
-    : m_window(window)
-    , m_keepsZoomedOutTiles(false)
-    , m_hasPendingLayoutTiles(false)
-    , m_hasPendingUpdateTilingMode(false)
-    , m_tombstone(adoptNS([[TileCacheTombstone alloc] init]))
-    , m_tilingMode(Normal)
-    , m_tilingDirection(TilingDirectionDown)
-    , m_tileSize(512, 512)
-    , m_tilesOpaque(true)
-    , m_tileBordersVisible(false)
-    , m_tilePaintCountersVisible(false)
-    , m_acceleratedDrawingEnabled(false)
-    , m_isSpeculativeTileCreationEnabled(true)
-    , m_didCallWillStartScrollingOrZooming(false)
-    , m_zoomedOutTileGrid(PassOwnPtr&lt;TileGrid&gt;())
-    , m_zoomedInTileGrid(PassOwnPtr&lt;TileGrid&gt;())
-    , m_tileCreationTimer(this, &amp;TileCache::tileCreationTimerFired)
-    , m_currentScale(1.f)
-    , m_pendingScale(0)
-    , m_pendingZoomedOutScale(0)
-{
-    m_zoomedOutTileGrid = TileGrid::create(this, m_tileSize);
-    [hostLayer() insertSublayer:m_zoomedOutTileGrid-&gt;tileHostLayer() atIndex:0];
-    hostLayerSizeChanged();
-}
-
-TileCache::~TileCache()
-{
-    [m_tombstone.get() setDead:true];
-}
-
-CGFloat TileCache::screenScale() const
-{
-    return [m_window screenScale];
-}
-
-CALayer* TileCache::hostLayer() const
-{
-    return [m_window hostLayer];
-}
-
-FloatRect TileCache::visibleRectInLayer(CALayer *layer) const
-{
-    return [layer convertRect:[m_window extendedVisibleRect] fromLayer:hostLayer()];
-}
-
-bool TileCache::tilesOpaque() const
-{
-    return m_tilesOpaque;
-}
-    
-TileGrid* TileCache::activeTileGrid() const
-{
-    if (!m_keepsZoomedOutTiles)
-        return m_zoomedOutTileGrid.get();
-    if (m_tilingMode == Zooming)
-        return m_zoomedOutTileGrid.get();
-    if (m_zoomedInTileGrid &amp;&amp; m_currentScale == m_zoomedInTileGrid-&gt;scale())
-        return m_zoomedInTileGrid.get();
-    return m_zoomedOutTileGrid.get();
-}
-
-TileGrid* TileCache::inactiveTileGrid() const
-{
-    return activeTileGrid() == m_zoomedOutTileGrid ? m_zoomedInTileGrid.get() : m_zoomedOutTileGrid.get();
-}
-
-void TileCache::setTilesOpaque(bool opaque)
-{
-    if (m_tilesOpaque == opaque)
-        return;
-
-    MutexLocker locker(m_tileMutex);
-
-    m_tilesOpaque = opaque;
-    m_zoomedOutTileGrid-&gt;updateTileOpacity();
-    if (m_zoomedInTileGrid)
-        m_zoomedInTileGrid-&gt;updateTileOpacity();
-}
-
-void TileCache::doLayoutTiles()
-{
-    if (isTileCreationSuspended())
-        return;
-
-    MutexLocker locker(m_tileMutex);
-    TileGrid* activeGrid = activeTileGrid();
-    // Even though we aren't actually creating tiles in the inactive grid, we
-    // still need to drop invalid tiles in response to a layout.
-    // See &lt;rdar://problem/9839867&gt;.
-    if (TileGrid* inactiveGrid = inactiveTileGrid())
-        inactiveGrid-&gt;dropInvalidTiles();
-    if (activeGrid-&gt;checkDoSingleTileLayout())
-        return;
-    createTilesInActiveGrid(CoverVisibleOnly);
-}
-
-void TileCache::hostLayerSizeChanged()
-{
-    m_zoomedOutTileGrid-&gt;updateHostLayerSize();
-    if (m_zoomedInTileGrid)
-        m_zoomedInTileGrid-&gt;updateHostLayerSize();
-}
-
-void TileCache::setKeepsZoomedOutTiles(bool keep)
-{
-    m_keepsZoomedOutTiles = keep;
-}
-
-void TileCache::setCurrentScale(float scale)
-{
-    ASSERT(scale &gt; 0);
-
-    if (currentScale() == scale) {
-        m_pendingScale = 0;
-        return;
-    }
-    m_pendingScale = scale;
-    if (m_tilingMode == Disabled)
-        return;
-    commitScaleChange();
-
-    if (!keepsZoomedOutTiles() &amp;&amp; !isTileInvalidationSuspended()) {
-        // Tile invalidation is normally suspended during zooming by UIKit but some applications
-        // using custom scrollviews may zoom without triggering the callbacks. Invalidate the tiles explicitly.
-        MutexLocker locker(m_tileMutex);
-        activeTileGrid()-&gt;dropAllTiles();
-        activeTileGrid()-&gt;createTiles(CoverVisibleOnly);
-    }
-}
-
-void TileCache::setZoomedOutScale(float scale)
-{
-    ASSERT(scale &gt; 0);
-
-    if (zoomedOutScale() == scale) {
-        m_pendingZoomedOutScale = 0;
-        return;
-    }
-    m_pendingZoomedOutScale = scale;
-    if (m_tilingMode == Disabled)
-        return;
-    commitScaleChange();
-}
-    
-void TileCache::commitScaleChange()
-{
-    ASSERT(m_pendingZoomedOutScale || m_pendingScale);
-    ASSERT(m_tilingMode != Disabled);
-    
-    MutexLocker locker(m_tileMutex);
-
-    if (m_pendingZoomedOutScale) {
-        m_zoomedOutTileGrid-&gt;setScale(m_pendingZoomedOutScale);
-        m_pendingZoomedOutScale = 0;
-    }
-    
-    if (!m_keepsZoomedOutTiles) {
-        ASSERT(activeTileGrid() == m_zoomedOutTileGrid);
-        if (m_pendingScale) {
-            m_currentScale = m_pendingScale;
-            m_zoomedOutTileGrid-&gt;setScale(m_currentScale);
-        }
-        m_pendingScale = 0;
-        return;
-    }
-
-    if (m_pendingScale) {
-        m_currentScale = m_pendingScale;
-        m_pendingScale = 0;
-    }
-
-    if (m_currentScale != m_zoomedOutTileGrid-&gt;scale()) {
-        if (!m_zoomedInTileGrid) {
-            m_zoomedInTileGrid = TileGrid::create(this, m_tileSize);
-            [hostLayer() addSublayer:m_zoomedInTileGrid-&gt;tileHostLayer()];
-            hostLayerSizeChanged();
-        }
-        m_zoomedInTileGrid-&gt;setScale(m_currentScale);
-    }
-
-    // Keep the current ordering during zooming.
-    if (m_tilingMode != Zooming)
-        bringActiveTileGridToFront();
-
-    adjustTileGridTransforms();
-    layoutTiles();
-}
-
-void TileCache::bringActiveTileGridToFront()
-{
-    TileGrid* activeGrid = activeTileGrid();
-    TileGrid* otherGrid = inactiveTileGrid();
-    if (!otherGrid)
-        return;
-    CALayer* frontLayer = activeGrid-&gt;tileHostLayer();
-    CALayer* otherLayer = otherGrid-&gt;tileHostLayer();
-    [hostLayer() insertSublayer:frontLayer above:otherLayer];
-}
-    
-void TileCache::adjustTileGridTransforms()
-{
-    CALayer* zoomedOutHostLayer = m_zoomedOutTileGrid-&gt;tileHostLayer();
-    float transformScale = currentScale() / zoomedOutScale();
-    [zoomedOutHostLayer setTransform:CATransform3DMakeScale(transformScale, transformScale, 1.0f)];
-    m_zoomedOutTileGrid-&gt;updateHostLayerSize();
-}
-
-void TileCache::layoutTiles()
-{
-    if (m_hasPendingLayoutTiles)
-        return;
-    m_hasPendingLayoutTiles = true;
-
-    TileCacheTombstone *tombstone = m_tombstone.get();
-    WebThreadRun(^{
-        if ([tombstone isDead])
-            return;
-        m_hasPendingLayoutTiles = false;
-        doLayoutTiles();
-    });
-}
-
-void TileCache::layoutTilesNow()
-{
-    ASSERT(WebThreadIsLockedOrDisabled());
-
-    // layoutTilesNow() is called after a zoom, while the tile mode is still set to Zooming.
-    // If we checked for isTileCreationSuspended here, that would cause &lt;rdar://problem/8434112&gt; (Page flashes after zooming in/out).
-    if (m_tilingMode == Disabled)
-        return;
-    
-    // FIXME: layoutTilesNow should be called after state has been set to non-zooming and the active grid is the final one. 
-    // Fix this in UIKit side (perhaps also getting rid of this call) and remove this code afterwards.
-    // &lt;rdar://problem/9672993&gt;
-    TilingMode savedTilingMode = m_tilingMode;
-    if (m_tilingMode == Zooming)
-        m_tilingMode = Minimal;
-
-    MutexLocker locker(m_tileMutex);
-    TileGrid* activeGrid = activeTileGrid();
-    if (activeGrid-&gt;checkDoSingleTileLayout()) {
-        m_tilingMode = savedTilingMode;
-        return;
-    }
-    createTilesInActiveGrid(CoverVisibleOnly);
-    m_tilingMode = savedTilingMode;
-}
-
-void TileCache::layoutTilesNowForRect(const IntRect&amp; rect)
-{
-    ASSERT(WebThreadIsLockedOrDisabled());
-    MutexLocker locker(m_tileMutex);
-
-    activeTileGrid()-&gt;addTilesCoveringRect(rect);
-}
-
-void TileCache::removeAllNonVisibleTiles()
-{
-    MutexLocker locker(m_tileMutex);
-    removeAllNonVisibleTilesInternal();
-}
-
-void TileCache::removeAllNonVisibleTilesInternal()
-{
-    TileGrid* activeGrid = activeTileGrid();
-    if (keepsZoomedOutTiles() &amp;&amp; activeGrid == m_zoomedInTileGrid &amp;&amp; activeGrid-&gt;hasTiles())
-        m_zoomedOutTileGrid-&gt;dropAllTiles();
-
-    IntRect activeTileBounds = activeGrid-&gt;bounds();
-    if (activeTileBounds.width() &lt;= m_tileSize.width() &amp;&amp; activeTileBounds.height() &lt;= m_tileSize.height()) {
-        // If the view is smaller than a tile, keep the tile even if it is not visible.
-        activeGrid-&gt;dropTilesOutsideRect(activeTileBounds);
-        return;
-    }
-
-    activeGrid-&gt;dropTilesOutsideRect(activeGrid-&gt;visibleRect());
-}
-
-void TileCache::removeAllTiles()
-{
-    MutexLocker locker(m_tileMutex);
-    m_zoomedOutTileGrid-&gt;dropAllTiles();
-    if (m_zoomedInTileGrid)
-        m_zoomedInTileGrid-&gt;dropAllTiles();
-}
-
-void TileCache::removeForegroundTiles()
-{
-    MutexLocker locker(m_tileMutex);
-    if (!keepsZoomedOutTiles())
-        m_zoomedOutTileGrid-&gt;dropAllTiles();
-    if (m_zoomedInTileGrid)
-        m_zoomedInTileGrid-&gt;dropAllTiles();
-}
-
-void TileCache::setContentReplacementImage(RetainPtr&lt;CGImageRef&gt; contentReplacementImage)
-{
-    MutexLocker locker(m_contentReplacementImageMutex);
-    m_contentReplacementImage = contentReplacementImage;
-}
-
-RetainPtr&lt;CGImageRef&gt; TileCache::contentReplacementImage() const
-{
-    MutexLocker locker(m_contentReplacementImageMutex);
-    return m_contentReplacementImage;
-}
-
-void TileCache::setTileBordersVisible(bool flag)
-{
-    if (flag == m_tileBordersVisible)
-        return;
-
-    m_tileBordersVisible = flag;
-    m_zoomedOutTileGrid-&gt;updateTileBorderVisibility();
-    if (m_zoomedInTileGrid)
-        m_zoomedInTileGrid-&gt;updateTileBorderVisibility();
-}
-
-void TileCache::setTilePaintCountersVisible(bool flag)
-{
-    m_tilePaintCountersVisible = flag;
-    // The numbers will show up the next time the tiles paint.
-}
-
-void TileCache::finishedCreatingTiles(bool didCreateTiles, bool createMore)
-{
-    // We need to ensure that all tiles are showing the same version of the content.
-    if (didCreateTiles &amp;&amp; !m_savedDisplayRects.isEmpty())
-        flushSavedDisplayRects();
-
-    if (keepsZoomedOutTiles()) {
-        if (m_zoomedInTileGrid &amp;&amp; activeTileGrid() == m_zoomedOutTileGrid &amp;&amp; m_tilingMode != Zooming &amp;&amp; m_zoomedInTileGrid-&gt;hasTiles()) {
-            // This CA transaction will cover the screen with top level tiles.
-            // We can remove zoomed-in tiles without flashing.
-            m_zoomedInTileGrid-&gt;dropAllTiles();
-        } else if (activeTileGrid() == m_zoomedInTileGrid) {
-            // Pass the minimum possible distance to consider all tiles, even visible ones.
-            m_zoomedOutTileGrid-&gt;dropDistantTiles(0, std::numeric_limits&lt;double&gt;::min());
-        }
-    }
-
-    // Keep creating tiles until the whole coverRect is covered.
-    if (createMore)
-        m_tileCreationTimer.startOneShot(0);
-}
-
-void TileCache::tileCreationTimerFired(Timer&lt;TileCache&gt;*)
-{
-    if (isTileCreationSuspended())
-        return;
-    MutexLocker locker(m_tileMutex);
-    createTilesInActiveGrid(CoverSpeculative);
-}
-
-void TileCache::createTilesInActiveGrid(SynchronousTileCreationMode mode)
-{
-    if (memoryPressureHandler().hasReceivedMemoryPressure()) {
-        LOG(MemoryPressure, &quot;Under memory pressure at: %s&quot;, __PRETTY_FUNCTION__);
-        removeAllNonVisibleTilesInternal();
-    }
-    activeTileGrid()-&gt;createTiles(mode);
-}
-
-unsigned TileCache::tileCapacityForGrid(TileGrid* grid)
-{
-    static unsigned capacity;
-    if (!capacity) {
-        size_t totalMemory = systemTotalMemory();
-        totalMemory /= 1024 * 1024;
-        if (totalMemory &gt;= 1024)
-            capacity = 128 * 1024 * 1024;
-        else if (totalMemory &gt;= 512)
-            capacity = 64 * 1024 * 1024;
-        else
-            capacity = 32 * 1024 * 1024;
-    }
-
-    int gridCapacity;
-
-    int memoryLevel = systemMemoryLevel();
-    if (memoryLevel &lt; 15)
-        gridCapacity = capacity / 4;
-    else if (memoryLevel &lt; 20)
-        gridCapacity = capacity / 2;
-    else if (memoryLevel &lt; 30) 
-        gridCapacity = capacity * 3 / 4;
-    else
-        gridCapacity = capacity;
-
-    if (keepsZoomedOutTiles() &amp;&amp; grid == m_zoomedOutTileGrid) {
-        if (activeTileGrid() == m_zoomedOutTileGrid)
-            return gridCapacity;
-        return gridCapacity / 4;
-    }
-    return gridCapacity * 3 / 4;
-}
-
-Color TileCache::colorForGridTileBorder(TileGrid* grid) const
-{
-    if (grid == m_zoomedOutTileGrid)
-        return Color(.3f, .0f, 0.4f, 0.5f);
-
-    return Color(.0f, .0f, 0.4f, 0.5f);
-}
-
-static bool shouldRepaintInPieces(const CGRect&amp; dirtyRect, CGSRegionObj dirtyRegion, CGFloat contentsScale)
-{
-    // Estimate whether or not we should use the unioned rect or the individual rects.
-    // We do this by computing the percentage of &quot;wasted space&quot; in the union. If that wasted space
-    // is too large, then we will do individual rect painting instead.
-    float singlePixels = 0;
-    unsigned rectCount = 0;
-
-    CGSRegionEnumeratorObj enumerator = CGSRegionEnumerator(dirtyRegion);
-    CGRect *subRect;
-    while ((subRect = CGSNextRect(enumerator))) {
-        ++rectCount;
-        singlePixels += subRect-&gt;size.width * subRect-&gt;size.height;
-    }
-    singlePixels /= (contentsScale * contentsScale);
-    CGSReleaseRegionEnumerator(enumerator);
-
-    const unsigned cRectThreshold = 10;
-    if (rectCount &lt; 2 || rectCount &gt; cRectThreshold)
-        return false;
-
-    const float cWastedSpaceThreshold = 0.50f;
-    float unionPixels = dirtyRect.size.width * dirtyRect.size.height;
-    float wastedSpace = 1.f - (singlePixels / unionPixels);
-    return wastedSpace &gt; cWastedSpaceThreshold;
-}
-
-void TileCache::drawReplacementImage(TileLayer* layer, CGContextRef context, CGImageRef image)
-{
-    CGContextSetRGBFillColor(context, 1, 1, 1, 1);
-    CGContextFillRect(context, CGContextGetClipBoundingBox(context));
-
-    CGFloat contentsScale = [layer contentsScale];
-    CGContextScaleCTM(context, 1 / contentsScale, -1 / contentsScale);
-    CGRect imageRect = CGRectMake(0, 0, CGImageGetWidth(image), CGImageGetHeight(image));
-    CGContextTranslateCTM(context, 0, -imageRect.size.height);
-    CGContextDrawImage(context, imageRect, image);
-}
-
-void TileCache::drawWindowContent(TileLayer* layer, CGContextRef context, CGRect dirtyRect)
-{
-    CGRect frame = [layer frame];
-    WKFontAntialiasingStateSaver fontAntialiasingState(context, [m_window useOrientationDependentFontAntialiasing] &amp;&amp; [layer isOpaque]);
-    fontAntialiasingState.setup([WAKWindow hasLandscapeOrientation]);
-
-    CGSRegionObj drawRegion = (CGSRegionObj)[layer regionBeingDrawn];
-    CGFloat contentsScale = [layer contentsScale];
-    if (drawRegion &amp;&amp; shouldRepaintInPieces(dirtyRect, drawRegion, contentsScale)) {
-        // Use fine grained repaint rectangles to minimize the amount of painted pixels.
-        CGSRegionEnumeratorObj enumerator = CGSRegionEnumerator(drawRegion);
-        CGRect *subRect;
-        while ((subRect = CGSNextRect(enumerator))) {
-            CGRect adjustedSubRect = *subRect;
-            adjustedSubRect.origin.x /= contentsScale;
-            adjustedSubRect.origin.y = frame.size.height - (adjustedSubRect.origin.y + adjustedSubRect.size.height) / contentsScale;
-            adjustedSubRect.size.width /= contentsScale;
-            adjustedSubRect.size.height /= contentsScale;
-
-            CGRect subRectInSuper = [hostLayer() convertRect:adjustedSubRect fromLayer:layer];
-            [m_window displayRect:subRectInSuper];
-        }
-        CGSReleaseRegionEnumerator(enumerator);
-    } else {
-        // Simple repaint
-        CGRect dirtyRectInSuper = [hostLayer() convertRect:dirtyRect fromLayer:layer];
-        [m_window displayRect:dirtyRectInSuper];
-    }
-
-    fontAntialiasingState.restore();
-}
-
-void TileCache::drawLayer(TileLayer* layer, CGContextRef context)
-{
-    // The web lock unlock observer runs after CA commit observer.
-    if (!WebThreadIsLockedOrDisabled()) {
-        LOG_ERROR(&quot;Drawing without holding the web thread lock&quot;);
-        ASSERT_NOT_REACHED();
-    }
-
-    WKSetCurrentGraphicsContext(context);
-
-    CGRect dirtyRect = CGContextGetClipBoundingBox(context);
-    CGRect frame = [layer frame];
-    CGContextTranslateCTM(context, -frame.origin.x, -frame.origin.y);
-    CGRect scaledFrame = [hostLayer() convertRect:[layer bounds] fromLayer:layer];
-    CGContextScaleCTM(context, frame.size.width / scaledFrame.size.width, frame.size.height / scaledFrame.size.height);
-
-    if (RetainPtr&lt;CGImage&gt; contentReplacementImage = this-&gt;contentReplacementImage())
-        drawReplacementImage(layer, context, contentReplacementImage.get());
-    else
-        drawWindowContent(layer, context, dirtyRect);
-
-    ++layer.paintCount;
-    if (m_tilePaintCountersVisible) {
-        char text[16];
-        snprintf(text, sizeof(text), &quot;%d&quot;, layer.paintCount);
-
-        CGContextSaveGState(context);
-
-        CGContextTranslateCTM(context, frame.origin.x, frame.origin.y);
-        CGContextSetFillColorWithColor(context, cachedCGColor(colorForGridTileBorder([layer tileGrid]), ColorSpaceDeviceRGB));
-        
-        CGRect labelBounds = [layer bounds];
-        labelBounds.size.width = 10 + 12 * strlen(text);
-        labelBounds.size.height = 25;
-        CGContextFillRect(context, labelBounds);
-
-        if (acceleratedDrawingEnabled())
-            CGContextSetRGBFillColor(context, 1, 0, 0, 0.4f);
-        else
-            CGContextSetRGBFillColor(context, 1, 1, 1, 0.6f);
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored &quot;-Wdeprecated-declarations&quot;
-        CGContextSetTextMatrix(context, CGAffineTransformMakeScale(1, -1));
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored &quot;-Wdeprecated-declarations&quot;
-        CGContextSelectFont(context, &quot;Helvetica&quot;, 25, kCGEncodingMacRoman);
-        CGContextShowTextAtPoint(context, labelBounds.origin.x + 3, labelBounds.origin.y + 20, text, strlen(text));
-#pragma clang diagnostic pop
-    
-        CGContextRestoreGState(context);        
-    }
-
-    WAKView* view = [m_window contentView];
-    [view performSelector:@selector(_dispatchTileDidDraw:) withObject:layer afterDelay:0.0];
-}
-
-void TileCache::setNeedsDisplay()
-{
-    setNeedsDisplayInRect(IntRect(0, 0, std::numeric_limits&lt;int&gt;::max(), std::numeric_limits&lt;int&gt;::max()));
-}
-
-void TileCache::scheduleLayerFlushForPendingRepaint()
-{
-    WAKView* view = [m_window contentView];
-    [view _scheduleLayerFlushForPendingTileCacheRepaint];
-}
-
-void TileCache::setNeedsDisplayInRect(const IntRect&amp; dirtyRect)
-{
-    MutexLocker locker(m_savedDisplayRectMutex);
-    bool addedFirstRect = m_savedDisplayRects.isEmpty();
-    m_savedDisplayRects.append(dirtyRect);
-    if (!addedFirstRect)
-        return;
-    // Compositing layer flush will call back to doPendingRepaints(). The flush may be throttled and not happen immediately.
-    scheduleLayerFlushForPendingRepaint();
-}
-
-void TileCache::invalidateTiles(const IntRect&amp; dirtyRect)
-{
-    ASSERT(!m_tileMutex.tryLock());
-
-    TileGrid* activeGrid = activeTileGrid();
-    if (!keepsZoomedOutTiles()) {
-        activeGrid-&gt;invalidateTiles(dirtyRect);
-        return;
-    }
-    FloatRect scaledRect = dirtyRect;
-    scaledRect.scale(zoomedOutScale() / currentScale());
-    IntRect zoomedOutDirtyRect = enclosingIntRect(scaledRect);
-    if (activeGrid == m_zoomedOutTileGrid) {
-        bool dummy;
-        IntRect coverRect = m_zoomedOutTileGrid-&gt;calculateCoverRect(m_zoomedOutTileGrid-&gt;visibleRect(), dummy);
-        // Instead of repainting a tile outside the cover rect, just remove it.
-        m_zoomedOutTileGrid-&gt;dropTilesBetweenRects(zoomedOutDirtyRect, coverRect);
-        m_zoomedOutTileGrid-&gt;invalidateTiles(zoomedOutDirtyRect);
-        // We need to invalidate zoomed in tiles as well while zooming, since
-        // we could switch back to the zoomed in grid without dropping its
-        // tiles.  See &lt;rdar://problem/9946759&gt;.
-        if (m_tilingMode == Zooming &amp;&amp; m_zoomedInTileGrid)
-            m_zoomedInTileGrid-&gt;invalidateTiles(dirtyRect);
-        return;
-    }
-    if (!m_zoomedInTileGrid-&gt;hasTiles()) {
-        // If no tiles have been created yet for the zoomed in grid, we can't drop the zoomed out tiles.
-        m_zoomedOutTileGrid-&gt;invalidateTiles(zoomedOutDirtyRect);
-        return;
-    }
-    m_zoomedOutTileGrid-&gt;dropTilesIntersectingRect(zoomedOutDirtyRect);
-    m_zoomedInTileGrid-&gt;invalidateTiles(dirtyRect);
-}
-    
-bool TileCache::isTileCreationSuspended() const 
-{
-    return (!keepsZoomedOutTiles() &amp;&amp; m_tilingMode == Zooming) || m_tilingMode == Disabled;
-}
-
-bool TileCache::isTileInvalidationSuspended() const 
-{ 
-    return m_tilingMode == Zooming || m_tilingMode == Panning || m_tilingMode == ScrollToTop || m_tilingMode == Disabled; 
-}
-
-void TileCache::updateTilingMode()
-{
-    ASSERT(WebThreadIsCurrent() || !WebThreadIsEnabled());
-
-    WAKView* view = [m_window contentView];
-
-    if (m_tilingMode == Zooming || m_tilingMode == Panning || m_tilingMode == ScrollToTop) {
-        if (!m_didCallWillStartScrollingOrZooming) {
-            [view _willStartScrollingOrZooming];
-            m_didCallWillStartScrollingOrZooming = true;
-        }
-    } else {
-        if (m_didCallWillStartScrollingOrZooming) {
-            [view _didFinishScrollingOrZooming];
-            m_didCallWillStartScrollingOrZooming = false;
-        }
-        if (m_tilingMode == Disabled)
-            return;
-
-        MutexLocker locker(m_tileMutex);
-        createTilesInActiveGrid(CoverVisibleOnly);
-
-        if (!m_savedDisplayRects.isEmpty())
-            scheduleLayerFlushForPendingRepaint();
-    }
-}
-
-void TileCache::setTilingMode(TilingMode tilingMode)
-{
-    if (tilingMode == m_tilingMode)
-        return;
-    bool wasZooming = (m_tilingMode == Zooming);
-    m_tilingMode = tilingMode;
-
-    if ((m_pendingZoomedOutScale || m_pendingScale) &amp;&amp; m_tilingMode != Disabled)
-        commitScaleChange();
-    else if (wasZooming) {
-        MutexLocker locker(m_tileMutex);
-        bringActiveTileGridToFront();
-    }
-
-    if (m_hasPendingUpdateTilingMode)
-        return;
-    m_hasPendingUpdateTilingMode = true;
-
-    TileCacheTombstone *tombstone = m_tombstone.get();
-    WebThreadRun(^{
-        if ([tombstone isDead])
-            return;
-        m_hasPendingUpdateTilingMode = false;
-        updateTilingMode();
-    });
-}
-
-void TileCache::setTilingDirection(TilingDirection tilingDirection)
-{
-    m_tilingDirection = tilingDirection;
-}
-
-TileCache::TilingDirection TileCache::tilingDirection() const
-{
-    return m_tilingDirection;
-}
-    
-float TileCache::zoomedOutScale() const
-{
-    return m_zoomedOutTileGrid-&gt;scale();
-}
-
-float TileCache::currentScale() const
-{
-    return m_currentScale;
-}
-
-void TileCache::doPendingRepaints()
-{
-    if (m_savedDisplayRects.isEmpty())
-        return;
-    if (isTileInvalidationSuspended())
-        return;
-    MutexLocker locker(m_tileMutex);
-    flushSavedDisplayRects();
-}
-
-void TileCache::flushSavedDisplayRects()
-{
-    ASSERT(!m_tileMutex.tryLock());
-    ASSERT(!m_savedDisplayRects.isEmpty());
-
-    Vector&lt;IntRect&gt; rects;
-    {
-        MutexLocker locker(m_savedDisplayRectMutex);
-        m_savedDisplayRects.swap(rects);
-    }
-    size_t size = rects.size();
-    for (size_t n = 0; n &lt; size; ++n)
-        invalidateTiles(rects[n]);
-}
-
-void TileCache::setSpeculativeTileCreationEnabled(bool enabled)
-{
-    if (m_isSpeculativeTileCreationEnabled == enabled)
-        return;
-    m_isSpeculativeTileCreationEnabled = enabled;
-    if (m_isSpeculativeTileCreationEnabled)
-        m_tileCreationTimer.startOneShot(0);
-}
-
-bool TileCache::hasPendingDraw() const
-{
-    return !m_savedDisplayRects.isEmpty();
-}
-
-void TileCache::prepareToDraw()
-{
-    // This will trigger document relayout if needed.
-    [[m_window contentView] viewWillDraw];
-
-    if (!m_savedDisplayRects.isEmpty()) {
-        MutexLocker locker(m_tileMutex);
-        flushSavedDisplayRects();
-    }
-}
-
-void TileCache::setLayerPoolCapacity(unsigned capacity)
-{
-    TileLayerPool::sharedPool()-&gt;setCapacity(capacity);
-}
-
-void TileCache::drainLayerPool()
-{
-    TileLayerPool::sharedPool()-&gt;drain();
-}
-
-void TileCache::dumpTiles()
-{
-    NSLog(@&quot;=================&quot;);
-    NSLog(@&quot;ZOOMED OUT&quot;);
-    if (m_zoomedOutTileGrid == activeTileGrid())
-        NSLog(@&quot;&lt;ACTIVE&gt;&quot;);
-    m_zoomedOutTileGrid-&gt;dumpTiles();
-    NSLog(@&quot;=================&quot;);
-    if (m_zoomedInTileGrid) {
-        NSLog(@&quot;ZOOMED IN&quot;);
-        if (m_zoomedInTileGrid == activeTileGrid())
-            NSLog(@&quot;&lt;ACTIVE&gt;&quot;);
-        m_zoomedInTileGrid-&gt;dumpTiles();
-        NSLog(@&quot;=================&quot;);
-    }
-}
-
-} // namespace WebCore
-
-#endif // PLATFORM(IOS)
</del></span></pre></div>
<a id="trunkSourceWebCoreplatformiosTileGridh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/platform/ios/TileGrid.h (166528 => 166529)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/TileGrid.h        2014-03-31 21:10:44 UTC (rev 166528)
+++ trunk/Source/WebCore/platform/ios/TileGrid.h        2014-03-31 21:18:23 UTC (rev 166529)
</span><span class="lines">@@ -1,143 +0,0 @@
</span><del>-/*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef TileGrid_h
-#define TileGrid_h
-
-#if PLATFORM(IOS)
-
-#include &quot;IntPoint.h&quot;
-#include &quot;IntPointHash.h&quot;
-#include &quot;IntRect.h&quot;
-#include &quot;IntSize.h&quot;
-#include &quot;TileCache.h&quot;
-#include &lt;wtf/HashMap.h&gt;
-#include &lt;wtf/Noncopyable.h&gt;
-#include &lt;wtf/OwnPtr.h&gt;
-#include &lt;wtf/PassOwnPtr.h&gt;
-#include &lt;wtf/PassRefPtr.h&gt;
-#include &lt;wtf/RetainPtr.h&gt;
-
-#define LOG_TILING 0
-
-@class CALayer;
-
-namespace WebCore {
-
-class TileGridTile;
-
-class TileGrid {
-    WTF_MAKE_NONCOPYABLE(TileGrid);
-public:
-    typedef IntPoint TileIndex;
-
-    static PassOwnPtr&lt;TileGrid&gt; create(TileCache* cache, const IntSize&amp; tileSize) { return adoptPtr(new TileGrid(cache, tileSize)); }
-
-    ~TileGrid();
-
-    TileCache* tileCache() const { return m_tileCache; }
-
-    CALayer *tileHostLayer() const;
-    IntRect bounds() const;
-    unsigned tileCount() const;
-
-    float scale() const { return m_scale; }
-    void setScale(float scale) { m_scale = scale; }
-
-    IntRect visibleRect() const;
-
-    void createTiles(TileCache::SynchronousTileCreationMode);
-
-    void dropAllTiles();
-    void dropInvalidTiles();
-    void dropTilesOutsideRect(const IntRect&amp;);
-    void dropTilesIntersectingRect(const IntRect&amp;);
-    // Drops tiles that intersect dropRect but do not intersect keepRect.
-    void dropTilesBetweenRects(const IntRect&amp; dropRect, const IntRect&amp; keepRect);
-    bool dropDistantTiles(unsigned tilesNeeded, double shortestDistance);
-
-    void addTilesCoveringRect(const IntRect&amp;);
-
-    bool tilesCover(const IntRect&amp;) const;
-    void centerTileGridOrigin(const IntRect&amp; visibleRect);
-    void invalidateTiles(const IntRect&amp; dirtyRect);
-
-    void updateTileOpacity();
-    void updateTileBorderVisibility();
-    void updateHostLayerSize();
-    bool checkDoSingleTileLayout();
-
-    bool hasTiles() const { return !m_tiles.isEmpty(); }
-
-    IntRect calculateCoverRect(const IntRect&amp; visibleRect, bool&amp; centerGrid);
-
-    // Logging
-    void dumpTiles();
-
-private:
-    double tileDistance2(const IntRect&amp; visibleRect, const IntRect&amp; tileRect) const;
-    unsigned tileByteSize() const;
-
-    void addTileForIndex(const TileIndex&amp;);
-
-    PassRefPtr&lt;TileGridTile&gt; tileForIndex(const TileIndex&amp;) const;
-    IntRect tileRectForIndex(const TileIndex&amp;) const;
-    PassRefPtr&lt;TileGridTile&gt; tileForPoint(const IntPoint&amp;) const;
-    TileIndex tileIndexForPoint(const IntPoint&amp;) const;
-
-    IntRect adjustCoverRectForPageBounds(const IntRect&amp;) const;
-    bool shouldUseMinimalTileCoverage() const;
-
-private:        
-    TileGrid(TileCache*, const IntSize&amp;);
-
-    TileCache* m_tileCache;
-    RetainPtr&lt;CALayer&gt; m_tileHostLayer;
-
-    IntPoint m_origin;
-    IntSize m_tileSize;
-
-    float m_scale;
-
-    typedef HashMap&lt;TileIndex, RefPtr&lt;TileGridTile&gt;&gt; TileMap;
-    TileMap m_tiles;
-
-    IntRect m_validBounds;
-};
-
-static inline IntPoint topLeft(const IntRect&amp; rect)
-{
-    return rect.location();
-}
-
-static inline IntPoint bottomRight(const IntRect&amp; rect)
-{
-    return IntPoint(rect.maxX() - 1, rect.maxY() - 1);
-}
-
-} // namespace WebCore
-
-#endif // PLATFORM(IOS)
-#endif // TileGrid_h
</del></span></pre></div>
<a id="trunkSourceWebCoreplatformiosTileGridmm"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/platform/ios/TileGrid.mm (166528 => 166529)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/TileGrid.mm        2014-03-31 21:10:44 UTC (rev 166528)
+++ trunk/Source/WebCore/platform/ios/TileGrid.mm        2014-03-31 21:18:23 UTC (rev 166529)
</span><span class="lines">@@ -1,567 +0,0 @@
</span><del>-/*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include &quot;config.h&quot;
-#include &quot;TileGrid.h&quot;
-
-#if PLATFORM(IOS)
-
-#include &quot;MemoryPressureHandler.h&quot;
-#include &quot;SystemMemory.h&quot;
-#include &quot;TileGridTile.h&quot;
-#include &quot;TileLayer.h&quot;
-#include &quot;TileLayerPool.h&quot;
-#include &quot;WAKWindow.h&quot;
-#include &lt;CoreGraphics/CoreGraphicsPrivate.h&gt;
-#include &lt;QuartzCore/QuartzCore.h&gt;
-#include &lt;QuartzCore/QuartzCorePrivate.h&gt;
-#include &lt;algorithm&gt;
-#include &lt;functional&gt;
-
-namespace WebCore {
-
-TileGrid::TileGrid(TileCache* tileCache, const IntSize&amp; tileSize)
-    : m_tileCache(tileCache)
-    , m_tileHostLayer(adoptNS([[TileHostLayer alloc] initWithTileGrid:this]))
-    , m_tileSize(tileSize)
-    , m_scale(1)
-    , m_validBounds(0, 0, std::numeric_limits&lt;int&gt;::max(), std::numeric_limits&lt;int&gt;::max()) 
-{
-}
-    
-TileGrid::~TileGrid()
-{
-    [m_tileHostLayer removeFromSuperlayer];
-}
-
-IntRect TileGrid::visibleRect() const
-{
-    IntRect visibleRect = enclosingIntRect(m_tileCache-&gt;visibleRectInLayer(m_tileHostLayer.get()));
-
-    // When fast scrolling to the top, move the visible rect there immediately so we have tiles when the scrolling completes.
-    if (m_tileCache-&gt;tilingMode() == TileCache::ScrollToTop)
-        visibleRect.setY(0);
-
-    return visibleRect;
-}
-
-void TileGrid::dropAllTiles()
-{
-    m_tiles.clear();
-}
-
-void TileGrid::dropTilesIntersectingRect(const IntRect&amp; dropRect)
-{
-    dropTilesBetweenRects(dropRect, IntRect());
-}
-
-void TileGrid::dropTilesOutsideRect(const IntRect&amp; keepRect)
-{
-    dropTilesBetweenRects(IntRect(0, 0, std::numeric_limits&lt;int&gt;::max(), std::numeric_limits&lt;int&gt;::max()), keepRect);
-}
-
-void TileGrid::dropTilesBetweenRects(const IntRect&amp; dropRect, const IntRect&amp; keepRect)
-{
-    Vector&lt;TileIndex&gt; toRemove;
-    for (const auto&amp; tile : m_tiles) {
-        const TileIndex&amp; index = tile.key;
-        IntRect tileRect = tile.value-&gt;rect();
-        if (tileRect.intersects(dropRect) &amp;&amp; !tileRect.intersects(keepRect))
-            toRemove.append(index);
-    }
-    unsigned removeCount = toRemove.size();
-    for (unsigned n = 0; n &lt; removeCount; ++n)
-        m_tiles.remove(toRemove[n]);
-}
-
-unsigned TileGrid::tileByteSize() const
-{
-    IntSize tilePixelSize = m_tileSize;
-    tilePixelSize.scale(m_tileCache-&gt;screenScale());
-    return TileLayerPool::bytesBackingLayerWithPixelSize(tilePixelSize);
-}
-
-template &lt;typename T&gt;
-static bool isFartherAway(const std::pair&lt;double, T&gt;&amp; a, const std::pair&lt;double, T&gt;&amp; b)
-{
-    return a.first &gt; b.first;
-}
-
-bool TileGrid::dropDistantTiles(unsigned tilesNeeded, double shortestDistance)
-{
-    unsigned bytesPerTile = tileByteSize();
-    unsigned bytesNeeded = tilesNeeded * bytesPerTile;
-    unsigned bytesUsed = tileCount() * bytesPerTile;
-    unsigned maximumBytes = m_tileCache-&gt;tileCapacityForGrid(this);
-
-    int bytesToReclaim = int(bytesUsed) - (int(maximumBytes) - bytesNeeded);
-    if (bytesToReclaim &lt;= 0)
-        return true;
-
-    unsigned tilesToRemoveCount = bytesToReclaim / bytesPerTile;
-
-    IntRect visibleRect = this-&gt;visibleRect();
-    Vector&lt;std::pair&lt;double, TileIndex&gt;&gt; toRemove;
-    for (const auto&amp; tile : m_tiles) {
-        const TileIndex&amp; index = tile.key;
-        const IntRect&amp; tileRect = tile.value-&gt;rect();
-        double distance = tileDistance2(visibleRect, tileRect);
-        if (distance &lt;= shortestDistance)
-            continue;
-        toRemove.append(std::make_pair(distance, index));
-        std::push_heap(toRemove.begin(), toRemove.end(), std::ptr_fun(isFartherAway&lt;TileIndex&gt;));
-        if (toRemove.size() &gt; tilesToRemoveCount) {
-            std::pop_heap(toRemove.begin(), toRemove.end(), std::ptr_fun(isFartherAway&lt;TileIndex&gt;));
-            toRemove.removeLast();
-        }
-    }
-    size_t removeCount = toRemove.size();
-    for (size_t n = 0; n &lt; removeCount; ++n)
-        m_tiles.remove(toRemove[n].second);
-
-    if (!shortestDistance)
-        return true;
-
-    return tileCount() * bytesPerTile + bytesNeeded &lt;= maximumBytes;
-}
-
-void TileGrid::addTilesCoveringRect(const IntRect&amp; rectToCover)
-{
-    // We never draw anything outside of our bounds.
-    IntRect rect(rectToCover);
-    rect.intersect(bounds());
-    if (rect.isEmpty())
-        return;
-
-    TileIndex topLeftIndex = tileIndexForPoint(topLeft(rect));
-    TileIndex bottomRightIndex = tileIndexForPoint(bottomRight(rect));
-    for (int yIndex = topLeftIndex.y(); yIndex &lt;= bottomRightIndex.y(); ++yIndex) {
-        for (int xIndex = topLeftIndex.x(); xIndex &lt;= bottomRightIndex.x(); ++xIndex) {
-            TileIndex index(xIndex, yIndex);
-            if (!tileForIndex(index))
-                addTileForIndex(index);
-        }
-    }
-}
-
-void TileGrid::addTileForIndex(const TileIndex&amp; index)
-{
-    m_tiles.set(index, TileGridTile::create(this, tileRectForIndex(index)));
-}
-
-CALayer* TileGrid::tileHostLayer() const
-{
-    return m_tileHostLayer.get();
-}
-
-IntRect TileGrid::bounds() const
-{
-    return IntRect(IntPoint(), IntSize([tileHostLayer() size]));
-}
-
-PassRefPtr&lt;TileGridTile&gt; TileGrid::tileForIndex(const TileIndex&amp; index) const
-{
-    return m_tiles.get(index);
-}
-
-IntRect TileGrid::tileRectForIndex(const TileIndex&amp; index) const
-{
-    IntRect rect(index.x() * m_tileSize.width() - (m_origin.x() ? m_tileSize.width() - m_origin.x() : 0),
-                 index.y() * m_tileSize.height() - (m_origin.y() ? m_tileSize.height() - m_origin.y() : 0),
-                 m_tileSize.width(),
-                 m_tileSize.height());
-    rect.intersect(bounds());
-    return rect;
-}
-
-TileGrid::TileIndex TileGrid::tileIndexForPoint(const IntPoint&amp; point) const
-{
-    ASSERT(m_origin.x() &lt; m_tileSize.width());
-    ASSERT(m_origin.y() &lt; m_tileSize.height());
-    int x = (point.x() + (m_origin.x() ? m_tileSize.width() - m_origin.x() : 0)) / m_tileSize.width();
-    int y = (point.y() + (m_origin.y() ? m_tileSize.height() - m_origin.y() : 0)) / m_tileSize.height();
-    return TileIndex(std::max(x, 0), std::max(y, 0));
-}
-
-void TileGrid::centerTileGridOrigin(const IntRect&amp; visibleRect)
-{
-    if (visibleRect.isEmpty())
-        return;
-
-    unsigned minimumHorizontalTiles = 1 + (visibleRect.width() - 1) / m_tileSize.width();
-    unsigned minimumVerticalTiles = 1 + (visibleRect.height() - 1) / m_tileSize.height();
-    TileIndex currentTopLeftIndex = tileIndexForPoint(topLeft(visibleRect));
-    TileIndex currentBottomRightIndex = tileIndexForPoint(bottomRight(visibleRect));
-    unsigned currentHorizontalTiles = currentBottomRightIndex.x() - currentTopLeftIndex.x() + 1;
-    unsigned currentVerticalTiles = currentBottomRightIndex.y() - currentTopLeftIndex.y() + 1;
-
-    // If we have tiles already, only center if we would get benefits from both directions (as we need to throw out existing tiles).
-    if (tileCount() &amp;&amp; (currentHorizontalTiles == minimumHorizontalTiles || currentVerticalTiles == minimumVerticalTiles))
-        return;
-
-    IntPoint newOrigin(0, 0);
-    IntSize size = bounds().size();
-    if (size.width() &gt; m_tileSize.width()) {
-        newOrigin.setX((visibleRect.x() - (minimumHorizontalTiles * m_tileSize.width() - visibleRect.width()) / 2) % m_tileSize.width());
-        if (newOrigin.x() &lt; 0)
-            newOrigin.setX(0);
-    }
-    if (size.height() &gt; m_tileSize.height()) {
-        newOrigin.setY((visibleRect.y() - (minimumVerticalTiles * m_tileSize.height() - visibleRect.height()) / 2) % m_tileSize.height());
-        if (newOrigin.y() &lt; 0)
-            newOrigin.setY(0);
-    }
-
-    // Drop all existing tiles if the origin moved.
-    if (newOrigin == m_origin)
-        return;
-    m_tiles.clear();
-    m_origin = newOrigin;
-}
-
-PassRefPtr&lt;TileGridTile&gt; TileGrid::tileForPoint(const IntPoint&amp; point) const
-{
-    return tileForIndex(tileIndexForPoint(point));
-}
-
-bool TileGrid::tilesCover(const IntRect&amp; rect) const
-{
-    return tileForPoint(rect.location()) &amp;&amp; tileForPoint(IntPoint(rect.maxX() - 1, rect.y())) &amp;&amp;
-    tileForPoint(IntPoint(rect.x(), rect.maxY() - 1)) &amp;&amp; tileForPoint(IntPoint(rect.maxX() - 1, rect.maxY() - 1));
-}
-
-void TileGrid::updateTileOpacity()
-{
-    TileMap::iterator end = m_tiles.end();
-    for (TileMap::iterator it = m_tiles.begin(); it != end; ++it)
-        [it-&gt;value-&gt;tileLayer() setOpaque:m_tileCache-&gt;tilesOpaque()];
-}
-
-void TileGrid::updateTileBorderVisibility()
-{
-    TileMap::iterator end = m_tiles.end();
-    for (TileMap::iterator it = m_tiles.begin(); it != end; ++it)
-        it-&gt;value-&gt;showBorder(m_tileCache-&gt;tileBordersVisible());
-}
-
-unsigned TileGrid::tileCount() const
-{
-    return m_tiles.size();
-}
-
-bool TileGrid::checkDoSingleTileLayout()
-{
-    IntSize size = bounds().size();
-    if (size.width() &gt; m_tileSize.width() || size.height() &gt; m_tileSize.height())
-        return false;
-
-    if (m_origin != IntPoint(0, 0)) {
-        m_tiles.clear();
-        m_origin = IntPoint(0, 0);
-    }
-
-    dropInvalidTiles();
-
-    if (size.isEmpty()) {
-        ASSERT(!m_tiles.get(TileIndex(0, 0)));
-        return true;
-    }
-
-    TileIndex originIndex(0, 0);
-    if (!m_tiles.get(originIndex))
-        m_tiles.set(originIndex, TileGridTile::create(this, tileRectForIndex(originIndex)));
-
-    return true;
-}
-
-void TileGrid::updateHostLayerSize()
-{
-    CALayer* hostLayer = m_tileCache-&gt;hostLayer();
-    CGRect tileHostBounds = [hostLayer convertRect:[hostLayer bounds] toLayer:tileHostLayer()];
-    CGSize transformedSize;
-    transformedSize.width = CGRound(tileHostBounds.size.width);
-    transformedSize.height = CGRound(tileHostBounds.size.height);
-
-    CGRect bounds = [tileHostLayer() bounds];
-    if (CGSizeEqualToSize(bounds.size, transformedSize))
-        return;
-    bounds.size = transformedSize;
-    [tileHostLayer() setBounds:bounds];
-}
-
-void TileGrid::dropInvalidTiles()
-{
-    IntRect bounds = this-&gt;bounds();
-    IntRect dropBounds = intersection(m_validBounds, bounds);
-    Vector&lt;TileIndex&gt; toRemove;
-    for (const auto&amp; tile : m_tiles) {
-        const TileIndex&amp; index = tile.key;
-        const IntRect&amp; tileRect = tile.value-&gt;rect();
-        IntRect expectedTileRect = tileRectForIndex(index);
-        if (expectedTileRect != tileRect || !dropBounds.contains(tileRect))
-            toRemove.append(index);
-    }
-    unsigned removeCount = toRemove.size();
-    for (unsigned n = 0; n &lt; removeCount; ++n)
-        m_tiles.remove(toRemove[n]);
-
-    m_validBounds = bounds;
-}
-
-void TileGrid::invalidateTiles(const IntRect&amp; dirtyRect)
-{
-    if (!hasTiles())
-        return;
-
-    IntRect bounds = this-&gt;bounds();
-    if (intersection(bounds, m_validBounds) != m_validBounds) {
-        // The bounds have got smaller. Everything outside will also be considered invalid and will be dropped by dropInvalidTiles().
-        // Due to dirtyRect being limited to current bounds the tiles that are temporarily outside might miss invalidation 
-        // completely othwerwise.
-        m_validBounds = bounds;
-    }
-
-    Vector&lt;TileIndex&gt; invalidatedTiles;
-
-    if (dirtyRect.width() &gt; m_tileSize.width() * 4 || dirtyRect.height() &gt; m_tileSize.height() * 4) {
-        // For large invalidates, iterate over live tiles.
-        TileMap::iterator end = m_tiles.end();
-        for (TileMap::iterator it = m_tiles.begin(); it != end; ++it) {
-            TileGridTile* tile = it-&gt;value.get();
-            if (!tile-&gt;rect().intersects(dirtyRect))
-               continue;
-            tile-&gt;invalidateRect(dirtyRect);
-            invalidatedTiles.append(it-&gt;key);
-        }
-    } else {
-        TileIndex topLeftIndex = tileIndexForPoint(topLeft(dirtyRect));
-        TileIndex bottomRightIndex = tileIndexForPoint(bottomRight(dirtyRect));
-        for (int yIndex = topLeftIndex.y(); yIndex &lt;= bottomRightIndex.y(); ++yIndex) {
-            for (int xIndex = topLeftIndex.x(); xIndex &lt;= bottomRightIndex.x(); ++xIndex) {
-                TileIndex index(xIndex, yIndex);
-                RefPtr&lt;TileGridTile&gt; tile = tileForIndex(index);
-                if (!tile)
-                    continue;
-                if (!tile-&gt;rect().intersects(dirtyRect))
-                    continue;
-                tile-&gt;invalidateRect(dirtyRect);
-                invalidatedTiles.append(index);
-            }
-        }
-    }
-    if (invalidatedTiles.isEmpty())
-        return;
-    // When using minimal coverage, drop speculative tiles instead of updating them.
-    if (!shouldUseMinimalTileCoverage())
-        return;
-    if (m_tileCache-&gt;tilingMode() != TileCache::Minimal &amp;&amp; m_tileCache-&gt;tilingMode() != TileCache::Normal)
-        return;
-    IntRect visibleRect = this-&gt;visibleRect();
-    unsigned count = invalidatedTiles.size();
-    for (unsigned i = 0; i &lt; count; ++i) {
-        RefPtr&lt;TileGridTile&gt; tile = tileForIndex(invalidatedTiles[i]);
-        if (!tile-&gt;rect().intersects(visibleRect))
-            m_tiles.remove(invalidatedTiles[i]);
-    }
-}
-
-bool TileGrid::shouldUseMinimalTileCoverage() const
-{
-    return m_tileCache-&gt;tilingMode() == TileCache::Minimal
-        || !m_tileCache-&gt;isSpeculativeTileCreationEnabled()
-        || memoryPressureHandler().hasReceivedMemoryPressure();
-}
-
-IntRect TileGrid::adjustCoverRectForPageBounds(const IntRect&amp; rect) const
-{
-    // Adjust the rect so that it stays within the bounds and keeps the pixel size.
-    IntRect bounds = this-&gt;bounds();
-    IntRect adjustedRect = rect;
-    adjustedRect.move(rect.x() &lt; bounds.x() ? bounds.x() - rect.x() : 0,
-              rect.y() &lt; bounds.y() ? bounds.y() - rect.y() : 0);
-    adjustedRect.move(rect.maxX() &gt; bounds.maxX() ? bounds.maxX() - rect.maxX() : 0,
-              rect.maxY() &gt; bounds.maxY() ? bounds.maxY() - rect.maxY() : 0);
-    adjustedRect = intersection(bounds, adjustedRect);
-    if (adjustedRect == rect || adjustedRect.isEmpty() || shouldUseMinimalTileCoverage())
-        return adjustedRect;
-    int pixels = adjustedRect.width() * adjustedRect.height();
-    if (adjustedRect.width() != rect.width())
-        adjustedRect.inflateY((pixels / adjustedRect.width() - adjustedRect.height()) / 2);
-    else if (adjustedRect.height() != rect.height())
-        adjustedRect.inflateX((pixels / adjustedRect.height() - adjustedRect.width()) / 2);
-    return intersection(adjustedRect, bounds);
-}
-
-IntRect TileGrid::calculateCoverRect(const IntRect&amp; visibleRect, bool&amp; centerGrid)
-{
-    // Use minimum coverRect if we are under memory pressure.
-    if (shouldUseMinimalTileCoverage()) {
-        centerGrid = true;
-        return visibleRect;
-    }
-    IntRect coverRect = visibleRect;
-    centerGrid = false;
-    coverRect.inflateX(visibleRect.width() / 2);
-    coverRect.inflateY(visibleRect.height());
-    return adjustCoverRectForPageBounds(coverRect);
-}
-
-double TileGrid::tileDistance2(const IntRect&amp; visibleRect, const IntRect&amp; tileRect) const
-{
-    // The &quot;distance&quot; calculated here is used to pick which tile to cache next. The idea is to create those
-    // closest to the current viewport first so the user is more likely to see already rendered content we she
-    // scrolls. The calculation is weighted to prefer vertical and downward direction.
-    if (visibleRect.intersects(tileRect))
-        return 0;
-    IntPoint visibleCenter = visibleRect.location() + IntSize(visibleRect.width() / 2, visibleRect.height() / 2);
-    IntPoint tileCenter = tileRect.location() + IntSize(tileRect.width() / 2, tileRect.height() / 2);
-    
-    double horizontalBias = 1.0;
-    double leftwardBias = 1.0;
-    double rightwardBias = 1.0;
-
-    double verticalBias = 1.0;
-    double upwardBias = 1.0;
-    double downwardBias = 1.0;
-
-    const double tilingBiasVeryLikely = 0.8;
-    const double tilingBiasLikely = 0.9;
-
-    switch (m_tileCache-&gt;tilingDirection()) {
-    case TileCache::TilingDirectionUp:
-        verticalBias = tilingBiasVeryLikely;
-        upwardBias = tilingBiasLikely;
-        break;
-    case TileCache::TilingDirectionDown:
-        verticalBias = tilingBiasVeryLikely;
-        downwardBias = tilingBiasLikely;
-        break;
-    case TileCache::TilingDirectionLeft:
-        horizontalBias = tilingBiasVeryLikely;
-        leftwardBias = tilingBiasLikely;
-        break;
-    case TileCache::TilingDirectionRight:
-        horizontalBias = tilingBiasVeryLikely;
-        rightwardBias = tilingBiasLikely;
-        break;
-    }
-
-    double xScale = horizontalBias * visibleRect.height() / visibleRect.width() * (tileCenter.x() &gt;= visibleCenter.x() ? rightwardBias : leftwardBias);
-    double yScale = verticalBias * visibleRect.width() / visibleRect.height() * (tileCenter.y() &gt;= visibleCenter.y() ? downwardBias : upwardBias);
-
-    double xDistance = xScale * (tileCenter.x() - visibleCenter.x());
-    double yDistance = yScale * (tileCenter.y() - visibleCenter.y());
-
-    double distance2 = xDistance * xDistance + yDistance * yDistance;
-    return distance2;
-}
-
-void TileGrid::createTiles(TileCache::SynchronousTileCreationMode creationMode)
-{
-    IntRect visibleRect = this-&gt;visibleRect();
-    if (visibleRect.isEmpty())
-        return;
-
-    // Drop tiles that are wrong size or outside the frame (because the frame has been resized).
-    dropInvalidTiles();
-
-    bool centerGrid;
-    IntRect coverRect = calculateCoverRect(visibleRect, centerGrid);
-
-    // If tile size is bigger than the view, centering minimizes the painting needed to cover the screen.
-    // This is especially useful after zooming 
-    centerGrid = centerGrid || !tileCount();
-    if (centerGrid)
-        centerTileGridOrigin(visibleRect);
-
-    double shortestDistance = std::numeric_limits&lt;double&gt;::infinity();
-    double coveredDistance = 0;
-    Vector&lt;TileGrid::TileIndex&gt; tilesToCreate;
-    unsigned pendingTileCount = 0;
-
-    TileGrid::TileIndex topLeftIndex = tileIndexForPoint(topLeft(coverRect));
-    TileGrid::TileIndex bottomRightIndex = tileIndexForPoint(bottomRight(coverRect));
-    for (int yIndex = topLeftIndex.y(); yIndex &lt;= bottomRightIndex.y(); ++yIndex) {
-        for (int xIndex = topLeftIndex.x(); xIndex &lt;= bottomRightIndex.x(); ++xIndex) {
-            TileGrid::TileIndex index(xIndex, yIndex);
-            // Currently visible tiles have distance of 0 and get all created in the same transaction.
-            double distance = tileDistance2(visibleRect, tileRectForIndex(index));
-            if (distance &gt; coveredDistance)
-                coveredDistance = distance;
-            if (tileForIndex(index))
-                continue;
-            ++pendingTileCount;
-            if (distance &gt; shortestDistance)
-                continue;
-            if (distance &lt; shortestDistance) {
-                tilesToCreate.clear();
-                shortestDistance = distance;
-            }
-            tilesToCreate.append(index);
-        }
-    }
-
-    size_t tilesToCreateCount = tilesToCreate.size();
-
-    // Tile creation timer will invoke this function again in CoverSpeculative mode.
-    bool candidateTilesAreSpeculative = shortestDistance &gt; 0;
-    if (creationMode == TileCache::CoverVisibleOnly &amp;&amp; candidateTilesAreSpeculative)
-        tilesToCreateCount = 0;
-
-    // Even if we don't create any tiles, we should still drop distant tiles
-    // in case coverRect got smaller.
-    double keepDistance = std::min(shortestDistance, coveredDistance);
-    if (!dropDistantTiles(tilesToCreateCount, keepDistance))
-        return;
-
-    ASSERT(pendingTileCount &gt;= tilesToCreateCount);
-    if (!pendingTileCount)
-        return;
-
-    for (size_t n = 0; n &lt; tilesToCreateCount; ++n)
-        addTileForIndex(tilesToCreate[n]);
-
-    bool didCreateTiles = !!tilesToCreateCount;
-    bool createMoreTiles = pendingTileCount &gt; tilesToCreateCount;
-    m_tileCache-&gt;finishedCreatingTiles(didCreateTiles, createMoreTiles);
-}
-
-void TileGrid::dumpTiles()
-{
-    IntRect visibleRect = this-&gt;visibleRect();
-    NSLog(@&quot;transformed visibleRect = [%6d %6d %6d %6d]&quot;, visibleRect.x(), visibleRect.y(), visibleRect.width(), visibleRect.height());
-    unsigned i = 0;
-    TileMap::iterator end = m_tiles.end();
-    for (TileMap::iterator it = m_tiles.begin(); it != end; ++it) {
-        TileIndex&amp; index = it-&gt;key;
-        IntRect tileRect = it-&gt;value-&gt;rect();
-        NSLog(@&quot;#%-3d (%3d %3d) - [%6d %6d %6d %6d]%@&quot;, ++i, index.x(), index.y(), tileRect.x(), tileRect.y(), tileRect.width(), tileRect.height(), tileRect.intersects(visibleRect) ? @&quot; *&quot; : @&quot;&quot;);
-        NSLog(@&quot;     %@&quot;, [it-&gt;value-&gt;tileLayer() contents]);
-    }
-}
-
-} // namespace WebCore
-
-#endif // PLATFORM(IOS)
</del></span></pre></div>
<a id="trunkSourceWebCoreplatformiosTileGridTileh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/platform/ios/TileGridTile.h (166528 => 166529)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/TileGridTile.h        2014-03-31 21:10:44 UTC (rev 166528)
+++ trunk/Source/WebCore/platform/ios/TileGridTile.h        2014-03-31 21:18:23 UTC (rev 166529)
</span><span class="lines">@@ -1,65 +0,0 @@
</span><del>-/*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef TileGridTile_h
-#define TileGridTile_h
-
-#if PLATFORM(IOS)
-
-#include &quot;IntRect.h&quot;
-#include &lt;wtf/RefCounted.h&gt;
-#include &lt;wtf/RefPtr.h&gt;
-#include &lt;wtf/RetainPtr.h&gt;
-
-@class TileLayer;
-
-namespace WebCore {
-
-class TileGrid;
-
-// Refcount the tiles so they work nicely in vector and we know when to remove the tile layer from the parent.
-class TileGridTile : public RefCounted&lt;TileGridTile&gt; {
-public:
-    static PassRefPtr&lt;TileGridTile&gt; create(TileGrid* grid, const IntRect&amp; rect) { return adoptRef&lt;TileGridTile&gt;(new TileGridTile(grid, rect)); }
-    ~TileGridTile();
-
-    TileLayer* tileLayer() const { return m_tileLayer.get(); }
-    void invalidateRect(const IntRect&amp; rectInSurface);
-    IntRect rect() const { return m_rect; }
-    void setRect(const IntRect&amp; tileRect);
-    void showBorder(bool);
-
-private:
-    TileGridTile(TileGrid*, const IntRect&amp;);
-
-    TileGrid* m_tileGrid;
-    RetainPtr&lt;TileLayer&gt; m_tileLayer;
-    IntRect m_rect;
-};
-
-} // namespace WebCore
-
-#endif // PLATFORM(IOS)
-#endif // TileGridTile_h
</del></span></pre></div>
<a id="trunkSourceWebCoreplatformiosTileGridTilemm"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/platform/ios/TileGridTile.mm (166528 => 166529)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/TileGridTile.mm        2014-03-31 21:10:44 UTC (rev 166528)
+++ trunk/Source/WebCore/platform/ios/TileGridTile.mm        2014-03-31 21:18:23 UTC (rev 166529)
</span><span class="lines">@@ -1,131 +0,0 @@
</span><del>-/*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include &quot;config.h&quot;
-#include &quot;TileGrid.h&quot;
-
-#if PLATFORM(IOS)
-
-#include &quot;Color.h&quot;
-#include &quot;TileCache.h&quot;
-#include &quot;TileGridTile.h&quot;
-#include &quot;TileLayer.h&quot;
-#include &quot;TileLayerPool.h&quot;
-#include &quot;WAKWindow.h&quot;
-#include &lt;QuartzCore/QuartzCore.h&gt;
-#include &lt;QuartzCore/QuartzCorePrivate.h&gt;
-#include &lt;algorithm&gt;
-#include &lt;functional&gt;
-
-namespace WebCore {
-
-#if LOG_TILING
-static int totalTileCount;
-#endif
-
-TileGridTile::TileGridTile(TileGrid* tileGrid, const IntRect&amp; tileRect)
-    : m_tileGrid(tileGrid)
-    , m_rect(tileRect)
-{
-    ASSERT(!tileRect.isEmpty());
-    IntSize pixelSize(m_rect.size());
-    const CGFloat screenScale = m_tileGrid-&gt;tileCache()-&gt;screenScale();
-    pixelSize.scale(screenScale);
-    m_tileLayer = TileLayerPool::sharedPool()-&gt;takeLayerWithSize(pixelSize);
-    if (!m_tileLayer) {
-#if LOG_TILING
-        NSLog(@&quot;unable to reuse layer with size %d x %d, creating one&quot;, pixelSize.width(), pixelSize.height());
-#endif
-        m_tileLayer = adoptNS([[TileLayer alloc] init]);
-    }
-    TileLayer* layer = m_tileLayer.get();
-    [layer setTileGrid:tileGrid];
-    [layer setOpaque:m_tileGrid-&gt;tileCache()-&gt;tilesOpaque()];
-    [layer setEdgeAntialiasingMask:0];
-    [layer setNeedsLayoutOnGeometryChange:NO];
-    [layer setContentsScale:screenScale];
-    [layer setAcceleratesDrawing:m_tileGrid-&gt;tileCache()-&gt;acceleratedDrawingEnabled()];
-
-    // Host layer may have other sublayers. Keep the tile layers at the beginning of the array
-    // so they are painted behind everything else.
-    [tileGrid-&gt;tileHostLayer() insertSublayer:layer atIndex:tileGrid-&gt;tileCount()];
-    [layer setFrame:m_rect];
-    invalidateRect(m_rect);
-    showBorder(m_tileGrid-&gt;tileCache()-&gt;tileBordersVisible());
-
-#if LOG_TILING
-    ++totalTileCount;
-    NSLog(@&quot;new Tile (%d,%d) %d %d, count %d&quot;, tileRect.x(), tileRect.y(), tileRect.width(), tileRect.height(), totalTileCount);
-#endif
-}
-
-TileGridTile::~TileGridTile() 
-{
-    [tileLayer() setTileGrid:0];
-    [tileLayer() removeFromSuperlayer];
-    TileLayerPool::sharedPool()-&gt;addLayer(tileLayer());
-#if LOG_TILING
-    --totalTileCount;
-    NSLog(@&quot;delete Tile (%d,%d) %d %d, count %d&quot;, m_rect.x(), m_rect.y(), m_rect.width(), m_rect.height(), totalTileCount);
-#endif
-}
-
-void TileGridTile::invalidateRect(const IntRect&amp; windowDirtyRect)
-{
-    IntRect dirtyRect = intersection(windowDirtyRect, m_rect);
-    if (dirtyRect.isEmpty())
-        return;
-    dirtyRect.move(IntPoint() - m_rect.location());
-    [tileLayer() setNeedsDisplayInRect:dirtyRect];
-
-    if (m_tileGrid-&gt;tileCache()-&gt;tilePaintCountersVisible())
-        [tileLayer() setNeedsDisplayInRect:CGRectMake(0, 0, 46, 25)];
-}
-
-void TileGridTile::setRect(const IntRect&amp; tileRect)
-{
-    if (m_rect == tileRect)
-        return;
-    m_rect = tileRect;
-    TileLayer* layer = m_tileLayer.get();
-    [layer setFrame:m_rect];
-    [layer setNeedsDisplay];
-}
-
-void TileGridTile::showBorder(bool flag)
-{
-    TileLayer* layer = m_tileLayer.get();
-    if (flag) {
-        [layer setBorderColor:cachedCGColor(m_tileGrid-&gt;tileCache()-&gt;colorForGridTileBorder(m_tileGrid), ColorSpaceDeviceRGB)];
-        [layer setBorderWidth:0.5f];
-    } else {
-        [layer setBorderColor:nil];
-        [layer setBorderWidth:0];
-    }
-}
-
-} // namespace WebCore
-
-#endif // PLATFORM(IOS)
</del></span></pre></div>
<a id="trunkSourceWebCoreplatformiosTileLayerh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/platform/ios/TileLayer.h (166528 => 166529)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/TileLayer.h        2014-03-31 21:10:44 UTC (rev 166528)
+++ trunk/Source/WebCore/platform/ios/TileLayer.h        2014-03-31 21:18:23 UTC (rev 166529)
</span><span class="lines">@@ -1,53 +0,0 @@
</span><del>-/*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef TileLayer_h
-#define TileLayer_h
-
-#if PLATFORM(IOS)
-
-#include &lt;QuartzCore/CALayer.h&gt;
-
-namespace WebCore {
-class TileGrid;
-};
-
-@interface TileLayer : CALayer {
-    WebCore::TileGrid* _tileGrid;
-    unsigned _paintCount;
-}
-@property (nonatomic) unsigned paintCount;
-@property (nonatomic) WebCore::TileGrid* tileGrid;
-+ (TileLayer *)layerBeingPainted;
-@end
-
-@interface TileHostLayer : CALayer {
-    WebCore::TileGrid* _tileGrid;
-}
-- (id)initWithTileGrid:(WebCore::TileGrid*)tileGrid;
-@end
-
-#endif // PLATFORM(IOS)
-#endif // TileLayer_h
</del></span></pre></div>
<a id="trunkSourceWebCoreplatformiosTileLayermm"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/platform/ios/TileLayer.mm (166528 => 166529)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/TileLayer.mm        2014-03-31 21:10:44 UTC (rev 166528)
+++ trunk/Source/WebCore/platform/ios/TileLayer.mm        2014-03-31 21:18:23 UTC (rev 166529)
</span><span class="lines">@@ -1,103 +0,0 @@
</span><del>-/*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include &quot;config.h&quot;
-#include &quot;TileLayer.h&quot;
-
-#if PLATFORM(IOS)
-
-#include &quot;TileCache.h&quot;
-#include &quot;TileGrid.h&quot;
-#include &quot;WebCoreThread.h&quot;
-
-@implementation TileHostLayer
-- (id)initWithTileGrid:(WebCore::TileGrid*)tileGrid
-{
-    self = [super init];
-    if (!self)
-        return nil;
-    _tileGrid = tileGrid;
-    [self setAnchorPoint:CGPointZero];
-    return self;
-}
-
-- (id&lt;CAAction&gt;)actionForKey:(NSString *)key
-{
-    UNUSED_PARAM(key);
-    // Disable all default actions
-    return nil;
-}
-
-- (void)renderInContext:(CGContextRef)context
-{
-    if (pthread_main_np())
-        WebThreadLock();
-    _tileGrid-&gt;tileCache()-&gt;doLayoutTiles();
-    [super renderInContext:context];
-}
-@end
-
-@implementation TileLayer
-@synthesize paintCount = _paintCount;
-@synthesize tileGrid = _tileGrid;
-
-static TileLayer *layerBeingPainted;
-
-- (void)setNeedsDisplayInRect:(CGRect)rect
-{
-    [self setNeedsLayout];
-    [super setNeedsDisplayInRect:rect];
-}
-
-- (void)layoutSublayers
-{
-    if (pthread_main_np())
-        WebThreadLock();
-    // This may trigger WebKit layout and generate more repaint rects.
-    if (_tileGrid)
-        _tileGrid-&gt;tileCache()-&gt;prepareToDraw();
-}
-
-- (void)drawInContext:(CGContextRef)context
-{
-    if (_tileGrid)
-        _tileGrid-&gt;tileCache()-&gt;drawLayer(self, context);
-}
-
-- (id&lt;CAAction&gt;)actionForKey:(NSString *)key
-{
-    UNUSED_PARAM(key);
-    // Disable all default actions
-    return nil;
-}
-
-+ (TileLayer *)layerBeingPainted
-{
-    return layerBeingPainted;
-}
-
-@end
-
-#endif // PLATFORM(IOS)
</del></span></pre></div>
<a id="trunkSourceWebCoreplatformiosTileLayerPoolh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/platform/ios/TileLayerPool.h (166528 => 166529)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/TileLayerPool.h        2014-03-31 21:10:44 UTC (rev 166528)
+++ trunk/Source/WebCore/platform/ios/TileLayerPool.h        2014-03-31 21:18:23 UTC (rev 166529)
</span><span class="lines">@@ -1,90 +0,0 @@
</span><del>-/*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef TileLayerPool_h
-#define TileLayerPool_h
-
-#if PLATFORM(IOS)
-
-#include &quot;IntSize.h&quot;
-#include &quot;IntSizeHash.h&quot;
-#include &quot;Timer.h&quot;
-#include &lt;wtf/Deque.h&gt;
-#include &lt;wtf/HashMap.h&gt;
-#include &lt;wtf/NeverDestroyed.h&gt;
-#include &lt;wtf/OwnPtr.h&gt;
-#include &lt;wtf/RetainPtr.h&gt;
-#include &lt;wtf/Threading.h&gt;
-#include &lt;wtf/Vector.h&gt;
-
-@class TileLayer;
-
-namespace WebCore {
-
-class TileLayerPool {
-    WTF_MAKE_NONCOPYABLE(TileLayerPool);
-public:
-    static TileLayerPool* sharedPool();
-
-    void addLayer(const RetainPtr&lt;TileLayer&gt;&amp;);
-    RetainPtr&lt;TileLayer&gt; takeLayerWithSize(const IntSize&amp;);
-
-    // The maximum size of all queued layers in bytes.
-    unsigned capacity() const { return m_capacity; }
-    void setCapacity(unsigned);
-    void drain();
-
-    unsigned decayedCapacity() const;
-
-    static unsigned bytesBackingLayerWithPixelSize(const IntSize&amp;);
-
-private:
-    TileLayerPool();
-
-    typedef Deque&lt;RetainPtr&lt;TileLayer&gt; &gt; LayerList;
-
-    bool canReuseLayerWithSize(const IntSize&amp; size) const { return m_capacity &amp;&amp; !size.isEmpty(); }
-    void schedulePrune();
-    void prune();
-    typedef enum { LeaveUnchanged, MarkAsUsed } AccessType;
-    LayerList&amp; listOfLayersWithSize(const IntSize&amp;, AccessType = LeaveUnchanged);
-
-    HashMap&lt;IntSize, LayerList&gt; m_reuseLists;
-    // Ordered by recent use. The last size is the most recently used.
-    Vector&lt;IntSize&gt; m_sizesInPruneOrder;
-    unsigned m_totalBytes;
-    unsigned m_capacity;
-    Mutex m_layerPoolMutex;
-
-    double m_lastAddTime;
-    bool m_needsPrune;
-
-    friend NeverDestroyed&lt;TileLayerPool&gt;;
-};
-
-} // namespace WebCore
-
-#endif // PLATFORM(IOS)
-#endif // TileLayerPool_h
</del></span></pre></div>
<a id="trunkSourceWebCoreplatformiosTileLayerPoolmm"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/platform/ios/TileLayerPool.mm (166528 => 166529)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/TileLayerPool.mm        2014-03-31 21:10:44 UTC (rev 166528)
+++ trunk/Source/WebCore/platform/ios/TileLayerPool.mm        2014-03-31 21:18:23 UTC (rev 166529)
</span><span class="lines">@@ -1,174 +0,0 @@
</span><del>-/*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include &quot;config.h&quot;
-#include &quot;TileLayerPool.h&quot;
-
-#if PLATFORM(IOS)
-
-#include &quot;Logging.h&quot;
-#include &quot;MemoryPressureHandler.h&quot;
-#include &quot;TileLayer.h&quot;
-#include &quot;TileGrid.h&quot;
-#include &lt;wtf/CurrentTime.h&gt;
-#include &lt;wtf/NeverDestroyed.h&gt;
-
-namespace WebCore {
-
-static const double capacityDecayTime = 5;
-
-TileLayerPool::TileLayerPool()
-    : m_totalBytes(0)
-    , m_capacity(0)
-    , m_lastAddTime(0)
-    , m_needsPrune(false)
-{
-}
-
-TileLayerPool* TileLayerPool::sharedPool()
-{
-    static NeverDestroyed&lt;TileLayerPool&gt; sharedPool;
-    return &amp;sharedPool.get();
-}
-
-unsigned TileLayerPool::bytesBackingLayerWithPixelSize(const IntSize&amp; size)
-{
-    return size.width() * size.height() * 4;
-}
-
-TileLayerPool::LayerList&amp; TileLayerPool::listOfLayersWithSize(const IntSize&amp; size, AccessType accessType)
-{
-    ASSERT(!m_layerPoolMutex.tryLock());
-    HashMap&lt;IntSize, LayerList&gt;::iterator it = m_reuseLists.find(size);
-    if (it == m_reuseLists.end()) {
-        it = m_reuseLists.add(size, LayerList()).iterator;
-        m_sizesInPruneOrder.append(size);
-    } else if (accessType == MarkAsUsed) {
-        m_sizesInPruneOrder.remove(m_sizesInPruneOrder.reverseFind(size));
-        m_sizesInPruneOrder.append(size);
-    }
-    return it-&gt;value;
-}
-
-void TileLayerPool::addLayer(const RetainPtr&lt;TileLayer&gt;&amp; layer)
-{
-    IntSize layerSize([layer.get() frame].size);
-    layerSize.scale([layer.get() contentsScale]);
-    if (!canReuseLayerWithSize(layerSize))
-        return;
-
-    if (memoryPressureHandler().hasReceivedMemoryPressure()) {
-        LOG(MemoryPressure, &quot;Under memory pressure: %s, totalBytes: %d&quot;, __PRETTY_FUNCTION__, m_totalBytes);
-        return;
-    }
-
-    MutexLocker locker(m_layerPoolMutex);
-    listOfLayersWithSize(layerSize).prepend(layer);
-    m_totalBytes += bytesBackingLayerWithPixelSize(layerSize);
-
-    m_lastAddTime = currentTime();
-    schedulePrune();
-}
-
-RetainPtr&lt;TileLayer&gt; TileLayerPool::takeLayerWithSize(const IntSize&amp; size)
-{
-    if (!canReuseLayerWithSize(size))
-        return nil;
-    MutexLocker locker(m_layerPoolMutex);
-    LayerList&amp; reuseList = listOfLayersWithSize(size, MarkAsUsed);
-    if (reuseList.isEmpty())
-        return nil;
-    m_totalBytes -= bytesBackingLayerWithPixelSize(size);
-    return reuseList.takeFirst();
-}
-
-void TileLayerPool::setCapacity(unsigned capacity)
-{
-    MutexLocker reuseLocker(m_layerPoolMutex);
-    if (capacity &lt; m_capacity)
-        schedulePrune();
-    m_capacity = capacity;
-}
-    
-unsigned TileLayerPool::decayedCapacity() const
-{
-    // Decay to one quarter over capacityDecayTime
-    double timeSinceLastAdd = currentTime() - m_lastAddTime;
-    if (timeSinceLastAdd &gt; capacityDecayTime)
-        return m_capacity / 4;
-    float decayProgess = float(timeSinceLastAdd / capacityDecayTime);
-    return m_capacity / 4 + m_capacity * 3 / 4 * (1.f - decayProgess);
-}
-
-void TileLayerPool::schedulePrune()
-{
-    ASSERT(!m_layerPoolMutex.tryLock());
-    if (m_needsPrune)
-        return;
-    m_needsPrune = true;
-    dispatch_time_t nextPruneTime = dispatch_time(DISPATCH_TIME_NOW, 1 * NSEC_PER_SEC);
-    dispatch_after(nextPruneTime, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-        prune();
-    });
-}
-
-void TileLayerPool::prune()
-{
-    MutexLocker locker(m_layerPoolMutex);
-    ASSERT(m_needsPrune);
-    m_needsPrune = false;
-    unsigned shrinkTo = decayedCapacity();
-    while (m_totalBytes &gt; shrinkTo) {
-        ASSERT(!m_sizesInPruneOrder.isEmpty());
-        IntSize sizeToDrop = m_sizesInPruneOrder.first();
-        LayerList&amp; oldestReuseList = m_reuseLists.find(sizeToDrop)-&gt;value;
-        if (oldestReuseList.isEmpty()) {
-            m_reuseLists.remove(sizeToDrop);
-            m_sizesInPruneOrder.remove(0);
-            continue;
-        }
-#if LOG_TILING
-        NSLog(@&quot;dropping layer of size %d x %d&quot;, sizeToDrop.width(), sizeToDrop.height());
-#endif
-        m_totalBytes -= bytesBackingLayerWithPixelSize(sizeToDrop);
-        // The last element in the list is the oldest, hence most likely not to
-        // still have a backing store.
-        oldestReuseList.removeLast();
-    }
-    if (currentTime() - m_lastAddTime &lt;= capacityDecayTime)
-        schedulePrune();
-}
-
-void TileLayerPool::drain()
-{
-    MutexLocker reuseLocker(m_layerPoolMutex);
-    m_reuseLists.clear();
-    m_sizesInPruneOrder.clear();
-    m_totalBytes = 0;
-}
-
-} // namespace WebCore
-
-#endif // PLATFORM(IOS)
</del></span></pre></div>
<a id="trunkSourceWebCoreplatformioswakWAKWindowh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ios/wak/WAKWindow.h (166528 => 166529)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/wak/WAKWindow.h        2014-03-31 21:10:44 UTC (rev 166528)
+++ trunk/Source/WebCore/platform/ios/wak/WAKWindow.h        2014-03-31 21:18:23 UTC (rev 166529)
</span><span class="lines">@@ -40,11 +40,11 @@
</span><span class="cx"> 
</span><span class="cx"> #ifdef __cplusplus
</span><span class="cx"> namespace WebCore {
</span><del>-    class TileCache;
</del><ins>+    class LegacyTileCache;
</ins><span class="cx"> }
</span><del>-typedef WebCore::TileCache TileCache;
</del><ins>+typedef WebCore::LegacyTileCache LegacyTileCache;
</ins><span class="cx"> #else
</span><del>-typedef struct TileCache TileCache;
</del><ins>+typedef struct LegacyTileCache LegacyTileCache;
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> typedef enum {
</span><span class="lines">@@ -69,7 +69,7 @@
</span><span class="cx"> @interface WAKWindow : WAKResponder
</span><span class="cx"> {
</span><span class="cx">     CALayer* _hostLayer;
</span><del>-    TileCache* _tileCache;
</del><ins>+    LegacyTileCache* _tileCache;
</ins><span class="cx">     CGRect _frozenVisibleRect;
</span><span class="cx">     CALayer *_rootLayer;
</span><span class="cx"> 
</span><span class="lines">@@ -160,7 +160,7 @@
</span><span class="cx"> - (float)currentTileScale;
</span><span class="cx"> - (void)setKeepsZoomedOutTiles:(BOOL)keepsZoomedOutTiles;
</span><span class="cx"> - (BOOL)keepsZoomedOutTiles;
</span><del>-- (TileCache *)tileCache;
</del><ins>+- (LegacyTileCache *)tileCache;
</ins><span class="cx"> 
</span><span class="cx"> - (void)dumpTiles;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformioswakWAKWindowmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ios/wak/WAKWindow.mm (166528 => 166529)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/wak/WAKWindow.mm        2014-03-31 21:10:44 UTC (rev 166528)
+++ trunk/Source/WebCore/platform/ios/wak/WAKWindow.mm        2014-03-31 21:18:23 UTC (rev 166529)
</span><span class="lines">@@ -28,7 +28,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx"> 
</span><del>-#import &quot;TileCache.h&quot;
</del><ins>+#import &quot;LegacyTileCache.h&quot;
</ins><span class="cx"> #import &quot;WAKViewPrivate.h&quot;
</span><span class="cx"> #import &quot;WebCoreSystemInterface.h&quot;
</span><span class="cx"> #import &quot;WebCoreThreadRun.h&quot;
</span><span class="lines">@@ -73,7 +73,7 @@
</span><span class="cx">     _frame = [_hostLayer frame];
</span><span class="cx">     _screenScale = wkGetScreenScaleFactor();
</span><span class="cx">     
</span><del>-    _tileCache = new TileCache(self);
</del><ins>+    _tileCache = new LegacyTileCache(self);
</ins><span class="cx"> 
</span><span class="cx">     _frozenVisibleRect = CGRectNull;
</span><span class="cx"> 
</span><span class="lines">@@ -484,7 +484,7 @@
</span><span class="cx"> {
</span><span class="cx">     if (!_tileCache)
</span><span class="cx">         return;
</span><del>-    _tileCache-&gt;setTilingMode((TileCache::TilingMode)mode);
</del><ins>+    _tileCache-&gt;setTilingMode((LegacyTileCache::TilingMode)mode);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (WAKWindowTilingMode)tilingMode
</span><span class="lines">@@ -498,7 +498,7 @@
</span><span class="cx"> {
</span><span class="cx">     if (!_tileCache)
</span><span class="cx">         return;
</span><del>-    _tileCache-&gt;setTilingDirection((TileCache::TilingDirection)tilingDirection);
</del><ins>+    _tileCache-&gt;setTilingDirection((LegacyTileCache::TilingDirection)tilingDirection);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (WAKTilingDirection)tilingDirection
</span><span class="lines">@@ -550,7 +550,7 @@
</span><span class="cx">     return _tileCache-&gt;keepsZoomedOutTiles();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (TileCache*)tileCache
</del><ins>+- (LegacyTileCache*)tileCache
</ins><span class="cx"> {
</span><span class="cx">     return _tileCache;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayerCompositorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (166528 => 166529)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp        2014-03-31 21:10:44 UTC (rev 166528)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp        2014-03-31 21:18:23 UTC (rev 166529)
</span><span class="lines">@@ -66,10 +66,10 @@
</span><span class="cx"> #include &lt;wtf/text/StringBuilder.h&gt;
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span><ins>+#include &quot;LegacyTileCache.h&quot;
</ins><span class="cx"> #include &quot;MainFrame.h&quot;
</span><span class="cx"> #include &quot;Region.h&quot;
</span><span class="cx"> #include &quot;RenderScrollbar.h&quot;
</span><del>-#include &quot;TileCache.h&quot;
</del><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
</span><span class="lines">@@ -2681,16 +2681,16 @@
</span><span class="cx"> float RenderLayerCompositor::contentsScaleMultiplierForNewTiles(const GraphicsLayer*) const
</span><span class="cx"> {
</span><span class="cx"> #if PLATFORM(IOS)
</span><del>-    TileCache* tileCache = nullptr;
</del><ins>+    LegacyTileCache* tileCache = nullptr;
</ins><span class="cx">     if (Page* page = this-&gt;page()) {
</span><span class="cx">         if (FrameView* frameView = page-&gt;mainFrame().view())
</span><del>-            tileCache = frameView-&gt;tileCache();
</del><ins>+            tileCache = frameView-&gt;legacyTileCache();
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (!tileCache)
</span><span class="cx">         return 1;
</span><span class="cx"> 
</span><del>-    return tileCache-&gt;tilingMode() == TileCache::Zooming ? 0.125 : 1;
</del><ins>+    return tileCache-&gt;tilingMode() == LegacyTileCache::Zooming ? 0.125 : 1;
</ins><span class="cx"> #else
</span><span class="cx">     return 1;
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/ChangeLog (166528 => 166529)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/ChangeLog        2014-03-31 21:10:44 UTC (rev 166528)
+++ trunk/Source/WebKit/mac/ChangeLog        2014-03-31 21:18:23 UTC (rev 166529)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2014-03-31  Antti Koivisto  &lt;antti@apple.com&gt;
+
+        Rename TileCache to LegacyTileCache
+        https://bugs.webkit.org/show_bug.cgi?id=130986
+
+        Reviewed by Simon Fraser.
+
+        * WebView/WebView.mm:
+        (+[WebView drainLayerPool]):
+        (+[WebView _setTileCacheLayerPoolCapacity:]):
+
</ins><span class="cx"> 2014-03-28  Darin Adler  &lt;darin@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Fix recently-introduced off-by-one error in centerTruncateToBuffer
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (166528 => 166529)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebView.mm        2014-03-31 21:10:44 UTC (rev 166528)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm        2014-03-31 21:18:23 UTC (rev 166529)
</span><span class="lines">@@ -232,12 +232,12 @@
</span><span class="cx"> #import &lt;WebCore/FontCache.h&gt;
</span><span class="cx"> #import &lt;WebCore/GraphicsLayer.h&gt;
</span><span class="cx"> #import &lt;WebCore/IconController.h&gt;
</span><ins>+#import &lt;WebCore/LegacyTileCache.h&gt;
</ins><span class="cx"> #import &lt;WebCore/NetworkStateNotifier.h&gt;
</span><span class="cx"> #import &lt;WebCore/RuntimeApplicationChecksIOS.h&gt;
</span><span class="cx"> #import &lt;WebCore/SQLiteDatabaseTracker.h&gt;
</span><span class="cx"> #import &lt;WebCore/SmartReplace.h&gt;
</span><span class="cx"> #import &lt;WebCore/TextRun.h&gt;
</span><del>-#import &lt;WebCore/TileCache.h&gt;
</del><span class="cx"> #import &lt;WebCore/TileControllerMemoryHandlerIOS.h&gt;
</span><span class="cx"> #import &lt;WebCore/WAKWindow.h&gt;
</span><span class="cx"> #import &lt;WebCore/WebCoreThread.h&gt;
</span><span class="lines">@@ -1330,7 +1330,7 @@
</span><span class="cx"> {
</span><span class="cx">     ASSERT(WebThreadIsCurrent());
</span><span class="cx">     WebKit::MemoryMeasure measurer(&quot;Memory warning: Draining layer pool.&quot;);
</span><del>-    WebCore::TileCache::drainLayerPool();
</del><ins>+    WebCore::LegacyTileCache::drainLayerPool();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> + (void)discardAllCompiledCode
</span><span class="lines">@@ -4549,7 +4549,7 @@
</span><span class="cx"> 
</span><span class="cx"> + (void)_setTileCacheLayerPoolCapacity:(unsigned)capacity
</span><span class="cx"> {
</span><del>-    TileCache::setLayerPoolCapacity(capacity);
</del><ins>+    LegacyTileCache::setLayerPoolCapacity(capacity);
</ins><span class="cx"> }
</span><span class="cx"> #endif // PLATFORM(IOS)
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>