<!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>[172811] 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/172811">172811</a></dd>
<dt>Author</dt> <dd>psolanki@apple.com</dd>
<dt>Date</dt> <dd>2014-08-20 14:07:36 -0700 (Wed, 20 Aug 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Move DiskCacheMonitor to WebCore so that WebKit1 clients can use it as well
https://bugs.webkit.org/show_bug.cgi?id=135896

Reviewed by Andreas Kling.

Source/WebCore:

Refactor code and move it to WebCore.

* WebCore.exp.in:
* WebCore.xcodeproj/project.pbxproj:
* loader/ResourceLoader.h:
    Make willCacheResponse protected so that SubresourceLoader can override it.
* loader/SubresourceLoader.h:
* loader/cocoa/DiskCacheMonitorCocoa.h: Added.
    Mostly the same as the existing NetworkDiskCacheMonitor class in WebKit2. In the
    CFNetwork callback block, it calls a virtual function that is overridden by
    NetworkDiskCacheMonitor to send a message to WebContent process.
(WebCore::DiskCacheMonitor::~DiskCacheMonitor):
(WebCore::DiskCacheMonitor::resourceRequest):
(WebCore::DiskCacheMonitor::sessionID):
* loader/cocoa/DiskCacheMonitorCocoa.mm:
(WebCore::DiskCacheMonitor::tryGetFileBackedSharedBufferFromCFURLCachedResponse):
    Copied from NetworkResourceLoader::tryGetFileBackedSharedBufferFromCFURLCachedResponse.
(WebCore::DiskCacheMonitor::monitorFileBackingStoreCreation):
(WebCore::DiskCacheMonitor::DiskCacheMonitor):
(WebCore::DiskCacheMonitor::resourceBecameFileBacked):
    Replace the cached resource data with the contents of the file backed buffer. This is
    used in WebKit1 (and also for any resource loads that happen from the WebContent
    process).
* loader/cocoa/SubresourceLoaderCocoa.mm: Added.
(WebCore::SubresourceLoader::willCacheResponse):
    Override willCacheresponse from ResourceLoader to listen for disk cache notifications.

Source/WebKit2:

* NetworkProcess/mac/NetworkDiskCacheMonitor.h:
    Inherit from WebCore::DiskCacheMonitor which has the bulk of the functionality now.
(WebKit::NetworkDiskCacheMonitor::~NetworkDiskCacheMonitor):
* NetworkProcess/mac/NetworkDiskCacheMonitor.mm:
(WebKit::NetworkDiskCacheMonitor::monitorFileBackingStoreCreation):
(WebKit::NetworkDiskCacheMonitor::NetworkDiskCacheMonitor):
(WebKit::NetworkDiskCacheMonitor::resourceBecameFileBacked):
    Override virtual method and send the data to the WebContent process as before.</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="#trunkSourceWebCoreloaderResourceLoaderh">trunk/Source/WebCore/loader/ResourceLoader.h</a></li>
<li><a href="#trunkSourceWebCoreloaderSubresourceLoaderh">trunk/Source/WebCore/loader/SubresourceLoader.h</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcessmacNetworkDiskCacheMonitorh">trunk/Source/WebKit2/NetworkProcess/mac/NetworkDiskCacheMonitor.h</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcessmacNetworkDiskCacheMonitormm">trunk/Source/WebKit2/NetworkProcess/mac/NetworkDiskCacheMonitor.mm</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li>trunk/Source/WebCore/loader/cocoa/</li>
<li><a href="#trunkSourceWebCoreloadercocoaDiskCacheMonitorh">trunk/Source/WebCore/loader/cocoa/DiskCacheMonitor.h</a></li>
<li><a href="#trunkSourceWebCoreloadercocoaDiskCacheMonitorCocoah">trunk/Source/WebCore/loader/cocoa/DiskCacheMonitorCocoa.h</a></li>
<li><a href="#trunkSourceWebCoreloadercocoaDiskCacheMonitorCocoamm">trunk/Source/WebCore/loader/cocoa/DiskCacheMonitorCocoa.mm</a></li>
<li><a href="#trunkSourceWebCoreloadercocoaSubresourceLoaderCocoamm">trunk/Source/WebCore/loader/cocoa/SubresourceLoaderCocoa.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (172810 => 172811)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-08-20 21:04:34 UTC (rev 172810)
+++ trunk/Source/WebCore/ChangeLog        2014-08-20 21:07:36 UTC (rev 172811)
</span><span class="lines">@@ -1,3 +1,37 @@
</span><ins>+2014-08-20  Pratik Solanki  &lt;psolanki@apple.com&gt;
+
+        Move DiskCacheMonitor to WebCore so that WebKit1 clients can use it as well
+        https://bugs.webkit.org/show_bug.cgi?id=135896
+
+        Reviewed by Andreas Kling.
+
+        Refactor code and move it to WebCore.
+
+        * WebCore.exp.in:
+        * WebCore.xcodeproj/project.pbxproj:
+        * loader/ResourceLoader.h:
+            Make willCacheResponse protected so that SubresourceLoader can override it.
+        * loader/SubresourceLoader.h:
+        * loader/cocoa/DiskCacheMonitorCocoa.h: Added.
+            Mostly the same as the existing NetworkDiskCacheMonitor class in WebKit2. In the
+            CFNetwork callback block, it calls a virtual function that is overridden by
+            NetworkDiskCacheMonitor to send a message to WebContent process.
+        (WebCore::DiskCacheMonitor::~DiskCacheMonitor):
+        (WebCore::DiskCacheMonitor::resourceRequest):
+        (WebCore::DiskCacheMonitor::sessionID):
+        * loader/cocoa/DiskCacheMonitorCocoa.mm:
+        (WebCore::DiskCacheMonitor::tryGetFileBackedSharedBufferFromCFURLCachedResponse):
+            Copied from NetworkResourceLoader::tryGetFileBackedSharedBufferFromCFURLCachedResponse.
+        (WebCore::DiskCacheMonitor::monitorFileBackingStoreCreation):
+        (WebCore::DiskCacheMonitor::DiskCacheMonitor):
+        (WebCore::DiskCacheMonitor::resourceBecameFileBacked):
+            Replace the cached resource data with the contents of the file backed buffer. This is
+            used in WebKit1 (and also for any resource loads that happen from the WebContent
+            process).
+        * loader/cocoa/SubresourceLoaderCocoa.mm: Added.
+        (WebCore::SubresourceLoader::willCacheResponse):
+            Override willCacheresponse from ResourceLoader to listen for disk cache notifications.
+
</ins><span class="cx"> 2014-08-20  Eric Carlson  &lt;eric.carlson@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Cleanup MediaSession
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.exp.in (172810 => 172811)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.exp.in        2014-08-20 21:04:34 UTC (rev 172810)
+++ trunk/Source/WebCore/WebCore.exp.in        2014-08-20 21:07:36 UTC (rev 172811)
</span><span class="lines">@@ -2834,9 +2834,11 @@
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 1090
</span><span class="cx"> __ZN7WebCore15ProtectionSpace28encodingRequiresPlatformDataEP20NSURLProtectionSpace
</span><ins>+__ZN7WebCore16DiskCacheMonitorC2ERKNS_15ResourceRequestENS_9SessionIDEPK20_CFCachedURLResponse
</ins><span class="cx"> __ZN7WebCore23wrapSerializedCryptoKeyERKN3WTF6VectorIhLm0ENS0_15CrashOnOverflowEEES5_RS3_
</span><span class="cx"> __ZN7WebCore25unwrapSerializedCryptoKeyERKN3WTF6VectorIhLm0ENS0_15CrashOnOverflowEEES5_RS3_
</span><span class="cx"> __ZN7WebCore28getDefaultWebCryptoMasterKeyERN3WTF6VectorIhLm0ENS0_15CrashOnOverflowEEE
</span><ins>+__ZTVN7WebCore16DiskCacheMonitorE
</ins><span class="cx"> _wkCTFontTransformGlyphs
</span><span class="cx"> #endif
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (172810 => 172811)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-08-20 21:04:34 UTC (rev 172810)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-08-20 21:07:36 UTC (rev 172811)
</span><span class="lines">@@ -2438,6 +2438,7 @@
</span><span class="cx">                 7E474E1E12494DC900235364 /* SQLiteDatabaseTrackerClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E474E1B12494DC900235364 /* SQLiteDatabaseTrackerClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 7E474E1F12494DC900235364 /* SQLiteDatabaseTracker.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E474E1C12494DC900235364 /* SQLiteDatabaseTracker.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 7E474E2012494DC900235364 /* SQLiteDatabaseTracker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7E474E1D12494DC900235364 /* SQLiteDatabaseTracker.cpp */; };
</span><ins>+                7E4DE10D198B10B60051CB02 /* DiskCacheMonitorCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7E4DE10C198B10B60051CB02 /* DiskCacheMonitorCocoa.mm */; };
</ins><span class="cx">                 7E5D7A76161D3F8F00896C34 /* OESElementIndexUint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7E5D7A73161D3F8F00896C34 /* OESElementIndexUint.cpp */; };
</span><span class="cx">                 7E5D7A77161D3F8F00896C34 /* OESElementIndexUint.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E5D7A74161D3F8F00896C34 /* OESElementIndexUint.h */; };
</span><span class="cx">                 7E66E23316D6EB6C00F7E7FF /* WebGLCompressedTextureATC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7E66E23116D6EB6C00F7E7FF /* WebGLCompressedTextureATC.cpp */; };
</span><span class="lines">@@ -2446,12 +2447,14 @@
</span><span class="cx">                 7E66E23417E6EB6C00F7E7FF /* WebGLCompressedTexturePVRTC.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E66E23217E6EB6C00F7E7FF /* WebGLCompressedTexturePVRTC.h */; };
</span><span class="cx">                 7E7DE1FD195CEF260035363B /* ResourceRequestCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7E7DE1FC195CEF260035363B /* ResourceRequestCocoa.mm */; };
</span><span class="cx">                 7E7DE202195CEFCD0035363B /* ResourceRequestIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7E7DE201195CEFCD0035363B /* ResourceRequestIOS.mm */; };
</span><ins>+                7E8FADC4199A95B100714968 /* SubresourceLoaderCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7E8FADC3199A95B100714968 /* SubresourceLoaderCocoa.mm */; };
</ins><span class="cx">                 7E99AF510B13846468FB01A5 /* WindowFocusAllowedIndicator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7E99AF520B13846468FB01A5 /* WindowFocusAllowedIndicator.cpp */; };
</span><span class="cx">                 7E99AF530B13846468FB01A5 /* WindowFocusAllowedIndicator.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E99AF540B13846468FB01A5 /* WindowFocusAllowedIndicator.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 7EA30F6916DFFE7500257D0B /* JSWebGLCompressedTextureATC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7EA30F6716DFFE7500257D0B /* JSWebGLCompressedTextureATC.cpp */; };
</span><span class="cx">                 7EA30F6917EFFE7500257D0B /* JSWebGLCompressedTexturePVRTC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7EA30F6717EFFE7500257D0B /* JSWebGLCompressedTexturePVRTC.cpp */; };
</span><span class="cx">                 7EA30F6A16DFFE7500257D0B /* JSWebGLCompressedTextureATC.h in Headers */ = {isa = PBXBuildFile; fileRef = 7EA30F6816DFFE7500257D0B /* JSWebGLCompressedTextureATC.h */; };
</span><span class="cx">                 7EA30F6A17EFFE7500257D0B /* JSWebGLCompressedTexturePVRTC.h in Headers */ = {isa = PBXBuildFile; fileRef = 7EA30F6817EFFE7500257D0B /* JSWebGLCompressedTexturePVRTC.h */; };
</span><ins>+                7EDAAFC919A2CCDC0034DFD1 /* DiskCacheMonitorCocoa.h in Headers */ = {isa = PBXBuildFile; fileRef = 7EDAAFC819A2CBD10034DFD1 /* DiskCacheMonitorCocoa.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 7EE6845F12D26E3800E79415 /* AuthenticationCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7EE6844C12D26E3800E79415 /* AuthenticationCF.cpp */; };
</span><span class="cx">                 7EE6846012D26E3800E79415 /* AuthenticationCF.h in Headers */ = {isa = PBXBuildFile; fileRef = 7EE6844D12D26E3800E79415 /* AuthenticationCF.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 7EE6846112D26E3800E79415 /* AuthenticationChallenge.h in Headers */ = {isa = PBXBuildFile; fileRef = 7EE6844E12D26E3800E79415 /* AuthenticationChallenge.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -7795,7 +7798,7 @@
</span><span class="cx">                 1AC69592161A1E53003732CB /* GraphicsLayerFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GraphicsLayerFactory.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 1AC900BF1943AF3D008625B5 /* HTTPHeaderNames.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = HTTPHeaderNames.in; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 1AC900C01943C0A0008625B5 /* HTTPHeaderNames.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTTPHeaderNames.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                1AC900C11943C0A0008625B5 /* HTTPHeaderNames.gperf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file; path = HTTPHeaderNames.gperf; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><ins>+                1AC900C11943C0A0008625B5 /* HTTPHeaderNames.gperf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HTTPHeaderNames.gperf; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 1AC900C21943C0A0008625B5 /* HTTPHeaderNames.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTTPHeaderNames.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 1ACADD781880D91C00D8B71D /* ProgressTrackerClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProgressTrackerClient.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 1ACE53DD0A8D18810022947D /* JSDOMParser.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMParser.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -9592,6 +9595,7 @@
</span><span class="cx">                 7E474E1B12494DC900235364 /* SQLiteDatabaseTrackerClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SQLiteDatabaseTrackerClient.h; path = sql/SQLiteDatabaseTrackerClient.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7E474E1C12494DC900235364 /* SQLiteDatabaseTracker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SQLiteDatabaseTracker.h; path = sql/SQLiteDatabaseTracker.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7E474E1D12494DC900235364 /* SQLiteDatabaseTracker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SQLiteDatabaseTracker.cpp; path = sql/SQLiteDatabaseTracker.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                7E4DE10C198B10B60051CB02 /* DiskCacheMonitorCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = DiskCacheMonitorCocoa.mm; path = cocoa/DiskCacheMonitorCocoa.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 7E5D7A73161D3F8F00896C34 /* OESElementIndexUint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OESElementIndexUint.cpp; path = canvas/OESElementIndexUint.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7E5D7A74161D3F8F00896C34 /* OESElementIndexUint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OESElementIndexUint.h; path = canvas/OESElementIndexUint.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7E66E23116D6EB6C00F7E7FF /* WebGLCompressedTextureATC.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebGLCompressedTextureATC.cpp; path = canvas/WebGLCompressedTextureATC.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -9600,6 +9604,7 @@
</span><span class="cx">                 7E66E23217E6EB6C00F7E7FF /* WebGLCompressedTexturePVRTC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebGLCompressedTexturePVRTC.h; path = canvas/WebGLCompressedTexturePVRTC.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7E7DE1FC195CEF260035363B /* ResourceRequestCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = ResourceRequestCocoa.mm; path = cocoa/ResourceRequestCocoa.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7E7DE201195CEFCD0035363B /* ResourceRequestIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ResourceRequestIOS.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                7E8FADC3199A95B100714968 /* SubresourceLoaderCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = SubresourceLoaderCocoa.mm; path = cocoa/SubresourceLoaderCocoa.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 7E99AF520B13846468FB01A5 /* WindowFocusAllowedIndicator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WindowFocusAllowedIndicator.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7E99AF540B13846468FB01A5 /* WindowFocusAllowedIndicator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WindowFocusAllowedIndicator.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7EA30F6216DFD62700257D0B /* WebGLCompressedTextureATC.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = WebGLCompressedTextureATC.idl; path = canvas/WebGLCompressedTextureATC.idl; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -9608,6 +9613,7 @@
</span><span class="cx">                 7EA30F6717EFFE7500257D0B /* JSWebGLCompressedTexturePVRTC.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebGLCompressedTexturePVRTC.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7EA30F6816DFFE7500257D0B /* JSWebGLCompressedTextureATC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebGLCompressedTextureATC.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7EA30F6817EFFE7500257D0B /* JSWebGLCompressedTexturePVRTC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebGLCompressedTexturePVRTC.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                7EDAAFC819A2CBD10034DFD1 /* DiskCacheMonitorCocoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DiskCacheMonitorCocoa.h; path = cocoa/DiskCacheMonitorCocoa.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 7EE6844C12D26E3800E79415 /* AuthenticationCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AuthenticationCF.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7EE6844D12D26E3800E79415 /* AuthenticationCF.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AuthenticationCF.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7EE6844E12D26E3800E79415 /* AuthenticationChallenge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AuthenticationChallenge.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -16757,6 +16763,16 @@
</span><span class="cx">                         path = icu;
</span><span class="cx">                         sourceTree = &quot;&lt;group&gt;&quot;;
</span><span class="cx">                 };
</span><ins>+                7E4DE10B198B10810051CB02 /* cocoa */ = {
+                        isa = PBXGroup;
+                        children = (
+                                7EDAAFC819A2CBD10034DFD1 /* DiskCacheMonitorCocoa.h */,
+                                7E4DE10C198B10B60051CB02 /* DiskCacheMonitorCocoa.mm */,
+                                7E8FADC3199A95B100714968 /* SubresourceLoaderCocoa.mm */,
+                        );
+                        name = cocoa;
+                        sourceTree = &quot;&lt;group&gt;&quot;;
+                };
</ins><span class="cx">                 7E7DE1FE195CEF2D0035363B /* cocoa */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><span class="lines">@@ -21155,6 +21171,7 @@
</span><span class="cx">                                 512DD8E80D91E691000F89EE /* archive */,
</span><span class="cx">                                 A8D2B2521287A56000AF4DDA /* cache */,
</span><span class="cx">                                 7EE6847312D26E5500E79415 /* cf */,
</span><ins>+                                7E4DE10B198B10810051CB02 /* cocoa */,
</ins><span class="cx">                                 5126E6B60A2E3AEF005C29FA /* icon */,
</span><span class="cx">                                 CE79D68617F220ED00815C00 /* ios */,
</span><span class="cx">                                 93A1EAA20A5634D8006960A0 /* mac */,
</span><span class="lines">@@ -25880,6 +25897,7 @@
</span><span class="cx">                                 93C38BFF164473C700091EB2 /* ScrollingStateFixedNode.h in Headers */,
</span><span class="cx">                                 931CBD0D161A44E900E4C874 /* ScrollingStateNode.h in Headers */,
</span><span class="cx">                                 931CBD0F161A44E900E4C874 /* ScrollingStateScrollingNode.h in Headers */,
</span><ins>+                                7EDAAFC919A2CCDC0034DFD1 /* DiskCacheMonitorCocoa.h in Headers */,
</ins><span class="cx">                                 0FB8890F167D30160010CDA5 /* ScrollingStateStickyNode.h in Headers */,
</span><span class="cx">                                 931CBD11161A44E900E4C874 /* ScrollingStateTree.h in Headers */,
</span><span class="cx">                                 1AF62F2614DAFEA10041556C /* ScrollingThread.h in Headers */,
</span><span class="lines">@@ -28200,6 +28218,7 @@
</span><span class="cx">                                 659DDC8209E198BA001BF3C6 /* JSDocument.cpp in Sources */,
</span><span class="cx">                                 49C7BA8D1042F5B10009D447 /* JSDocumentCustom.cpp in Sources */,
</span><span class="cx">                                 1A494EDE0A123F4C00FDAFC1 /* JSDocumentFragment.cpp in Sources */,
</span><ins>+                                7E4DE10D198B10B60051CB02 /* DiskCacheMonitorCocoa.mm in Sources */,
</ins><span class="cx">                                 65DF31F509D1CC60000BE325 /* JSDocumentType.cpp in Sources */,
</span><span class="cx">                                 1AC2260C0DB69F190089B669 /* JSDOMApplicationCache.cpp in Sources */,
</span><span class="cx">                                 93B70D6309EB0C7C009D8468 /* JSDOMBinding.cpp in Sources */,
</span><span class="lines">@@ -28864,6 +28883,7 @@
</span><span class="cx">                                 FD6F252C13F5EF0E0065165F /* MediaElementAudioSourceNode.cpp in Sources */,
</span><span class="cx">                                 4E1959210A39DABA00220FE5 /* MediaFeatureNames.cpp in Sources */,
</span><span class="cx">                                 07A6D1EB1491137700051D0C /* MediaFragmentURIParser.cpp in Sources */,
</span><ins>+                                7E8FADC4199A95B100714968 /* SubresourceLoaderCocoa.mm in Sources */,
</ins><span class="cx">                                 CDB859F7160D48A400E5B07F /* MediaKeyEvent.cpp in Sources */,
</span><span class="cx">                                 CDA98DD816025BEF00FEA3B1 /* MediaKeyMessageEvent.cpp in Sources */,
</span><span class="cx">                                 CD1B4A65160786AE00282DF9 /* MediaKeyNeededEvent.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderResourceLoaderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/ResourceLoader.h (172810 => 172811)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/ResourceLoader.h        2014-08-20 21:04:34 UTC (rev 172810)
+++ trunk/Source/WebCore/loader/ResourceLoader.h        2014-08-20 21:07:36 UTC (rev 172811)
</span><span class="lines">@@ -155,6 +155,13 @@
</span><span class="cx"> 
</span><span class="cx">     const ResourceLoaderOptions&amp; options() { return m_options; }
</span><span class="cx"> 
</span><ins>+#if PLATFORM(COCOA) &amp;&amp; !USE(CFNETWORK)
+    virtual NSCachedURLResponse* willCacheResponse(ResourceHandle*, NSCachedURLResponse*) override;
+#endif
+#if PLATFORM(COCOA) &amp;&amp; USE(CFNETWORK)
+    virtual CFCachedURLResponseRef willCacheResponse(ResourceHandle*, CFCachedURLResponseRef) override;
+#endif
+
</ins><span class="cx">     RefPtr&lt;ResourceHandle&gt; m_handle;
</span><span class="cx">     RefPtr&lt;Frame&gt; m_frame;
</span><span class="cx">     RefPtr&lt;DocumentLoader&gt; m_documentLoader;
</span><span class="lines">@@ -186,12 +193,6 @@
</span><span class="cx">     virtual bool canAuthenticateAgainstProtectionSpace(ResourceHandle*, const ProtectionSpace&amp; protectionSpace) override { return canAuthenticateAgainstProtectionSpace(protectionSpace); }
</span><span class="cx"> #endif
</span><span class="cx">     virtual void receivedCancellation(ResourceHandle*, const AuthenticationChallenge&amp; challenge) override { receivedCancellation(challenge); }
</span><del>-#if PLATFORM(COCOA) &amp;&amp; !USE(CFNETWORK)
-    virtual NSCachedURLResponse* willCacheResponse(ResourceHandle*, NSCachedURLResponse*) override;
-#endif
-#if PLATFORM(COCOA) &amp;&amp; USE(CFNETWORK)
-    virtual CFCachedURLResponseRef willCacheResponse(ResourceHandle*, CFCachedURLResponseRef) override;
-#endif
</del><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx">     virtual RetainPtr&lt;CFDictionaryRef&gt; connectionProperties(ResourceHandle*) override;
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderSubresourceLoaderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/SubresourceLoader.h (172810 => 172811)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/SubresourceLoader.h        2014-08-20 21:04:34 UTC (rev 172810)
+++ trunk/Source/WebCore/loader/SubresourceLoader.h        2014-08-20 21:07:36 UTC (rev 172811)
</span><span class="lines">@@ -74,6 +74,13 @@
</span><span class="cx">     virtual void willCancel(const ResourceError&amp;) override;
</span><span class="cx">     virtual void didCancel(const ResourceError&amp;) override;
</span><span class="cx"> 
</span><ins>+#if PLATFORM(COCOA) &amp;&amp; !USE(CFNETWORK)
+    virtual NSCachedURLResponse *willCacheResponse(ResourceHandle*, NSCachedURLResponse*) override;
+#endif
+#if PLATFORM(COCOA) &amp;&amp; USE(CFNETWORK)
+    virtual CFCachedURLResponseRef willCacheResponse(ResourceHandle*, CFCachedURLResponseRef) override;
+#endif
+
</ins><span class="cx"> #if USE(NETWORK_CFDATA_ARRAY_CALLBACK)
</span><span class="cx">     virtual bool supportsDataArray() override { return true; }
</span><span class="cx">     virtual void didReceiveDataArray(CFArrayRef) override;
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercocoaDiskCacheMonitorhfromrev172809trunkSourceWebKit2NetworkProcessmacNetworkDiskCacheMonitorh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/loader/cocoa/DiskCacheMonitor.h (from rev 172809, trunk/Source/WebKit2/NetworkProcess/mac/NetworkDiskCacheMonitor.h) (0 => 172811)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cocoa/DiskCacheMonitor.h                                (rev 0)
+++ trunk/Source/WebCore/loader/cocoa/DiskCacheMonitor.h        2014-08-20 21:07:36 UTC (rev 172811)
</span><span class="lines">@@ -0,0 +1,66 @@
</span><ins>+/*
+ * Copyright (C) 2014 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 DiskCacheMonitor_h
+#define DiskCacheMonitor_h
+
+#include &quot;ResourceRequest.h&quot;
+#include &quot;SessionID.h&quot;
+#include &lt;wtf/PassRefPtr.h&gt;
+
+typedef const struct _CFCachedURLResponse* CFCachedURLResponseRef;
+
+namespace WebCore {
+
+class SharedBuffer;
+
+class DiskCacheMonitor {
+public:
+    static void monitorFileBackingStoreCreation(const ResourceRequest&amp;, SessionID, CFCachedURLResponseRef);
+    static PassRefPtr&lt;SharedBuffer&gt; tryGetFileBackedSharedBufferFromCFURLCachedResponse(CFCachedURLResponseRef);
+    virtual ~DiskCacheMonitor() { }
+
+protected:
+    DiskCacheMonitor(const ResourceRequest&amp;, SessionID, CFCachedURLResponseRef);
+
+    virtual void resourceBecameFileBacked(PassRefPtr&lt;SharedBuffer&gt;);
+
+    const ResourceRequest&amp; resourceRequest() const { return m_resourceRequest; }
+    SessionID sessionID() const { return m_sessionID; }
+
+private:
+    ResourceRequest m_resourceRequest;
+    SessionID m_sessionID;
+};
+
+#if (PLATFORM(IOS) &amp;&amp; __IPHONE_OS_VERSION_MIN_REQUIRED &lt; 80000) || (PLATFORM(MAC) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &lt; 1090)
+
+void DiskCacheMonitor::monitorFileBackingStoreCreation(const ResourceRequest&amp;, SessionID, CFCachedURLResponseRef) { }
+PassRefPtr&lt;SharedBuffer&gt; DiskCacheMonitor::tryGetFileBackedSharedBufferFromCFURLCachedResponse(CFCachedURLResponseRef) { return nullptr; }
+
+#endif
+} // namespace WebKit
+
+#endif // DiskCacheMonitor_h
</ins></span></pre></div>
<a id="trunkSourceWebCoreloadercocoaDiskCacheMonitorCocoahfromrev172809trunkSourceWebKit2NetworkProcessmacNetworkDiskCacheMonitorh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/loader/cocoa/DiskCacheMonitorCocoa.h (from rev 172809, trunk/Source/WebKit2/NetworkProcess/mac/NetworkDiskCacheMonitor.h) (0 => 172811)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cocoa/DiskCacheMonitorCocoa.h                                (rev 0)
+++ trunk/Source/WebCore/loader/cocoa/DiskCacheMonitorCocoa.h        2014-08-20 21:07:36 UTC (rev 172811)
</span><span class="lines">@@ -0,0 +1,73 @@
</span><ins>+/*
+ * Copyright (C) 2014 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 DiskCacheMonitorCocoa_h
+#define DiskCacheMonitorCocoa_h
+
+#include &quot;ResourceRequest.h&quot;
+#include &quot;SessionID.h&quot;
+#include &lt;wtf/PassRefPtr.h&gt;
+
+typedef const struct _CFCachedURLResponse* CFCachedURLResponseRef;
+
+namespace WebCore {
+
+class SharedBuffer;
+
+class DiskCacheMonitor {
+public:
+    static void monitorFileBackingStoreCreation(const ResourceRequest&amp;, SessionID, CFCachedURLResponseRef);
+    static PassRefPtr&lt;SharedBuffer&gt; tryGetFileBackedSharedBufferFromCFURLCachedResponse(CFCachedURLResponseRef);
+    virtual ~DiskCacheMonitor() { }
+
+protected:
+    DiskCacheMonitor(const ResourceRequest&amp;, SessionID, CFCachedURLResponseRef);
+
+    virtual void resourceBecameFileBacked(PassRefPtr&lt;SharedBuffer&gt;);
+
+    const ResourceRequest&amp; resourceRequest() const { return m_resourceRequest; }
+    SessionID sessionID() const { return m_sessionID; }
+
+private:
+    ResourceRequest m_resourceRequest;
+    SessionID m_sessionID;
+};
+
+#if (PLATFORM(IOS) &amp;&amp; __IPHONE_OS_VERSION_MIN_REQUIRED &lt; 80000) || (PLATFORM(MAC) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &lt; 1090)
+
+inline void DiskCacheMonitor::monitorFileBackingStoreCreation(const ResourceRequest&amp;, SessionID, CFCachedURLResponseRef)
+{
+}
+
+inline PassRefPtr&lt;SharedBuffer&gt; DiskCacheMonitor::tryGetFileBackedSharedBufferFromCFURLCachedResponse(CFCachedURLResponseRef)
+{
+    return nullptr;
+}
+
+#endif
+
+} // namespace WebKit
+
+#endif // DiskCacheMonitorCocoa_h
</ins></span></pre></div>
<a id="trunkSourceWebCoreloadercocoaDiskCacheMonitorCocoammfromrev172809trunkSourceWebKit2NetworkProcessmacNetworkDiskCacheMonitormm"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/loader/cocoa/DiskCacheMonitorCocoa.mm (from rev 172809, trunk/Source/WebKit2/NetworkProcess/mac/NetworkDiskCacheMonitor.mm) (0 => 172811)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cocoa/DiskCacheMonitorCocoa.mm                                (rev 0)
+++ trunk/Source/WebCore/loader/cocoa/DiskCacheMonitorCocoa.mm        2014-08-20 21:07:36 UTC (rev 172811)
</span><span class="lines">@@ -0,0 +1,120 @@
</span><ins>+/*
+ * Copyright (C) 2014 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.
+ */
+
+#import &quot;config.h&quot;
+#import &quot;DiskCacheMonitorCocoa.h&quot;
+
+#import &quot;CachedResource.h&quot;
+#import &quot;MemoryCache.h&quot;
+#import &quot;ResourceRequest.h&quot;
+#import &quot;SessionID.h&quot;
+#import &quot;SharedBuffer.h&quot;
+#import &lt;wtf/MainThread.h&gt;
+#import &lt;wtf/OwnPtr.h&gt;
+#import &lt;wtf/PassOwnPtr.h&gt;
+#import &lt;wtf/PassRefPtr.h&gt;
+#import &lt;wtf/RefPtr.h&gt;
+
+#ifdef __has_include
+#if __has_include(&lt;CFNetwork/CFURLCachePriv.h&gt;)
+#include &lt;CFNetwork/CFURLCachePriv.h&gt;
+#endif
+#endif
+
+#if (PLATFORM(IOS) &amp;&amp; __IPHONE_OS_VERSION_MIN_REQUIRED &gt;= 80000) || (PLATFORM(MAC) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 1090)
+
+typedef void (^CFCachedURLResponseCallBackBlock)(CFCachedURLResponseRef);
+extern &quot;C&quot; void _CFCachedURLResponseSetBecameFileBackedCallBackBlock(CFCachedURLResponseRef, CFCachedURLResponseCallBackBlock, dispatch_queue_t);
+extern &quot;C&quot; CFDataRef _CFCachedURLResponseGetMemMappedData(CFCachedURLResponseRef);
+
+namespace WebCore {
+
+// The maximum number of seconds we'll try to wait for a resource to be disk cached before we forget the request.
+static const double diskCacheMonitorTimeout = 20;
+
+PassRefPtr&lt;SharedBuffer&gt; DiskCacheMonitor::tryGetFileBackedSharedBufferFromCFURLCachedResponse(CFCachedURLResponseRef cachedResponse)
+{
+    CFDataRef data = _CFCachedURLResponseGetMemMappedData(cachedResponse);
+    if (!data)
+        return nullptr;
+
+    return SharedBuffer::wrapCFData(data);
+}
+
+void DiskCacheMonitor::monitorFileBackingStoreCreation(const ResourceRequest&amp; request, SessionID sessionID, CFCachedURLResponseRef cachedResponse)
+{
+    if (!cachedResponse)
+        return;
+
+    new DiskCacheMonitor(request, sessionID, cachedResponse); // Balanced by adoptPtr in the blocks setup in the constructor, one of which is guaranteed to run.
+}
+
+DiskCacheMonitor::DiskCacheMonitor(const ResourceRequest&amp; request, SessionID sessionID, CFCachedURLResponseRef cachedResponse)
+    : m_resourceRequest(request)
+    , m_sessionID(sessionID)
+{
+    ASSERT(isMainThread());
+
+    // Set up a delayed callback to cancel this monitor if the resource hasn't been cached yet.
+    __block DiskCacheMonitor* rawMonitor = this;
+
+    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, NSEC_PER_SEC * diskCacheMonitorTimeout), dispatch_get_main_queue(), ^{
+        adoptPtr(rawMonitor); // Balanced by `new DiskCacheMonitor` in monitorFileBackingStoreCreation.
+        rawMonitor = 0;
+    });
+
+    // Set up the disk caching callback to create the ShareableResource and send it to the WebProcess.
+    CFCachedURLResponseCallBackBlock block = ^(CFCachedURLResponseRef cachedResponse)
+    {
+        // If the monitor isn't there then it timed out before this resource was cached to disk.
+        if (!rawMonitor)
+            return;
+
+        OwnPtr&lt;DiskCacheMonitor&gt; monitor = adoptPtr(rawMonitor); // Balanced by `new DiskCacheMonitor` in monitorFileBackingStoreCreation.
+        rawMonitor = 0;
+
+        RefPtr&lt;SharedBuffer&gt; fileBackedBuffer = DiskCacheMonitor::tryGetFileBackedSharedBufferFromCFURLCachedResponse(cachedResponse);
+        if (!fileBackedBuffer)
+            return;
+
+        monitor-&gt;resourceBecameFileBacked(fileBackedBuffer);
+    };
+
+    _CFCachedURLResponseSetBecameFileBackedCallBackBlock(cachedResponse, block, dispatch_get_main_queue());
+}
+
+void DiskCacheMonitor::resourceBecameFileBacked(PassRefPtr&lt;SharedBuffer&gt; fileBackedBuffer)
+{
+    CachedResource* resource = memoryCache()-&gt;resourceForRequest(m_resourceRequest, m_sessionID);
+    if (!resource)
+        return;
+
+    resource-&gt;tryReplaceEncodedData(fileBackedBuffer);
+}
+
+
+} // namespace WebCore
+
+#endif // (PLATFORM(IOS) &amp;&amp; __IPHONE_OS_VERSION_MIN_REQUIRED &gt;= 80000) || (PLATFORM(MAC) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 1090)
</ins></span></pre></div>
<a id="trunkSourceWebCoreloadercocoaSubresourceLoaderCocoammfromrev172809trunkSourceWebKit2NetworkProcessmacNetworkDiskCacheMonitorh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/loader/cocoa/SubresourceLoaderCocoa.mm (from rev 172809, trunk/Source/WebKit2/NetworkProcess/mac/NetworkDiskCacheMonitor.h) (0 => 172811)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cocoa/SubresourceLoaderCocoa.mm                                (rev 0)
+++ trunk/Source/WebCore/loader/cocoa/SubresourceLoaderCocoa.mm        2014-08-20 21:07:36 UTC (rev 172811)
</span><span class="lines">@@ -0,0 +1,59 @@
</span><ins>+/*
+ * Copyright (C) 2014 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;SubresourceLoader.h&quot;
+
+#include &quot;CachedResource.h&quot;
+#include &quot;DiskCacheMonitorCocoa.h&quot;
+#include &quot;ResourceHandle.h&quot;
+#include &quot;ResourceLoader.h&quot;
+#include &quot;SharedBuffer.h&quot;
+
+@interface NSCachedURLResponse (Details)
+-(CFCachedURLResponseRef)_CFCachedURLResponse;
+@end
+
+namespace WebCore {
+
+#if USE(CFNETWORK)
+
+CFCachedURLResponseRef SubresourceLoader::willCacheResponse(ResourceHandle* handle, CFCachedURLResponseRef cachedResponse)
+{
+    DiskCacheMonitor::monitorFileBackingStoreCreation(request(), m_resource-&gt;sessionID(), cachedResponse);
+    return ResourceLoader::willCacheResponse(handle, cachedResponse);
+}
+
+#else
+
+NSCachedURLResponse* SubresourceLoader::willCacheResponse(ResourceHandle* handle, NSCachedURLResponse* response)
+{
+    DiskCacheMonitor::monitorFileBackingStoreCreation(request(), m_resource-&gt;sessionID(), [response _CFCachedURLResponse]);
+    return ResourceLoader::willCacheResponse(handle, response);
+}
+
+#endif
+
+}
</ins></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (172810 => 172811)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-08-20 21:04:34 UTC (rev 172810)
+++ trunk/Source/WebKit2/ChangeLog        2014-08-20 21:07:36 UTC (rev 172811)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2014-08-20  Pratik Solanki  &lt;psolanki@apple.com&gt;
+
+        Move DiskCacheMonitor to WebCore so that WebKit1 clients can use it as well
+        https://bugs.webkit.org/show_bug.cgi?id=135896
+
+        Reviewed by Andreas Kling.
+
+        * NetworkProcess/mac/NetworkDiskCacheMonitor.h:
+            Inherit from WebCore::DiskCacheMonitor which has the bulk of the functionality now.
+        (WebKit::NetworkDiskCacheMonitor::~NetworkDiskCacheMonitor):
+        * NetworkProcess/mac/NetworkDiskCacheMonitor.mm:
+        (WebKit::NetworkDiskCacheMonitor::monitorFileBackingStoreCreation):
+        (WebKit::NetworkDiskCacheMonitor::NetworkDiskCacheMonitor):
+        (WebKit::NetworkDiskCacheMonitor::resourceBecameFileBacked):
+            Override virtual method and send the data to the WebContent process as before.
+
</ins><span class="cx"> 2014-08-19  Pratik Solanki  &lt;psolanki@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Remove PurgeableBuffer since it is not very useful any more
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcessmacNetworkDiskCacheMonitorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/mac/NetworkDiskCacheMonitor.h (172810 => 172811)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/mac/NetworkDiskCacheMonitor.h        2014-08-20 21:04:34 UTC (rev 172810)
+++ trunk/Source/WebKit2/NetworkProcess/mac/NetworkDiskCacheMonitor.h        2014-08-20 21:07:36 UTC (rev 172811)
</span><span class="lines">@@ -27,8 +27,10 @@
</span><span class="cx"> #define NetworkDiskCacheMonitor_h
</span><span class="cx"> 
</span><span class="cx"> #include &quot;MessageSender.h&quot;
</span><ins>+#include &lt;WebCore/DiskCacheMonitorCocoa.h&gt;
</ins><span class="cx"> #include &lt;WebCore/ResourceRequest.h&gt;
</span><span class="cx"> #include &lt;WebCore/SessionID.h&gt;
</span><ins>+#include &lt;WebCore/SharedBuffer.h&gt;
</ins><span class="cx"> #include &lt;wtf/RunLoop.h&gt;
</span><span class="cx"> 
</span><span class="cx"> typedef const struct _CFCachedURLResponse* CFCachedURLResponseRef;
</span><span class="lines">@@ -38,22 +40,21 @@
</span><span class="cx"> class NetworkConnectionToWebProcess;
</span><span class="cx"> class NetworkResourceLoader;
</span><span class="cx"> 
</span><del>-class NetworkDiskCacheMonitor : public IPC::MessageSender {
</del><ins>+class NetworkDiskCacheMonitor final : public WebCore::DiskCacheMonitor, private IPC::MessageSender {
</ins><span class="cx"> public:
</span><span class="cx">     static void monitorFileBackingStoreCreation(CFCachedURLResponseRef, NetworkResourceLoader*);
</span><span class="cx"> 
</span><del>-    const WebCore::ResourceRequest&amp; resourceRequest() const { return m_resourceRequest; }
-
</del><span class="cx"> private:
</span><span class="cx">     NetworkDiskCacheMonitor(CFCachedURLResponseRef, NetworkResourceLoader*);
</span><span class="cx"> 
</span><ins>+    // WebCore::DiskCacheMonitor
+    virtual void resourceBecameFileBacked(PassRefPtr&lt;WebCore::SharedBuffer&gt;) override;
+
</ins><span class="cx">     // IPC::MessageSender
</span><span class="cx">     virtual IPC::Connection* messageSenderConnection() override;
</span><span class="cx">     virtual uint64_t messageSenderDestinationID() override;
</span><span class="cx"> 
</span><span class="cx">     RefPtr&lt;NetworkConnectionToWebProcess&gt; m_connectionToWebProcess;
</span><del>-    WebCore::ResourceRequest m_resourceRequest;
-    WebCore::SessionID m_sessionID;
</del><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcessmacNetworkDiskCacheMonitormm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/mac/NetworkDiskCacheMonitor.mm (172810 => 172811)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/mac/NetworkDiskCacheMonitor.mm        2014-08-20 21:04:34 UTC (rev 172810)
+++ trunk/Source/WebKit2/NetworkProcess/mac/NetworkDiskCacheMonitor.mm        2014-08-20 21:07:36 UTC (rev 172811)
</span><span class="lines">@@ -30,7 +30,6 @@
</span><span class="cx"> #import &quot;NetworkProcessConnectionMessages.h&quot;
</span><span class="cx"> #import &quot;NetworkResourceLoader.h&quot;
</span><span class="cx"> #import &quot;WebCoreArgumentCoders.h&quot;
</span><del>-#import &lt;wtf/PassOwnPtr.h&gt;
</del><span class="cx"> 
</span><span class="cx"> #ifdef __has_include
</span><span class="cx"> #if __has_include(&lt;CFNetwork/CFURLCachePriv.h&gt;)
</span><span class="lines">@@ -40,16 +39,10 @@
</span><span class="cx"> 
</span><span class="cx"> #if (PLATFORM(IOS) &amp;&amp; __IPHONE_OS_VERSION_MIN_REQUIRED &gt;= 80000) || (PLATFORM(MAC) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 1090)
</span><span class="cx"> 
</span><del>-typedef void (^CFCachedURLResponseCallBackBlock)(CFCachedURLResponseRef);
-extern &quot;C&quot; void _CFCachedURLResponseSetBecameFileBackedCallBackBlock(CFCachedURLResponseRef, CFCachedURLResponseCallBackBlock, dispatch_queue_t);
-
</del><span class="cx"> using namespace WebCore;
</span><span class="cx"> 
</span><span class="cx"> namespace WebKit {
</span><span class="cx"> 
</span><del>-// The maximum number of seconds we'll try to wait for a resource to be disk cached before we forget the request.
-static const double diskCacheMonitorTimeout = 20;
-
</del><span class="cx"> void NetworkDiskCacheMonitor::monitorFileBackingStoreCreation(CFCachedURLResponseRef cachedResponse, NetworkResourceLoader* loader)
</span><span class="cx"> {
</span><span class="cx">     if (!cachedResponse)
</span><span class="lines">@@ -57,43 +50,23 @@
</span><span class="cx"> 
</span><span class="cx">     ASSERT(loader);
</span><span class="cx"> 
</span><del>-    new NetworkDiskCacheMonitor(cachedResponse, loader); // Balanced by adoptPtr in the blocks setup in the constructor, one of which is guaranteed to run.
</del><ins>+    new NetworkDiskCacheMonitor(cachedResponse, loader); // Balanced by adoptPtr in the blocks set up in the DiskCacheMonitor constructor, one of which is guaranteed to run.
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> NetworkDiskCacheMonitor::NetworkDiskCacheMonitor(CFCachedURLResponseRef cachedResponse, NetworkResourceLoader* loader)
</span><del>-    : m_connectionToWebProcess(loader-&gt;connectionToWebProcess())
-    , m_resourceRequest(loader-&gt;request())
-    , m_sessionID(loader-&gt;sessionID())
</del><ins>+    : DiskCacheMonitor(loader-&gt;request(), loader-&gt;sessionID(), cachedResponse)
+    , m_connectionToWebProcess(loader-&gt;connectionToWebProcess())
</ins><span class="cx"> {
</span><del>-    ASSERT(RunLoop::isMain());
</del><ins>+}
</ins><span class="cx"> 
</span><del>-    // Set up a delayed callback to cancel this monitor if the resource hasn't been cached yet.
-    __block NetworkDiskCacheMonitor* rawMonitor = this;
</del><ins>+void NetworkDiskCacheMonitor::resourceBecameFileBacked(PassRefPtr&lt;SharedBuffer&gt; fileBackedBuffer)
+{
+    ShareableResource::Handle handle;
+    NetworkResourceLoader::tryGetShareableHandleFromSharedBuffer(handle, fileBackedBuffer.get());
+    if (handle.isNull())
+        return;
</ins><span class="cx"> 
</span><del>-    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, NSEC_PER_SEC * diskCacheMonitorTimeout), dispatch_get_main_queue(), ^{
-        adoptPtr(rawMonitor); // Balanced by `new NetworkDiskCacheMonitor` in monitorFileBackingStoreCreation.
-        rawMonitor = 0;
-    });
-
-    // Set up the disk caching callback to create the ShareableResource and send it to the WebProcess.
-    CFCachedURLResponseCallBackBlock block = ^(CFCachedURLResponseRef cachedResponse)
-    {
-        // If the monitor isn't there then it timed out before this resource was cached to disk.
-        if (!rawMonitor)
-            return;
-
-        OwnPtr&lt;NetworkDiskCacheMonitor&gt; monitor = adoptPtr(rawMonitor); // Balanced by `new NetworkDiskCacheMonitor` in monitorFileBackingStoreCreation.
-        rawMonitor = 0;
-
-        ShareableResource::Handle handle;
-        NetworkResourceLoader::tryGetShareableHandleFromCFURLCachedResponse(handle, cachedResponse);
-        if (handle.isNull())
-            return;
-
-        monitor-&gt;send(Messages::NetworkProcessConnection::DidCacheResource(monitor-&gt;resourceRequest(), handle, m_sessionID));
-    };
-
-    _CFCachedURLResponseSetBecameFileBackedCallBackBlock(cachedResponse, block, dispatch_get_main_queue());
</del><ins>+    send(Messages::NetworkProcessConnection::DidCacheResource(resourceRequest(), handle, sessionID()));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> IPC::Connection* NetworkDiskCacheMonitor::messageSenderConnection()
</span></span></pre>
</div>
</div>

</body>
</html>