<!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>[175491] 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/175491">175491</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2014-11-03 14:27:59 -0800 (Mon, 03 Nov 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Unreviewed, rolling out <a href="http://trac.webkit.org/projects/webkit/changeset/175406">r175406</a>, <a href="http://trac.webkit.org/projects/webkit/changeset/175413">r175413</a>, and <a href="http://trac.webkit.org/projects/webkit/changeset/175423">r175423</a>.
https://bugs.webkit.org/show_bug.cgi?id=138327

Multipart tests are still broken (Requested by ap on #webkit).

Reverted changesets:

&quot;Eliminate ResourceBuffer and use SharedBuffer directly
instead&quot;
https://bugs.webkit.org/show_bug.cgi?id=138174
http://trac.webkit.org/changeset/175406

&quot;Unreviewed, iOS build fix since 175406.&quot;
http://trac.webkit.org/changeset/175413

&quot;Fix assertion in CachedResource::addDataBuffer&quot;
http://trac.webkit.org/changeset/175423</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreCMakeListstxt">trunk/Source/WebCore/CMakeLists.txt</a></li>
<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="#trunkSourceWebCoreWebCorevcxprojWebCorevcxproj">trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj</a></li>
<li><a href="#trunkSourceWebCoreWebCorevcxprojWebCorevcxprojfilters">trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCorebindingsobjcDOMUIKitExtensionsmm">trunk/Source/WebCore/bindings/objc/DOMUIKitExtensions.mm</a></li>
<li><a href="#trunkSourceWebCoreeditingiosEditorIOSmm">trunk/Source/WebCore/editing/ios/EditorIOS.mm</a></li>
<li><a href="#trunkSourceWebCoreeditingmacEditorMacmm">trunk/Source/WebCore/editing/mac/EditorMac.mm</a></li>
<li><a href="#trunkSourceWebCorehtmlImageDocumentcpp">trunk/Source/WebCore/html/ImageDocument.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorPageAgentcpp">trunk/Source/WebCore/inspector/InspectorPageAgent.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorResourceAgentcpp">trunk/Source/WebCore/inspector/InspectorResourceAgent.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderDocumentLoadercpp">trunk/Source/WebCore/loader/DocumentLoader.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderDocumentLoaderh">trunk/Source/WebCore/loader/DocumentLoader.h</a></li>
<li><a href="#trunkSourceWebCoreloaderMediaResourceLoadercpp">trunk/Source/WebCore/loader/MediaResourceLoader.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderResourceLoadercpp">trunk/Source/WebCore/loader/ResourceLoader.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderResourceLoaderh">trunk/Source/WebCore/loader/ResourceLoader.h</a></li>
<li><a href="#trunkSourceWebCoreloaderSubresourceLoadercpp">trunk/Source/WebCore/loader/SubresourceLoader.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderTextTrackLoadercpp">trunk/Source/WebCore/loader/TextTrackLoader.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderappcacheApplicationCacheGroupcpp">trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderarchivecfLegacyWebArchivecpp">trunk/Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp</a></li>
<li><a href="#trunkSourceWebCoreloadercacheCachedCSSStyleSheetcpp">trunk/Source/WebCore/loader/cache/CachedCSSStyleSheet.cpp</a></li>
<li><a href="#trunkSourceWebCoreloadercacheCachedCSSStyleSheeth">trunk/Source/WebCore/loader/cache/CachedCSSStyleSheet.h</a></li>
<li><a href="#trunkSourceWebCoreloadercacheCachedFontcpp">trunk/Source/WebCore/loader/cache/CachedFont.cpp</a></li>
<li><a href="#trunkSourceWebCoreloadercacheCachedFonth">trunk/Source/WebCore/loader/cache/CachedFont.h</a></li>
<li><a href="#trunkSourceWebCoreloadercacheCachedImagecpp">trunk/Source/WebCore/loader/cache/CachedImage.cpp</a></li>
<li><a href="#trunkSourceWebCoreloadercacheCachedImageh">trunk/Source/WebCore/loader/cache/CachedImage.h</a></li>
<li><a href="#trunkSourceWebCoreloadercacheCachedRawResourcecpp">trunk/Source/WebCore/loader/cache/CachedRawResource.cpp</a></li>
<li><a href="#trunkSourceWebCoreloadercacheCachedRawResourceh">trunk/Source/WebCore/loader/cache/CachedRawResource.h</a></li>
<li><a href="#trunkSourceWebCoreloadercacheCachedResourcecpp">trunk/Source/WebCore/loader/cache/CachedResource.cpp</a></li>
<li><a href="#trunkSourceWebCoreloadercacheCachedResourceh">trunk/Source/WebCore/loader/cache/CachedResource.h</a></li>
<li><a href="#trunkSourceWebCoreloadercacheCachedResourceClienth">trunk/Source/WebCore/loader/cache/CachedResourceClient.h</a></li>
<li><a href="#trunkSourceWebCoreloadercacheCachedSVGDocumentcpp">trunk/Source/WebCore/loader/cache/CachedSVGDocument.cpp</a></li>
<li><a href="#trunkSourceWebCoreloadercacheCachedSVGDocumenth">trunk/Source/WebCore/loader/cache/CachedSVGDocument.h</a></li>
<li><a href="#trunkSourceWebCoreloadercacheCachedScriptcpp">trunk/Source/WebCore/loader/cache/CachedScript.cpp</a></li>
<li><a href="#trunkSourceWebCoreloadercacheCachedScripth">trunk/Source/WebCore/loader/cache/CachedScript.h</a></li>
<li><a href="#trunkSourceWebCoreloadercacheCachedTextTrackcpp">trunk/Source/WebCore/loader/cache/CachedTextTrack.cpp</a></li>
<li><a href="#trunkSourceWebCoreloadercacheCachedTextTrackh">trunk/Source/WebCore/loader/cache/CachedTextTrack.h</a></li>
<li><a href="#trunkSourceWebCoreloadercacheCachedXSLStyleSheetcpp">trunk/Source/WebCore/loader/cache/CachedXSLStyleSheet.cpp</a></li>
<li><a href="#trunkSourceWebCoreloadercacheCachedXSLStyleSheeth">trunk/Source/WebCore/loader/cache/CachedXSLStyleSheet.h</a></li>
<li><a href="#trunkSourceWebCoreloadercfSubresourceLoaderCFcpp">trunk/Source/WebCore/loader/cf/SubresourceLoaderCF.cpp</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="#trunkSourceWebCoreloadericonIconLoadercpp">trunk/Source/WebCore/loader/icon/IconLoader.cpp</a></li>
<li><a href="#trunkSourceWebCoreloadermacResourceLoaderMacmm">trunk/Source/WebCore/loader/mac/ResourceLoaderMac.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformSharedBuffercpp">trunk/Source/WebCore/platform/SharedBuffer.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformSharedBufferh">trunk/Source/WebCore/platform/SharedBuffer.h</a></li>
<li><a href="#trunkSourceWebCoreplatformcfSharedBufferCFcpp">trunk/Source/WebCore/platform/cf/SharedBufferCF.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsPlatformMediaResourceLoaderh">trunk/Source/WebCore/platform/graphics/PlatformMediaResourceLoader.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsavfoundationcfWebCoreAVCFResourceLoadercpp">trunk/Source/WebCore/platform/graphics/avfoundation/cf/WebCoreAVCFResourceLoader.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsavfoundationobjcWebCoreAVFResourceLoadermm">trunk/Source/WebCore/platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsgstreamerWebKitWebSourceGStreamercpp">trunk/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformmacPasteboardMacmm">trunk/Source/WebCore/platform/mac/PasteboardMac.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformsoupSharedBufferSoupcpp">trunk/Source/WebCore/platform/soup/SharedBufferSoup.cpp</a></li>
<li><a href="#trunkSourceWebKitmacChangeLog">trunk/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebDataSourcemm">trunk/Source/WebKit/mac/WebView/WebDataSource.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebHTMLViewmm">trunk/Source/WebKit/mac/WebView/WebHTMLView.mm</a></li>
<li><a href="#trunkSourceWebKitwinChangeLog">trunk/Source/WebKit/win/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitwinWebDataSourcecpp">trunk/Source/WebKit/win/WebDataSource.cpp</a></li>
<li><a href="#trunkSourceWebKit2CMakeListstxt">trunk/Source/WebKit2/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcessNetworkResourceLoadercpp">trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcessNetworkResourceLoaderh">trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.h</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>
<li><a href="#trunkSourceWebKit2NetworkProcessmacNetworkResourceLoaderMacmm">trunk/Source/WebKit2/NetworkProcess/mac/NetworkResourceLoaderMac.mm</a></li>
<li><a href="#trunkSourceWebKit2PlatformIPCDataReferenceh">trunk/Source/WebKit2/Platform/IPC/DataReference.h</a></li>
<li><a href="#trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj">trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebKit2WebProcessNetworkNetworkProcessConnectioncpp">trunk/Source/WebKit2/WebProcess/Network/NetworkProcessConnection.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessNetworkWebResourceLoadSchedulercpp">trunk/Source/WebKit2/WebProcess/Network/WebResourceLoadScheduler.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessNetworkWebResourceLoadercpp">trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessNetworkWebResourceLoaderh">trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebCoreSupportWebFrameLoaderClientcpp">trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebFramecpp">trunk/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPagecpp">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageiosWebPageIOSmm">trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreloaderResourceBuffercpp">trunk/Source/WebCore/loader/ResourceBuffer.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderResourceBufferh">trunk/Source/WebCore/loader/ResourceBuffer.h</a></li>
<li><a href="#trunkSourceWebCoreloadermacResourceBuffermm">trunk/Source/WebCore/loader/mac/ResourceBuffer.mm</a></li>
<li><a href="#trunkSourceWebKit2SharedWebResourceBuffercpp">trunk/Source/WebKit2/Shared/WebResourceBuffer.cpp</a></li>
<li><a href="#trunkSourceWebKit2SharedWebResourceBufferh">trunk/Source/WebKit2/Shared/WebResourceBuffer.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/CMakeLists.txt (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/CMakeLists.txt        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebCore/CMakeLists.txt        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -1816,6 +1816,7 @@
</span><span class="cx">     loader/PolicyCallback.cpp
</span><span class="cx">     loader/PolicyChecker.cpp
</span><span class="cx">     loader/ProgressTracker.cpp
</span><ins>+    loader/ResourceBuffer.cpp
</ins><span class="cx">     loader/ResourceLoadNotifier.cpp
</span><span class="cx">     loader/ResourceLoadScheduler.cpp
</span><span class="cx">     loader/ResourceLoader.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebCore/ChangeLog        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -1,3 +1,23 @@
</span><ins>+2014-11-03  Commit Queue  &lt;commit-queue@webkit.org&gt;
+
+        Unreviewed, rolling out r175406, r175413, and r175423.
+        https://bugs.webkit.org/show_bug.cgi?id=138327
+
+        Multipart tests are still broken (Requested by ap on #webkit).
+
+        Reverted changesets:
+
+        &quot;Eliminate ResourceBuffer and use SharedBuffer directly
+        instead&quot;
+        https://bugs.webkit.org/show_bug.cgi?id=138174
+        http://trac.webkit.org/changeset/175406
+
+        &quot;Unreviewed, iOS build fix since 175406.&quot;
+        http://trac.webkit.org/changeset/175413
+
+        &quot;Fix assertion in CachedResource::addDataBuffer&quot;
+        http://trac.webkit.org/changeset/175423
+
</ins><span class="cx"> 2014-11-03  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, fix bad assertion in r175487.
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.exp.in (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.exp.in        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebCore/WebCore.exp.in        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -341,7 +341,7 @@
</span><span class="cx"> __ZN7WebCore13toJSDOMWindowEN3JSC7JSValueE
</span><span class="cx"> __ZN7WebCore14CachedResource12removeClientEPNS_20CachedResourceClientE
</span><span class="cx"> __ZN7WebCore14CachedResource16unregisterHandleEPNS_24CachedResourceHandleBaseE
</span><del>-__ZN7WebCore14CachedResource21tryReplaceEncodedDataERNS_12SharedBufferE
</del><ins>+__ZN7WebCore14CachedResource21tryReplaceEncodedDataEN3WTF10PassRefPtrINS_12SharedBufferEEE
</ins><span class="cx"> __ZN7WebCore14CachedResource9addClientEPNS_20CachedResourceClientE
</span><span class="cx"> __ZN7WebCore14ClientRectListC1ERKN3WTF6VectorINS_9FloatQuadELm0ENS1_15CrashOnOverflowEEE
</span><span class="cx"> __ZN7WebCore14ClientRectListC1Ev
</span><span class="lines">@@ -384,6 +384,13 @@
</span><span class="cx"> __ZN7WebCore14LoaderStrategy21resourceLoadSchedulerEv
</span><span class="cx"> __ZN7WebCore14LoaderStrategy25loadResourceSynchronouslyEPNS_17NetworkingContextEmRKNS_15ResourceRequestENS_17StoredCredentialsENS_22ClientCredentialPolicyERNS_13ResourceErrorERNS_16ResourceResponseERN3WTF6VectorIcLm0ENSC_15CrashOnOverflowEEE
</span><span class="cx"> __ZN7WebCore14PluginDocument12pluginWidgetEv
</span><ins>+__ZN7WebCore14ResourceBuffer12createNSDataEv
+__ZN7WebCore14ResourceBuffer6appendEPKcj
+__ZN7WebCore14ResourceBufferC1EPKcj
+__ZN7WebCore14ResourceBufferC1Ev
+__ZN7WebCore14ResourceBufferC2Ev
+__ZN7WebCore14ResourceBufferD1Ev
+__ZN7WebCore14ResourceBufferD2Ev
</ins><span class="cx"> __ZN7WebCore14ResourceHandle12firstRequestEv
</span><span class="cx"> __ZN7WebCore14ResourceHandle16setDefersLoadingEb
</span><span class="cx"> __ZN7WebCore14ResourceHandle20forceContentSniffingEv
</span><span class="lines">@@ -1724,6 +1731,9 @@
</span><span class="cx"> __ZNK7WebCore14FrameSelection36rootEditableElementOrDocumentElementEv
</span><span class="cx"> __ZNK7WebCore14InsertionPoint8isActiveEv
</span><span class="cx"> __ZNK7WebCore14RenderListItem10markerTextEv
</span><ins>+__ZNK7WebCore14ResourceBuffer4dataEv
+__ZNK7WebCore14ResourceBuffer4sizeEv
+__ZNK7WebCore14ResourceBuffer7isEmptyEv
</ins><span class="cx"> __ZNK7WebCore14ResourceHandle10connectionEv
</span><span class="cx"> __ZNK7WebCore14ResourceLoader11frameLoaderEv
</span><span class="cx"> __ZNK7WebCore14ResourceLoader32isAllowedToAskUserForCredentialsEv
</span><span class="lines">@@ -2796,6 +2806,7 @@
</span><span class="cx"> __ZNK7WebCore14FrameSelection32rangeByExtendingCurrentSelectionEi
</span><span class="cx"> __ZNK7WebCore14FrameSelection35characterInRelationToCaretSelectionEi
</span><span class="cx"> __ZNK7WebCore14FrameSelection36elementRangeContainingCaretSelectionEv
</span><ins>+__ZNK7WebCore14ResourceBuffer12sharedBufferEv
</ins><span class="cx"> __ZNK7WebCore14SecurityOrigin8toStringEv
</span><span class="cx"> __ZNK7WebCore15GraphicsLayerCA21contentsLayerForMediaEv
</span><span class="cx"> __ZNK7WebCore15VisiblePosition4leftEb
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorevcxprojWebCorevcxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -7251,6 +7251,7 @@
</span><span class="cx">     &lt;ClCompile Include=&quot;..\loader\PolicyCallback.cpp&quot; /&gt;
</span><span class="cx">     &lt;ClCompile Include=&quot;..\loader\PolicyChecker.cpp&quot; /&gt;
</span><span class="cx">     &lt;ClCompile Include=&quot;..\loader\ProgressTracker.cpp&quot; /&gt;
</span><ins>+    &lt;ClCompile Include=&quot;..\loader\ResourceBuffer.cpp&quot; /&gt;
</ins><span class="cx">     &lt;ClCompile Include=&quot;..\loader\ResourceLoader.cpp&quot; /&gt;
</span><span class="cx">     &lt;ClCompile Include=&quot;..\loader\cf\ResourceLoaderCFNet.cpp&quot; /&gt;
</span><span class="cx">     &lt;ClCompile Include=&quot;..\loader\ResourceLoadNotifier.cpp&quot; /&gt;
</span><span class="lines">@@ -19253,6 +19254,7 @@
</span><span class="cx">     &lt;ClInclude Include=&quot;..\loader\PolicyChecker.h&quot; /&gt;
</span><span class="cx">     &lt;ClInclude Include=&quot;..\loader\ProgressTracker.h&quot; /&gt;
</span><span class="cx">     &lt;ClInclude Include=&quot;..\loader\ProgressTrackerClient.h&quot; /&gt;
</span><ins>+    &lt;ClInclude Include=&quot;..\loader\ResourceBuffer.h&quot; /&gt;
</ins><span class="cx">     &lt;ClInclude Include=&quot;..\loader\ResourceLoader.h&quot; /&gt;
</span><span class="cx">     &lt;ClInclude Include=&quot;..\loader\ResourceLoaderOptions.h&quot; /&gt;
</span><span class="cx">     &lt;ClInclude Include=&quot;..\loader\ResourceLoadNotifier.h&quot; /&gt;
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorevcxprojWebCorevcxprojfilters"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -927,6 +927,9 @@
</span><span class="cx">     &lt;ClCompile Include=&quot;..\loader\ProgressTracker.cpp&quot;&gt;
</span><span class="cx">       &lt;Filter&gt;loader&lt;/Filter&gt;
</span><span class="cx">     &lt;/ClCompile&gt;
</span><ins>+    &lt;ClCompile Include=&quot;..\loader\ResourceBuffer.cpp&quot;&gt;
+      &lt;Filter&gt;loader&lt;/Filter&gt;
+    &lt;/ClCompile&gt;
</ins><span class="cx">     &lt;ClCompile Include=&quot;..\loader\ResourceLoader.cpp&quot;&gt;
</span><span class="cx">       &lt;Filter&gt;loader&lt;/Filter&gt;
</span><span class="cx">     &lt;/ClCompile&gt;
</span><span class="lines">@@ -7947,6 +7950,9 @@
</span><span class="cx">     &lt;ClInclude Include=&quot;..\loader\ProgressTrackerClient.h&quot;&gt;
</span><span class="cx">       &lt;Filter&gt;loader&lt;/Filter&gt;
</span><span class="cx">     &lt;/ClInclude&gt;
</span><ins>+    &lt;ClInclude Include=&quot;..\loader\ResourceBuffer.h&quot;&gt;
+      &lt;Filter&gt;loader&lt;/Filter&gt;
+    &lt;/ClInclude&gt;
</ins><span class="cx">     &lt;ClInclude Include=&quot;..\loader\ResourceLoader.h&quot;&gt;
</span><span class="cx">       &lt;Filter&gt;loader&lt;/Filter&gt;
</span><span class="cx">     &lt;/ClInclude&gt;
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -1868,6 +1868,9 @@
</span><span class="cx">                 51405C89190B014400754F94 /* SelectionRectGatherer.h in Headers */ = {isa = PBXBuildFile; fileRef = 51405C87190B014400754F94 /* SelectionRectGatherer.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 514B3F730C722047000530DF /* FileSystem.h in Headers */ = {isa = PBXBuildFile; fileRef = 514B3F720C722047000530DF /* FileSystem.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 514B3F760C722055000530DF /* FileSystemMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 514B3F750C722055000530DF /* FileSystemMac.mm */; };
</span><ins>+                514BC83F161CF04A004D52F4 /* ResourceBuffer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 514BC83D161CF043004D52F4 /* ResourceBuffer.mm */; };
+                514BC842161CF05C004D52F4 /* ResourceBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 514BC840161CF05C004D52F4 /* ResourceBuffer.cpp */; };
+                514BC843161CF05C004D52F4 /* ResourceBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 514BC841161CF05C004D52F4 /* ResourceBuffer.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 514C76370CE9225E007EF3CD /* JSSQLError.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 514C76350CE9225E007EF3CD /* JSSQLError.cpp */; };
</span><span class="cx">                 514C76380CE9225E007EF3CD /* JSSQLTransaction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 514C76360CE9225E007EF3CD /* JSSQLTransaction.cpp */; };
</span><span class="cx">                 514C764C0CE9234E007EF3CD /* AuthenticationMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 514C76420CE9234E007EF3CD /* AuthenticationMac.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -8977,6 +8980,9 @@
</span><span class="cx">                 51405C87190B014400754F94 /* SelectionRectGatherer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SelectionRectGatherer.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 514B3F720C722047000530DF /* FileSystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileSystem.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 514B3F750C722055000530DF /* FileSystemMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FileSystemMac.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                514BC83D161CF043004D52F4 /* ResourceBuffer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ResourceBuffer.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
+                514BC840161CF05C004D52F4 /* ResourceBuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResourceBuffer.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                514BC841161CF05C004D52F4 /* ResourceBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceBuffer.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 514C76350CE9225E007EF3CD /* JSSQLError.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSQLError.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 514C76360CE9225E007EF3CD /* JSSQLTransaction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSQLTransaction.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 514C76420CE9234E007EF3CD /* AuthenticationMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AuthenticationMac.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -17624,6 +17630,7 @@
</span><span class="cx">                                 1C2649790D7E248A00BD10F2 /* DocumentLoaderMac.cpp */,
</span><span class="cx">                                 656D371A0ADBA5DE00A4554D /* LoaderNSURLExtras.h */,
</span><span class="cx">                                 656D371B0ADBA5DE00A4554D /* LoaderNSURLExtras.mm */,
</span><ins>+                                514BC83D161CF043004D52F4 /* ResourceBuffer.mm */,
</ins><span class="cx">                                 51AA3F6E0BD5AA9E00892971 /* ResourceLoaderMac.mm */,
</span><span class="cx">                         );
</span><span class="cx">                         path = mac;
</span><span class="lines">@@ -21291,6 +21298,8 @@
</span><span class="cx">                                 1A2A68210B5BEDE70002A480 /* ProgressTracker.cpp */,
</span><span class="cx">                                 1A2A68220B5BEDE70002A480 /* ProgressTracker.h */,
</span><span class="cx">                                 1ACADD781880D91C00D8B71D /* ProgressTrackerClient.h */,
</span><ins>+                                514BC840161CF05C004D52F4 /* ResourceBuffer.cpp */,
+                                514BC841161CF05C004D52F4 /* ResourceBuffer.h */,
</ins><span class="cx">                                 93E227DE0AF589AD00D48324 /* ResourceLoader.cpp */,
</span><span class="cx">                                 656D37270ADBA5DE00A4554D /* ResourceLoader.h */,
</span><span class="cx">                                 D0A3A7301405A39800FB8ED3 /* ResourceLoaderOptions.h */,
</span><span class="lines">@@ -25853,6 +25862,7 @@
</span><span class="cx">                                 99CC0B5C18BE984A006CEBCC /* ReplaySessionSegment.h in Headers */,
</span><span class="cx">                                 4998AEC613F9D0EA0090B1AA /* RequestAnimationFrameCallback.h in Headers */,
</span><span class="cx">                                 F55B3DD01251F12D003EF269 /* ResetInputType.h in Headers */,
</span><ins>+                                514BC843161CF05C004D52F4 /* ResourceBuffer.h in Headers */,
</ins><span class="cx">                                 7EE6846A12D26E3800E79415 /* ResourceError.h in Headers */,
</span><span class="cx">                                 934F713C0D5A6F1900018D69 /* ResourceErrorBase.h in Headers */,
</span><span class="cx">                                 514C76790CE923A1007EF3CD /* ResourceHandle.h in Headers */,
</span><span class="lines">@@ -29320,6 +29330,8 @@
</span><span class="cx">                                 99CC0B5918BE984A006CEBCC /* ReplaySession.cpp in Sources */,
</span><span class="cx">                                 99CC0B5B18BE984A006CEBCC /* ReplaySessionSegment.cpp in Sources */,
</span><span class="cx">                                 F55B3DCF1251F12D003EF269 /* ResetInputType.cpp in Sources */,
</span><ins>+                                514BC842161CF05C004D52F4 /* ResourceBuffer.cpp in Sources */,
+                                514BC83F161CF04A004D52F4 /* ResourceBuffer.mm in Sources */,
</ins><span class="cx">                                 934F713E0D5A6F2800018D69 /* ResourceErrorBase.cpp in Sources */,
</span><span class="cx">                                 7EE6846B12D26E3800E79415 /* ResourceErrorCF.cpp in Sources */,
</span><span class="cx">                                 514C76500CE9234E007EF3CD /* ResourceErrorMac.mm in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsobjcDOMUIKitExtensionsmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/objc/DOMUIKitExtensions.mm (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/objc/DOMUIKitExtensions.mm        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebCore/bindings/objc/DOMUIKitExtensions.mm        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -62,6 +62,7 @@
</span><span class="cx"> #import &quot;RenderObject.h&quot;
</span><span class="cx"> #import &quot;RenderStyleConstants.h&quot;
</span><span class="cx"> #import &quot;RenderText.h&quot;
</span><ins>+#import &quot;ResourceBuffer.h&quot;
</ins><span class="cx"> #import &quot;SharedBuffer.h&quot;
</span><span class="cx"> #import &quot;VisiblePosition.h&quot;
</span><span class="cx"> #import &quot;VisibleUnits.h&quot;
</span><span class="lines">@@ -463,15 +464,23 @@
</span><span class="cx"> 
</span><span class="cx"> - (NSData *)dataRepresentation:(BOOL)rawImageData
</span><span class="cx"> {
</span><del>-    WebCore::CachedImage* cachedImage = core(self)-&gt;cachedImage();
</del><ins>+    WebCore::CachedImage *cachedImage = core(self)-&gt;cachedImage();
</ins><span class="cx">     if (!cachedImage)
</span><span class="cx">         return nil;
</span><del>-    WebCore::Image* image = cachedImage-&gt;image();
</del><ins>+    WebCore::Image *image = cachedImage-&gt;image();
</ins><span class="cx">     if (!image)
</span><span class="cx">         return nil;
</span><del>-    WebCore::SharedBuffer* data = rawImageData ? cachedImage-&gt;resourceBuffer() : image-&gt;data();
</del><ins>+    WebCore::SharedBuffer *data = nil;
+    if (rawImageData) {
+        ResourceBuffer *resourceBuffer = cachedImage-&gt;resourceBuffer();
+        if (resourceBuffer)
+            data = resourceBuffer-&gt;sharedBuffer();
+    } else {
+        data = image-&gt;data();
+    }
</ins><span class="cx">     if (!data)
</span><span class="cx">         return nil;
</span><ins>+
</ins><span class="cx">     return data-&gt;createNSData().autorelease();
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingiosEditorIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/ios/EditorIOS.mm (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/ios/EditorIOS.mm        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebCore/editing/ios/EditorIOS.mm        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -49,6 +49,7 @@
</span><span class="cx"> #include &quot;Pasteboard.h&quot;
</span><span class="cx"> #include &quot;RenderBlock.h&quot;
</span><span class="cx"> #include &quot;RenderImage.h&quot;
</span><ins>+#include &quot;ResourceBuffer.h&quot;
</ins><span class="cx"> #include &quot;SharedBuffer.h&quot;
</span><span class="cx"> #include &quot;SoftLinking.h&quot;
</span><span class="cx"> #include &quot;StyleProperties.h&quot;
</span><span class="lines">@@ -384,7 +385,7 @@
</span><span class="cx">     pasteboardImage.url.url = imageElement.document().completeURL(stripLeadingAndTrailingHTMLSpaces(imageElement.imageSourceURL()));
</span><span class="cx">     pasteboardImage.url.title = title;
</span><span class="cx">     pasteboardImage.resourceMIMEType = pasteboard.resourceMIMEType(cachedImage-&gt;response().mimeType());
</span><del>-    pasteboardImage.resourceData = cachedImage-&gt;resourceBuffer();
</del><ins>+    pasteboardImage.resourceData = cachedImage-&gt;resourceBuffer()-&gt;sharedBuffer();
</ins><span class="cx"> 
</span><span class="cx">     pasteboard.write(pasteboardImage);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingmacEditorMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/mac/EditorMac.mm (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/mac/EditorMac.mm        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebCore/editing/mac/EditorMac.mm        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -52,6 +52,7 @@
</span><span class="cx"> #import &quot;Range.h&quot;
</span><span class="cx"> #import &quot;RenderBlock.h&quot;
</span><span class="cx"> #import &quot;RenderImage.h&quot;
</span><ins>+#import &quot;ResourceBuffer.h&quot;
</ins><span class="cx"> #import &quot;RuntimeApplicationChecks.h&quot;
</span><span class="cx"> #import &quot;Sound.h&quot;
</span><span class="cx"> #import &quot;StyleProperties.h&quot;
</span><span class="lines">@@ -446,7 +447,7 @@
</span><span class="cx">     pasteboardImage.url.url = url;
</span><span class="cx">     pasteboardImage.url.title = title;
</span><span class="cx">     pasteboardImage.url.userVisibleForm = client()-&gt;userVisibleString(pasteboardImage.url.url);
</span><del>-    pasteboardImage.resourceData = cachedImage-&gt;resourceBuffer();
</del><ins>+    pasteboardImage.resourceData = cachedImage-&gt;resourceBuffer()-&gt;sharedBuffer();
</ins><span class="cx">     pasteboardImage.resourceMIMEType = cachedImage-&gt;response().mimeType();
</span><span class="cx"> 
</span><span class="cx">     pasteboard.write(pasteboardImage);
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlImageDocumentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/ImageDocument.cpp (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/ImageDocument.cpp        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebCore/html/ImageDocument.cpp        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -45,6 +45,7 @@
</span><span class="cx"> #include &quot;Page.h&quot;
</span><span class="cx"> #include &quot;RawDataDocumentParser.h&quot;
</span><span class="cx"> #include &quot;RenderElement.h&quot;
</span><ins>+#include &quot;ResourceBuffer.h&quot;
</ins><span class="cx"> #include &quot;Settings.h&quot;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -133,8 +134,7 @@
</span><span class="cx">     if (!m_imageElement)
</span><span class="cx">         createDocumentStructure();
</span><span class="cx"> 
</span><del>-    if (RefPtr&lt;SharedBuffer&gt; buffer = loader()-&gt;mainResourceData())
-        m_imageElement-&gt;cachedImage()-&gt;addDataBuffer(*buffer);
</del><ins>+    m_imageElement-&gt;cachedImage()-&gt;addDataBuffer(loader()-&gt;mainResourceData().get());
</ins><span class="cx"> 
</span><span class="cx">     imageUpdated();
</span><span class="cx"> }
</span><span class="lines">@@ -143,11 +143,11 @@
</span><span class="cx"> {
</span><span class="cx">     if (!parser()-&gt;isStopped() &amp;&amp; m_imageElement) {
</span><span class="cx">         CachedImage&amp; cachedImage = *m_imageElement-&gt;cachedImage();
</span><del>-        RefPtr&lt;SharedBuffer&gt; data = loader()-&gt;mainResourceData();
</del><ins>+        RefPtr&lt;ResourceBuffer&gt; data = loader()-&gt;mainResourceData();
</ins><span class="cx"> 
</span><span class="cx">         // If this is a multipart image, make a copy of the current part, since the resource data
</span><span class="cx">         // will be overwritten by the next part.
</span><del>-        if (data &amp;&amp; loader()-&gt;isLoadingMultipartContent())
</del><ins>+        if (loader()-&gt;isLoadingMultipartContent())
</ins><span class="cx">             data = data-&gt;copy();
</span><span class="cx"> 
</span><span class="cx">         cachedImage.finishLoading(data.get());
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorPageAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorPageAgent.cpp (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorPageAgent.cpp        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebCore/inspector/InspectorPageAgent.cpp        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -62,6 +62,7 @@
</span><span class="cx"> #include &quot;MainFrame.h&quot;
</span><span class="cx"> #include &quot;MemoryCache.h&quot;
</span><span class="cx"> #include &quot;Page.h&quot;
</span><ins>+#include &quot;ResourceBuffer.h&quot;
</ins><span class="cx"> #include &quot;ScriptController.h&quot;
</span><span class="cx"> #include &quot;SecurityOrigin.h&quot;
</span><span class="cx"> #include &quot;Settings.h&quot;
</span><span class="lines">@@ -142,9 +143,11 @@
</span><span class="cx"> 
</span><span class="cx">     *base64Encoded = !hasTextContent(cachedResource);
</span><span class="cx">     if (*base64Encoded) {
</span><del>-        RefPtr&lt;SharedBuffer&gt; buffer = hasZeroSize ? SharedBuffer::create() : cachedResource-&gt;resourceBuffer();
</del><ins>+        RefPtr&lt;SharedBuffer&gt; buffer = hasZeroSize ? SharedBuffer::create() : cachedResource-&gt;resourceBuffer()-&gt;sharedBuffer();
+
</ins><span class="cx">         if (!buffer)
</span><span class="cx">             return false;
</span><ins>+
</ins><span class="cx">         *result = base64Encode(buffer-&gt;data(), buffer-&gt;size());
</span><span class="cx">         return true;
</span><span class="cx">     }
</span><span class="lines">@@ -163,7 +166,7 @@
</span><span class="cx">             *result = downcast&lt;CachedScript&gt;(*cachedResource).script();
</span><span class="cx">             return true;
</span><span class="cx">         case CachedResource::RawResource: {
</span><del>-            auto* buffer = cachedResource-&gt;resourceBuffer();
</del><ins>+            ResourceBuffer* buffer = cachedResource-&gt;resourceBuffer();
</ins><span class="cx">             if (!buffer)
</span><span class="cx">                 return false;
</span><span class="cx">             RefPtr&lt;TextResourceDecoder&gt; decoder = createXHRTextDecoder(cachedResource-&gt;response().mimeType(), cachedResource-&gt;response().textEncodingName());
</span><span class="lines">@@ -174,7 +177,7 @@
</span><span class="cx">             return true;
</span><span class="cx">         }
</span><span class="cx">         default:
</span><del>-            auto* buffer = cachedResource-&gt;resourceBuffer();
</del><ins>+            ResourceBuffer* buffer = cachedResource-&gt;resourceBuffer();
</ins><span class="cx">             return decodeBuffer(buffer ? buffer-&gt;data() : nullptr, buffer ? buffer-&gt;size() : 0, cachedResource-&gt;encoding(), result);
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="lines">@@ -183,10 +186,12 @@
</span><span class="cx"> 
</span><span class="cx"> bool InspectorPageAgent::mainResourceContent(Frame* frame, bool withBase64Encode, String* result)
</span><span class="cx"> {
</span><del>-    RefPtr&lt;SharedBuffer&gt; buffer = frame-&gt;loader().documentLoader()-&gt;mainResourceData();
</del><ins>+    RefPtr&lt;ResourceBuffer&gt; buffer = frame-&gt;loader().documentLoader()-&gt;mainResourceData();
</ins><span class="cx">     if (!buffer)
</span><span class="cx">         return false;
</span><del>-    return InspectorPageAgent::dataContent(buffer-&gt;data(), buffer-&gt;size(), frame-&gt;document()-&gt;inputEncoding(), withBase64Encode, result);
</del><ins>+    String textEncodingName = frame-&gt;document()-&gt;inputEncoding();
+
+    return InspectorPageAgent::dataContent(buffer-&gt;data(), buffer-&gt;size(), textEncodingName, withBase64Encode, result);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> // static
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorResourceAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorResourceAgent.cpp (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorResourceAgent.cpp        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebCore/inspector/InspectorResourceAgent.cpp        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -54,6 +54,7 @@
</span><span class="cx"> #include &quot;NetworkResourcesData.h&quot;
</span><span class="cx"> #include &quot;Page.h&quot;
</span><span class="cx"> #include &quot;ProgressTracker.h&quot;
</span><ins>+#include &quot;ResourceBuffer.h&quot;
</ins><span class="cx"> #include &quot;ResourceError.h&quot;
</span><span class="cx"> #include &quot;ResourceLoader.h&quot;
</span><span class="cx"> #include &quot;ResourceRequest.h&quot;
</span><span class="lines">@@ -404,9 +405,8 @@
</span><span class="cx"> 
</span><span class="cx">     String requestId = IdentifiersFactory::requestId(identifier);
</span><span class="cx">     if (m_resourcesData-&gt;resourceType(requestId) == InspectorPageAgent::DocumentResource) {
</span><del>-        m_resourcesData-&gt;addResourceSharedBuffer(requestId,
-            loader-&gt;frameLoader()-&gt;documentLoader()-&gt;mainResourceData(),
-            loader-&gt;frame()-&gt;document()-&gt;inputEncoding());
</del><ins>+        RefPtr&lt;ResourceBuffer&gt; buffer = loader-&gt;frameLoader()-&gt;documentLoader()-&gt;mainResourceData();
+        m_resourcesData-&gt;addResourceSharedBuffer(requestId, buffer ? buffer-&gt;sharedBuffer() : nullptr, loader-&gt;frame()-&gt;document()-&gt;inputEncoding());
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     m_resourcesData-&gt;maybeDecodeDataToContent(requestId);
</span><span class="lines">@@ -435,9 +435,8 @@
</span><span class="cx">     if (m_resourcesData-&gt;resourceType(requestId) == InspectorPageAgent::DocumentResource) {
</span><span class="cx">         Frame* frame = loader ? loader-&gt;frame() : nullptr;
</span><span class="cx">         if (frame &amp;&amp; frame-&gt;loader().documentLoader() &amp;&amp; frame-&gt;document()) {
</span><del>-            m_resourcesData-&gt;addResourceSharedBuffer(requestId,
-                frame-&gt;loader().documentLoader()-&gt;mainResourceData(),
-                frame-&gt;document()-&gt;inputEncoding());
</del><ins>+            RefPtr&lt;ResourceBuffer&gt; buffer = frame-&gt;loader().documentLoader()-&gt;mainResourceData();
+            m_resourcesData-&gt;addResourceSharedBuffer(requestId, buffer ? buffer-&gt;sharedBuffer() : nullptr, frame-&gt;document()-&gt;inputEncoding());
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderDocumentLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/DocumentLoader.cpp (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/DocumentLoader.cpp        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebCore/loader/DocumentLoader.cpp        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -56,6 +56,7 @@
</span><span class="cx"> #include &quot;Page.h&quot;
</span><span class="cx"> #include &quot;PolicyChecker.h&quot;
</span><span class="cx"> #include &quot;ProgressTracker.h&quot;
</span><ins>+#include &quot;ResourceBuffer.h&quot;
</ins><span class="cx"> #include &quot;ResourceHandle.h&quot;
</span><span class="cx"> #include &quot;SchemeRegistry.h&quot;
</span><span class="cx"> #include &quot;SecurityPolicy.h&quot;
</span><span class="lines">@@ -170,20 +171,20 @@
</span><span class="cx">     clearMainResource();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-PassRefPtr&lt;SharedBuffer&gt; DocumentLoader::mainResourceData() const
</del><ins>+PassRefPtr&lt;ResourceBuffer&gt; DocumentLoader::mainResourceData() const
</ins><span class="cx"> {
</span><span class="cx">     if (m_substituteData.isValid())
</span><del>-        return m_substituteData.content()-&gt;copy();
</del><ins>+        return ResourceBuffer::create(m_substituteData.content()-&gt;data(), m_substituteData.content()-&gt;size());
</ins><span class="cx">     if (m_mainResource)
</span><span class="cx">         return m_mainResource-&gt;resourceBuffer();
</span><del>-    return nullptr;
</del><ins>+    return 0;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Document* DocumentLoader::document() const
</span><span class="cx"> {
</span><span class="cx">     if (m_frame &amp;&amp; m_frame-&gt;loader().documentLoader() == this)
</span><span class="cx">         return m_frame-&gt;document();
</span><del>-    return nullptr;
</del><ins>+    return 0;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> const ResourceRequest&amp; DocumentLoader::originalRequest() const
</span><span class="lines">@@ -993,7 +994,8 @@
</span><span class="cx"> #else
</span><span class="cx">     
</span><span class="cx">     // Give the archive machinery a crack at this document. If the MIME type is not an archive type, it will return 0.
</span><del>-    m_archive = ArchiveFactory::create(m_response.url(), mainResourceData().get(), m_response.mimeType());
</del><ins>+    RefPtr&lt;ResourceBuffer&gt; mainResourceBuffer = mainResourceData();
+    m_archive = ArchiveFactory::create(m_response.url(), mainResourceBuffer ? mainResourceBuffer-&gt;sharedBuffer() : 0, m_response.mimeType());
</ins><span class="cx">     if (!m_archive)
</span><span class="cx">         return false;
</span><span class="cx">     
</span><span class="lines">@@ -1009,7 +1011,6 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(WEB_ARCHIVE) || ENABLE(MHTML)
</span><del>-
</del><span class="cx"> void DocumentLoader::setArchive(PassRefPtr&lt;Archive&gt; archive)
</span><span class="cx"> {
</span><span class="cx">     m_archive = archive;
</span><span class="lines">@@ -1057,46 +1058,47 @@
</span><span class="cx"> {
</span><span class="cx">     return m_parsedArchiveData.get();
</span><span class="cx"> }
</span><del>-
</del><span class="cx"> #endif // ENABLE(WEB_ARCHIVE) || ENABLE(MHTML)
</span><span class="cx"> 
</span><span class="cx"> ArchiveResource* DocumentLoader::archiveResourceForURL(const URL&amp; url) const
</span><span class="cx"> {
</span><span class="cx">     if (!m_archiveResourceCollection)
</span><del>-        return nullptr;
</del><ins>+        return 0;
+        
</ins><span class="cx">     ArchiveResource* resource = m_archiveResourceCollection-&gt;archiveResourceForURL(url);
</span><del>-    if (!resource || resource-&gt;shouldIgnoreWhenUnarchiving())
-        return nullptr;
-    return resource;
</del><ins>+
+    return resource &amp;&amp; !resource-&gt;shouldIgnoreWhenUnarchiving() ? resource : 0;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> PassRefPtr&lt;ArchiveResource&gt; DocumentLoader::mainResource() const
</span><span class="cx"> {
</span><del>-    RefPtr&lt;SharedBuffer&gt; data = mainResourceData();
</del><ins>+    const ResourceResponse&amp; r = response();
+    
+    RefPtr&lt;ResourceBuffer&gt; mainResourceBuffer = mainResourceData();
+    RefPtr&lt;SharedBuffer&gt; data = mainResourceBuffer ? mainResourceBuffer-&gt;sharedBuffer() : 0;
</ins><span class="cx">     if (!data)
</span><span class="cx">         data = SharedBuffer::create();
</span><span class="cx">         
</span><del>-    auto&amp; response = this-&gt;response();
-    return ArchiveResource::create(data, response.url(), response.mimeType(), response.textEncodingName(), frame()-&gt;tree().uniqueName());
</del><ins>+    return ArchiveResource::create(data, r.url(), r.mimeType(), r.textEncodingName(), frame()-&gt;tree().uniqueName());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> PassRefPtr&lt;ArchiveResource&gt; DocumentLoader::subresource(const URL&amp; url) const
</span><span class="cx"> {
</span><span class="cx">     if (!isCommitted())
</span><del>-        return nullptr;
</del><ins>+        return 0;
</ins><span class="cx">     
</span><span class="cx">     CachedResource* resource = m_cachedResourceLoader-&gt;cachedResource(url);
</span><span class="cx">     if (!resource || !resource-&gt;isLoaded())
</span><span class="cx">         return archiveResourceForURL(url);
</span><span class="cx"> 
</span><span class="cx">     if (resource-&gt;type() == CachedResource::MainResource)
</span><del>-        return nullptr;
</del><ins>+        return 0;
</ins><span class="cx"> 
</span><del>-    auto* data = resource-&gt;resourceBuffer();
</del><ins>+    ResourceBuffer* data = resource-&gt;resourceBuffer();
</ins><span class="cx">     if (!data)
</span><del>-        return nullptr;
</del><ins>+        return 0;
</ins><span class="cx"> 
</span><del>-    return ArchiveResource::create(data, url, resource-&gt;response());
</del><ins>+    return ArchiveResource::create(data-&gt;sharedBuffer(), url, resource-&gt;response());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Vector&lt;RefPtr&lt;ArchiveResource&gt;&gt; DocumentLoader::subresources() const
</span><span class="lines">@@ -1509,7 +1511,7 @@
</span><span class="cx"> 
</span><span class="cx">     frameLoader()-&gt;setupForReplace();
</span><span class="cx">     m_committed = false;
</span><del>-    RefPtr&lt;SharedBuffer&gt; resourceData = mainResourceData();
</del><ins>+    RefPtr&lt;ResourceBuffer&gt; resourceData = mainResourceData();
</ins><span class="cx">     commitLoad(resourceData-&gt;data(), resourceData-&gt;size());
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderDocumentLoaderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/DocumentLoader.h (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/DocumentLoader.h        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebCore/loader/DocumentLoader.h        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -68,6 +68,7 @@
</span><span class="cx">     class Frame;
</span><span class="cx">     class FrameLoader;
</span><span class="cx">     class Page;
</span><ins>+    class ResourceBuffer;
</ins><span class="cx">     class ResourceLoader;
</span><span class="cx">     class SharedBuffer;
</span><span class="cx">     class SubstituteResource;
</span><span class="lines">@@ -92,7 +93,7 @@
</span><span class="cx"> 
</span><span class="cx">         WEBCORE_EXPORT FrameLoader* frameLoader() const;
</span><span class="cx">         WEBCORE_EXPORT ResourceLoader* mainResourceLoader() const;
</span><del>-        WEBCORE_EXPORT PassRefPtr&lt;SharedBuffer&gt; mainResourceData() const;
</del><ins>+        WEBCORE_EXPORT PassRefPtr&lt;ResourceBuffer&gt; mainResourceData() const;
</ins><span class="cx">         
</span><span class="cx">         DocumentWriter&amp; writer() const { return m_writer; }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderMediaResourceLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/MediaResourceLoader.cpp (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/MediaResourceLoader.cpp        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebCore/loader/MediaResourceLoader.cpp        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -27,12 +27,12 @@
</span><span class="cx"> #include &quot;MediaResourceLoader.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(VIDEO)
</span><del>-
</del><span class="cx"> #include &quot;CachedRawResource.h&quot;
</span><span class="cx"> #include &quot;CachedResourceLoader.h&quot;
</span><span class="cx"> #include &quot;CachedResourceRequest.h&quot;
</span><span class="cx"> #include &quot;CrossOriginAccessControl.h&quot;
</span><span class="cx"> #include &quot;Document.h&quot;
</span><ins>+#include &quot;ResourceBuffer.h&quot;
</ins><span class="cx"> #include &quot;SecurityOrigin.h&quot;
</span><span class="cx"> #include &lt;wtf/NeverDestroyed.h&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -112,10 +112,13 @@
</span><span class="cx"> 
</span><span class="cx"> void MediaResourceLoader::dataReceived(CachedResource* resource, const char* data, int dataLength)
</span><span class="cx"> {
</span><del>-    ASSERT_UNUSED(resource, resource == m_resource);
</del><ins>+    ASSERT(resource == m_resource);
</ins><span class="cx"> 
</span><span class="cx">     RefPtr&lt;MediaResourceLoader&gt; protect(this);
</span><span class="cx">     m_client-&gt;dataReceived(data, dataLength);
</span><ins>+
+    if (SharedBuffer* buffer = resource-&gt;resourceBuffer() ? resource-&gt;resourceBuffer()-&gt;sharedBuffer() : nullptr)
+        m_client-&gt;bufferReceived(buffer);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void MediaResourceLoader::notifyFinished(CachedResource* resource)
</span><span class="lines">@@ -126,7 +129,7 @@
</span><span class="cx">     if (resource-&gt;loadFailedOrCanceled())
</span><span class="cx">         m_client-&gt;loadFailed(resource-&gt;resourceError());
</span><span class="cx">     else
</span><del>-        m_client-&gt;loadFinished();
</del><ins>+        m_client-&gt;loadFinished(resource-&gt;resourceBuffer() ? resource-&gt;resourceBuffer()-&gt;sharedBuffer() : nullptr);
</ins><span class="cx">     stop();
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderResourceBuffercpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/loader/ResourceBuffer.cpp (0 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/ResourceBuffer.cpp                                (rev 0)
+++ trunk/Source/WebCore/loader/ResourceBuffer.cpp        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -0,0 +1,122 @@
</span><ins>+/*
+ * Copyright (C) 2012 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. ``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
+ * 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;ResourceBuffer.h&quot;
+
+#include &quot;SharedBuffer.h&quot;
+
+namespace WebCore {
+
+ResourceBuffer::ResourceBuffer()
+    : m_sharedBuffer(SharedBuffer::create())
+{
+}
+
+ResourceBuffer::ResourceBuffer(const char* data, unsigned size)
+    : m_sharedBuffer(SharedBuffer::create(data, size))
+{
+}
+
+ResourceBuffer::ResourceBuffer(PassRefPtr&lt;SharedBuffer&gt; sharedBuffer)
+    : m_sharedBuffer(sharedBuffer)
+{
+    ASSERT(m_sharedBuffer);
+}
+    
+ResourceBuffer::~ResourceBuffer()
+{
+}
+
+PassRefPtr&lt;ResourceBuffer&gt; ResourceBuffer::adoptSharedBuffer(PassRefPtr&lt;SharedBuffer&gt; shared)
+{
+    return shared ? adoptRef(new ResourceBuffer(shared)) : nullptr;
+}
+
+const char* ResourceBuffer::data() const
+{
+    return m_sharedBuffer-&gt;data();
+}
+
+unsigned ResourceBuffer::size() const
+{
+    return m_sharedBuffer-&gt;size();
+}
+
+bool ResourceBuffer::isEmpty() const
+{
+    return m_sharedBuffer-&gt;isEmpty();
+}
+
+void ResourceBuffer::append(const char* data, unsigned size)
+{
+    m_sharedBuffer-&gt;append(data, size);
+}
+
+void ResourceBuffer::append(SharedBuffer* buffer)
+{
+    m_sharedBuffer-&gt;append(buffer);
+}
+
+#if USE(NETWORK_CFDATA_ARRAY_CALLBACK)
+void ResourceBuffer::append(CFDataRef data)
+{
+    ASSERT(m_sharedBuffer);
+    m_sharedBuffer-&gt;append(data);
+}
+#endif
+
+void ResourceBuffer::clear()
+{
+    m_sharedBuffer-&gt;clear();
+}
+
+unsigned ResourceBuffer::getSomeData(const char*&amp; data, unsigned position) const
+{
+    return m_sharedBuffer-&gt;getSomeData(data, position);
+}
+
+SharedBuffer* ResourceBuffer::sharedBuffer() const
+{
+    // Currently all ResourceBuffers are backed by SharedBuffers.
+    // In the future we might have to create the SharedBuffer on demand here.
+    // We should also phase out as much use of this accessor as possible and have clients
+    // either use the ResourceBuffer directly or use getSomeData() when sensical.
+    return m_sharedBuffer.get();
+}
+
+PassRefPtr&lt;ResourceBuffer&gt; ResourceBuffer::copy() const
+{
+    return ResourceBuffer::adoptSharedBuffer(m_sharedBuffer-&gt;copy());
+}
+
+#if USE(CF)
+RetainPtr&lt;CFDataRef&gt; ResourceBuffer::createCFData()
+{
+    return m_sharedBuffer-&gt;createCFData();
+}
+#endif
+
+} // namespace WebCore
</ins></span></pre></div>
<a id="trunkSourceWebCoreloaderResourceBufferh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/loader/ResourceBuffer.h (0 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/ResourceBuffer.h                                (rev 0)
+++ trunk/Source/WebCore/loader/ResourceBuffer.h        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -0,0 +1,89 @@
</span><ins>+/*
+ * Copyright (C) 2012 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. ``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
+ * 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 ResourceBuffer_h
+#define ResourceBuffer_h
+
+#include &lt;wtf/PassRefPtr.h&gt;
+#include &lt;wtf/RefCounted.h&gt;
+#include &lt;wtf/RefPtr.h&gt;
+#include &lt;wtf/RetainPtr.h&gt;
+
+#if USE(FOUNDATION)
+OBJC_CLASS NSData;
+#endif
+
+namespace WebCore {
+
+class SharedBuffer;
+
+class ResourceBuffer : public RefCounted&lt;ResourceBuffer&gt; {
+public:
+
+    static PassRefPtr&lt;ResourceBuffer&gt; create() { return adoptRef(new ResourceBuffer); }
+    static PassRefPtr&lt;ResourceBuffer&gt; create(const char* data, unsigned size) { return adoptRef(new ResourceBuffer(data, size)); }
+    static PassRefPtr&lt;ResourceBuffer&gt; adoptSharedBuffer(PassRefPtr&lt;SharedBuffer&gt;);
+
+    WEBCORE_EXPORT virtual ~ResourceBuffer();
+
+    WEBCORE_EXPORT virtual const char* data() const;
+    WEBCORE_EXPORT virtual unsigned size() const;
+    WEBCORE_EXPORT virtual bool isEmpty() const;
+
+    WEBCORE_EXPORT void append(const char*, unsigned);
+    void append(SharedBuffer*);
+#if USE(NETWORK_CFDATA_ARRAY_CALLBACK)
+    void append(CFDataRef);
+#endif
+    void clear();
+    
+    unsigned getSomeData(const char*&amp; data, unsigned position = 0) const;
+    
+    WEBCORE_EXPORT SharedBuffer* sharedBuffer() const;
+#if USE(FOUNDATION)
+    void tryReplaceSharedBufferContents(SharedBuffer*);
+#endif
+    PassRefPtr&lt;ResourceBuffer&gt; copy() const;
+
+#if USE(FOUNDATION)
+    WEBCORE_EXPORT RetainPtr&lt;NSData&gt; createNSData();
+#endif
+#if USE(CF)
+    RetainPtr&lt;CFDataRef&gt; createCFData();
+#endif
+
+protected:
+    WEBCORE_EXPORT ResourceBuffer();
+
+private:
+    WEBCORE_EXPORT ResourceBuffer(const char*, unsigned);
+    ResourceBuffer(PassRefPtr&lt;SharedBuffer&gt;);
+
+    RefPtr&lt;SharedBuffer&gt; m_sharedBuffer;
+};
+
+} // namespace WebCore
+
+#endif // ResourceBuffer_h
</ins></span></pre></div>
<a id="trunkSourceWebCoreloaderResourceLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/ResourceLoader.cpp (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/ResourceLoader.cpp        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebCore/loader/ResourceLoader.cpp        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -42,6 +42,7 @@
</span><span class="cx"> #include &quot;Page.h&quot;
</span><span class="cx"> #include &quot;PlatformStrategies.h&quot;
</span><span class="cx"> #include &quot;ProgressTracker.h&quot;
</span><ins>+#include &quot;ResourceBuffer.h&quot;
</ins><span class="cx"> #include &quot;ResourceError.h&quot;
</span><span class="cx"> #include &quot;ResourceHandle.h&quot;
</span><span class="cx"> #include &quot;ResourceLoadScheduler.h&quot;
</span><span class="lines">@@ -221,12 +222,12 @@
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     if (dataPayloadType == DataPayloadWholeResource) {
</span><del>-        m_resourceData = buffer ? buffer : SharedBuffer::create(data, length);
</del><ins>+        m_resourceData = buffer ? ResourceBuffer::adoptSharedBuffer(buffer) : ResourceBuffer::create(data, length);
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx">         
</span><span class="cx">     if (!m_resourceData)
</span><del>-        m_resourceData = buffer ? buffer : SharedBuffer::create(data, length);
</del><ins>+        m_resourceData = buffer ? ResourceBuffer::adoptSharedBuffer(buffer) : ResourceBuffer::create(data, length);
</ins><span class="cx">     else {
</span><span class="cx">         if (buffer)
</span><span class="cx">             m_resourceData-&gt;append(buffer);
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderResourceLoaderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/ResourceLoader.h (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/ResourceLoader.h        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebCore/loader/ResourceLoader.h        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -47,6 +47,7 @@
</span><span class="cx"> class Frame;
</span><span class="cx"> class FrameLoader;
</span><span class="cx"> class URL;
</span><ins>+class ResourceBuffer;
</ins><span class="cx"> 
</span><span class="cx"> #if USE(QUICK_LOOK)
</span><span class="cx"> class QuickLookHandle;
</span><span class="lines">@@ -87,7 +88,7 @@
</span><span class="cx">     virtual void releaseResources();
</span><span class="cx">     const ResourceResponse&amp; response() const;
</span><span class="cx"> 
</span><del>-    SharedBuffer* resourceData() const { return m_resourceData.get(); }
</del><ins>+    ResourceBuffer* resourceData() const { return m_resourceData.get(); }
</ins><span class="cx">     void clearResourceData();
</span><span class="cx">     
</span><span class="cx">     virtual bool isSubresourceLoader();
</span><span class="lines">@@ -203,7 +204,7 @@
</span><span class="cx"> 
</span><span class="cx">     ResourceRequest m_request;
</span><span class="cx">     ResourceRequest m_originalRequest; // Before redirects.
</span><del>-    RefPtr&lt;SharedBuffer&gt; m_resourceData;
</del><ins>+    RefPtr&lt;ResourceBuffer&gt; m_resourceData;
</ins><span class="cx">     
</span><span class="cx">     unsigned long m_identifier;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderSubresourceLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/SubresourceLoader.cpp (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/SubresourceLoader.cpp        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebCore/loader/SubresourceLoader.cpp        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -38,6 +38,7 @@
</span><span class="cx"> #include &quot;MemoryCache.h&quot;
</span><span class="cx"> #include &quot;Page.h&quot;
</span><span class="cx"> #include &quot;PageActivityAssertionToken.h&quot;
</span><ins>+#include &quot;ResourceBuffer.h&quot;
</ins><span class="cx"> #include &lt;wtf/Ref.h&gt;
</span><span class="cx"> #include &lt;wtf/RefCountedLeakCounter.h&gt;
</span><span class="cx"> #include &lt;wtf/StdLibExtras.h&gt;
</span><span class="lines">@@ -232,10 +233,11 @@
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    auto* buffer = resourceData();
</del><ins>+    RefPtr&lt;ResourceBuffer&gt; buffer = resourceData();
</ins><span class="cx">     if (m_loadingMultipartContent &amp;&amp; buffer &amp;&amp; buffer-&gt;size()) {
</span><span class="cx">         // The resource data will change as the next part is loaded, so we need to make a copy.
</span><del>-        m_resource-&gt;finishLoading(&amp;buffer-&gt;copy().get());
</del><ins>+        RefPtr&lt;ResourceBuffer&gt; copiedData = ResourceBuffer::create(buffer-&gt;data(), buffer-&gt;size());
+        m_resource-&gt;finishLoading(copiedData.get());
</ins><span class="cx">         clearResourceData();
</span><span class="cx">         // Since a subresource loader does not load multipart sections progressively, data was delivered to the loader all at once.        
</span><span class="cx">         // After the first multipart section is complete, signal to delegates that this load is &quot;finished&quot; 
</span><span class="lines">@@ -271,8 +273,8 @@
</span><span class="cx">     ResourceLoader::didReceiveDataOrBuffer(data, length, buffer, encodedDataLength, dataPayloadType);
</span><span class="cx"> 
</span><span class="cx">     if (!m_loadingMultipartContent) {
</span><del>-        if (auto* resourceData = this-&gt;resourceData())
-            m_resource-&gt;addDataBuffer(*resourceData);
</del><ins>+        if (ResourceBuffer* resourceData = this-&gt;resourceData())
+            m_resource-&gt;addDataBuffer(resourceData);
</ins><span class="cx">         else
</span><span class="cx">             m_resource-&gt;addData(buffer ? buffer-&gt;data() : data, buffer ? buffer-&gt;size() : length);
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderTextTrackLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/TextTrackLoader.cpp (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/TextTrackLoader.cpp        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebCore/loader/TextTrackLoader.cpp        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -36,8 +36,8 @@
</span><span class="cx"> #include &quot;CrossOriginAccessControl.h&quot;
</span><span class="cx"> #include &quot;Document.h&quot;
</span><span class="cx"> #include &quot;Logging.h&quot;
</span><ins>+#include &quot;ResourceBuffer.h&quot;
</ins><span class="cx"> #include &quot;SecurityOrigin.h&quot;
</span><del>-#include &quot;SharedBuffer.h&quot;
</del><span class="cx"> #include &quot;VTTCue.h&quot;
</span><span class="cx"> #include &quot;WebVTTParser.h&quot;
</span><span class="cx"> 
</span><span class="lines">@@ -87,7 +87,7 @@
</span><span class="cx">     if (m_state == Failed || !resource-&gt;resourceBuffer())
</span><span class="cx">         return;
</span><span class="cx">     
</span><del>-    auto* buffer = resource-&gt;resourceBuffer();
</del><ins>+    ResourceBuffer* buffer = resource-&gt;resourceBuffer();
</ins><span class="cx">     if (m_parseOffset == buffer-&gt;size())
</span><span class="cx">         return;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderappcacheApplicationCacheGroupcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -41,6 +41,7 @@
</span><span class="cx"> #include &quot;InspectorInstrumentation.h&quot;
</span><span class="cx"> #include &quot;ManifestParser.h&quot;
</span><span class="cx"> #include &quot;Page.h&quot;
</span><ins>+#include &quot;ResourceBuffer.h&quot;
</ins><span class="cx"> #include &quot;ResourceHandle.h&quot;
</span><span class="cx"> #include &quot;SecurityOrigin.h&quot;
</span><span class="cx"> #include &quot;Settings.h&quot;
</span><span class="lines">@@ -253,8 +254,11 @@
</span><span class="cx">                 resource-&gt;addType(ApplicationCacheResource::Master);
</span><span class="cx">                 ASSERT(!resource-&gt;storageID());
</span><span class="cx">             }
</span><del>-        } else
-            m_newestCache-&gt;addResource(ApplicationCacheResource::create(url, loader-&gt;response(), ApplicationCacheResource::Master, loader-&gt;mainResourceData()));
</del><ins>+        } else {
+            RefPtr&lt;ResourceBuffer&gt; buffer = loader-&gt;mainResourceData();
+            m_newestCache-&gt;addResource(ApplicationCacheResource::create(url, loader-&gt;response(), ApplicationCacheResource::Master, buffer ? buffer-&gt;sharedBuffer() : 0));
+        }
+
</ins><span class="cx">         break;
</span><span class="cx">     case Failure:
</span><span class="cx">         // Cache update has been a failure, so there is no reason to keep the document associated with the incomplete cache
</span><span class="lines">@@ -272,8 +276,10 @@
</span><span class="cx">                 resource-&gt;addType(ApplicationCacheResource::Master);
</span><span class="cx">                 ASSERT(!resource-&gt;storageID());
</span><span class="cx">             }
</span><del>-        } else
-            m_cacheBeingUpdated-&gt;addResource(ApplicationCacheResource::create(url, loader-&gt;response(), ApplicationCacheResource::Master, loader-&gt;mainResourceData()));
</del><ins>+        } else {
+            RefPtr&lt;ResourceBuffer&gt; buffer = loader-&gt;mainResourceData();
+            m_cacheBeingUpdated-&gt;addResource(ApplicationCacheResource::create(url, loader-&gt;response(), ApplicationCacheResource::Master, buffer ? buffer-&gt;sharedBuffer() : 0));
+        }
</ins><span class="cx">         // The &quot;cached&quot; event will be posted to all associated documents once update is complete.
</span><span class="cx">         break;
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderarchivecfLegacyWebArchivecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -46,6 +46,7 @@
</span><span class="cx"> #include &quot;MemoryCache.h&quot;
</span><span class="cx"> #include &quot;Page.h&quot;
</span><span class="cx"> #include &quot;Range.h&quot;
</span><ins>+#include &quot;ResourceBuffer.h&quot;
</ins><span class="cx"> #include &quot;Settings.h&quot;
</span><span class="cx"> #include &quot;markup.h&quot;
</span><span class="cx"> #include &lt;wtf/ListHashSet.h&gt;
</span><span class="lines">@@ -549,7 +550,9 @@
</span><span class="cx"> #endif
</span><span class="cx">                 CachedResource* cachedResource = memoryCache()-&gt;resourceForRequest(request, frame-&gt;page()-&gt;sessionID());
</span><span class="cx">                 if (cachedResource) {
</span><del>-                    if (RefPtr&lt;ArchiveResource&gt; resource = ArchiveResource::create(cachedResource-&gt;resourceBuffer(), subresourceURL, cachedResource-&gt;response())) {
</del><ins>+                    ResourceBuffer* data = cachedResource-&gt;resourceBuffer();
+
+                    if (RefPtr&lt;ArchiveResource&gt; resource = ArchiveResource::create(data ? data-&gt;sharedBuffer() : 0, subresourceURL, cachedResource-&gt;response())) {
</ins><span class="cx">                         subresources.append(WTF::move(resource));
</span><span class="cx">                         continue;
</span><span class="cx">                     }
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercacheCachedCSSStyleSheetcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cache/CachedCSSStyleSheet.cpp (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/CachedCSSStyleSheet.cpp        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebCore/loader/cache/CachedCSSStyleSheet.cpp        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -33,7 +33,7 @@
</span><span class="cx"> #include &quot;HTTPHeaderNames.h&quot;
</span><span class="cx"> #include &quot;HTTPParsers.h&quot;
</span><span class="cx"> #include &quot;MemoryCache.h&quot;
</span><del>-#include &quot;SharedBuffer.h&quot;
</del><ins>+#include &quot;ResourceBuffer.h&quot;
</ins><span class="cx"> #include &quot;StyleSheetContents.h&quot;
</span><span class="cx"> #include &quot;TextResourceDecoder.h&quot;
</span><span class="cx"> #include &lt;wtf/CurrentTime.h&gt;
</span><span class="lines">@@ -90,13 +90,13 @@
</span><span class="cx">     return m_decoder-&gt;decodeAndFlush(m_data-&gt;data(), m_data-&gt;size());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CachedCSSStyleSheet::finishLoading(SharedBuffer* data)
</del><ins>+void CachedCSSStyleSheet::finishLoading(ResourceBuffer* data)
</ins><span class="cx"> {
</span><span class="cx">     m_data = data;
</span><del>-    setEncodedSize(data ? data-&gt;size() : 0);
</del><ins>+    setEncodedSize(m_data.get() ? m_data-&gt;size() : 0);
</ins><span class="cx">     // Decode the data to find out the encoding and keep the sheet text around during checkNotify()
</span><del>-    if (data)
-        m_decodedSheetText = m_decoder-&gt;decodeAndFlush(data-&gt;data(), data-&gt;size());
</del><ins>+    if (m_data)
+        m_decodedSheetText = m_decoder-&gt;decodeAndFlush(m_data-&gt;data(), m_data-&gt;size());
</ins><span class="cx">     setLoading(false);
</span><span class="cx">     checkNotify();
</span><span class="cx">     // Clear the decoded text as it is unlikely to be needed immediately again and is cheap to regenerate.
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercacheCachedCSSStyleSheeth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cache/CachedCSSStyleSheet.h (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/CachedCSSStyleSheet.h        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebCore/loader/cache/CachedCSSStyleSheet.h        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -54,7 +54,7 @@
</span><span class="cx"> 
</span><span class="cx">         virtual void setEncoding(const String&amp;) override;
</span><span class="cx">         virtual String encoding() const override;
</span><del>-        virtual void finishLoading(SharedBuffer*) override;
</del><ins>+        virtual void finishLoading(ResourceBuffer*) override;
</ins><span class="cx">         virtual void destroyDecodedData() override;
</span><span class="cx"> 
</span><span class="cx">     protected:
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercacheCachedFontcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cache/CachedFont.cpp (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/CachedFont.cpp        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebCore/loader/cache/CachedFont.cpp        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -33,6 +33,7 @@
</span><span class="cx"> #include &quot;FontCustomPlatformData.h&quot;
</span><span class="cx"> #include &quot;FontPlatformData.h&quot;
</span><span class="cx"> #include &quot;MemoryCache.h&quot;
</span><ins>+#include &quot;ResourceBuffer.h&quot;
</ins><span class="cx"> #include &quot;SharedBuffer.h&quot;
</span><span class="cx"> #include &quot;TextResourceDecoder.h&quot;
</span><span class="cx"> #include &quot;TypedElementDescendantIterator.h&quot;
</span><span class="lines">@@ -75,7 +76,7 @@
</span><span class="cx">         static_cast&lt;CachedFontClient*&gt;(c)-&gt;fontLoaded(this);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CachedFont::finishLoading(SharedBuffer* data)
</del><ins>+void CachedFont::finishLoading(ResourceBuffer* data)
</ins><span class="cx"> {
</span><span class="cx">     m_data = data;
</span><span class="cx">     setEncodedSize(m_data.get() ? m_data-&gt;size() : 0);
</span><span class="lines">@@ -94,27 +95,30 @@
</span><span class="cx"> bool CachedFont::ensureCustomFontData()
</span><span class="cx"> {
</span><span class="cx">     if (!m_fontData &amp;&amp; !errorOccurred() &amp;&amp; !isLoading() &amp;&amp; m_data) {
</span><del>-        RefPtr&lt;SharedBuffer&gt; buffer = m_data;
</del><ins>+        SharedBuffer* buffer = m_data.get()-&gt;sharedBuffer();
+        ASSERT(buffer);
+
</ins><span class="cx">         bool fontIsWOFF = false;
</span><ins>+#if (!PLATFORM(MAC) || __MAC_OS_X_VERSION_MIN_REQUIRED &lt;= 1090) &amp;&amp; (!PLATFORM(IOS) || __IPHONE_OS_VERSION_MIN_REQUIRED &lt; 80000)
+        RefPtr&lt;SharedBuffer&gt; sfntBuffer;
</ins><span class="cx"> 
</span><del>-#if (!PLATFORM(MAC) || __MAC_OS_X_VERSION_MIN_REQUIRED &lt;= 1090) &amp;&amp; (!PLATFORM(IOS) || __IPHONE_OS_VERSION_MIN_REQUIRED &lt; 80000)
-        if (isWOFF(buffer.get())) {
-            Vector&lt;char&gt; convertedFont;
-            if (!convertWOFFToSfnt(buffer.get(), convertedFont))
</del><ins>+        fontIsWOFF = isWOFF(buffer);
+        if (fontIsWOFF) {
+            Vector&lt;char&gt; sfnt;
+            if (convertWOFFToSfnt(buffer, sfnt)) {
+                sfntBuffer = SharedBuffer::adoptVector(sfnt);
+                buffer = sfntBuffer.get();
+            } else
</ins><span class="cx">                 buffer = nullptr;
</span><del>-            else {
-                buffer = SharedBuffer::adoptVector(convertedFont);
-                fontIsWOFF = true;
-            }
</del><span class="cx">         }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">         m_fontData = buffer ? createFontCustomPlatformData(*buffer) : nullptr;
</span><del>-        m_hasCreatedFontDataWrappingResource = m_fontData &amp;&amp; !fontIsWOFF;
-        if (!m_fontData)
</del><ins>+        if (m_fontData)
+            m_hasCreatedFontDataWrappingResource = !fontIsWOFF;
+        else
</ins><span class="cx">             setStatus(DecodeError);
</span><span class="cx">     }
</span><del>-
</del><span class="cx">     return m_fontData.get();
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercacheCachedFonth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cache/CachedFont.h (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/CachedFont.h        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebCore/loader/cache/CachedFont.h        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -63,7 +63,7 @@
</span><span class="cx">     virtual void load(CachedResourceLoader*, const ResourceLoaderOptions&amp;) override;
</span><span class="cx"> 
</span><span class="cx">     virtual void didAddClient(CachedResourceClient*) override;
</span><del>-    virtual void finishLoading(SharedBuffer*) override;
</del><ins>+    virtual void finishLoading(ResourceBuffer*) override;
</ins><span class="cx"> 
</span><span class="cx">     virtual void allClientsRemoved() override;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercacheCachedImagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cache/CachedImage.cpp (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/CachedImage.cpp        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebCore/loader/cache/CachedImage.cpp        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -37,6 +37,7 @@
</span><span class="cx"> #include &quot;MemoryCache.h&quot;
</span><span class="cx"> #include &quot;Page.h&quot;
</span><span class="cx"> #include &quot;RenderElement.h&quot;
</span><ins>+#include &quot;ResourceBuffer.h&quot;
</ins><span class="cx"> #include &quot;SVGImage.h&quot;
</span><span class="cx"> #include &quot;SecurityOrigin.h&quot;
</span><span class="cx"> #include &quot;Settings.h&quot;
</span><span class="lines">@@ -115,31 +116,31 @@
</span><span class="cx">         setLoading(false);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CachedImage::didAddClient(CachedResourceClient* client)
</del><ins>+void CachedImage::didAddClient(CachedResourceClient* c)
</ins><span class="cx"> {
</span><span class="cx">     if (m_data &amp;&amp; !m_image &amp;&amp; !errorOccurred()) {
</span><span class="cx">         createImage();
</span><del>-        m_image-&gt;setData(m_data, true);
</del><ins>+        m_image-&gt;setData(m_data-&gt;sharedBuffer(), true);
</ins><span class="cx">     }
</span><span class="cx">     
</span><del>-    ASSERT(client-&gt;resourceClientType() == CachedImageClient::expectedType());
</del><ins>+    ASSERT(c-&gt;resourceClientType() == CachedImageClient::expectedType());
</ins><span class="cx">     if (m_image &amp;&amp; !m_image-&gt;isNull())
</span><del>-        static_cast&lt;CachedImageClient*&gt;(client)-&gt;imageChanged(this);
</del><ins>+        static_cast&lt;CachedImageClient*&gt;(c)-&gt;imageChanged(this);
</ins><span class="cx"> 
</span><del>-    CachedResource::didAddClient(client);
</del><ins>+    CachedResource::didAddClient(c);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CachedImage::didRemoveClient(CachedResourceClient* client)
</del><ins>+void CachedImage::didRemoveClient(CachedResourceClient* c)
</ins><span class="cx"> {
</span><del>-    ASSERT(client);
-    ASSERT(client-&gt;resourceClientType() == CachedImageClient::expectedType());
</del><ins>+    ASSERT(c);
+    ASSERT(c-&gt;resourceClientType() == CachedImageClient::expectedType());
</ins><span class="cx"> 
</span><del>-    m_pendingContainerSizeRequests.remove(static_cast&lt;CachedImageClient*&gt;(client));
</del><ins>+    m_pendingContainerSizeRequests.remove(static_cast&lt;CachedImageClient*&gt;(c));
</ins><span class="cx"> 
</span><span class="cx">     if (m_svgImageCache)
</span><del>-        m_svgImageCache-&gt;removeClientFromCache(static_cast&lt;CachedImageClient*&gt;(client));
</del><ins>+        m_svgImageCache-&gt;removeClientFromCache(static_cast&lt;CachedImageClient*&gt;(c));
</ins><span class="cx"> 
</span><del>-    CachedResource::didRemoveClient(client);
</del><ins>+    CachedResource::didRemoveClient(c);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void CachedImage::switchClientsToRevalidatedResource()
</span><span class="lines">@@ -364,16 +365,18 @@
</span><span class="cx">     m_image.clear();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CachedImage::addIncrementalDataBuffer(SharedBuffer&amp; data)
</del><ins>+void CachedImage::addIncrementalDataBuffer(ResourceBuffer* data)
</ins><span class="cx"> {
</span><del>-    m_data = &amp;data;
</del><ins>+    m_data = data;
+    if (!data)
+        return;
</ins><span class="cx"> 
</span><span class="cx">     createImage();
</span><span class="cx"> 
</span><span class="cx">     // Have the image update its data from its internal buffer.
</span><span class="cx">     // It will not do anything now, but will delay decoding until
</span><span class="cx">     // queried for info (like size or specific image frames).
</span><del>-    bool sizeAvailable = m_image-&gt;setData(&amp;data, false);
</del><ins>+    bool sizeAvailable = m_image-&gt;setData(m_data-&gt;sharedBuffer(), false);
</ins><span class="cx">     if (!sizeAvailable)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="lines">@@ -395,28 +398,26 @@
</span><span class="cx">     setEncodedSize(m_image-&gt;data() ? m_image-&gt;data()-&gt;size() : 0);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CachedImage::addDataBuffer(SharedBuffer&amp; data)
</del><ins>+void CachedImage::addDataBuffer(ResourceBuffer* data)
</ins><span class="cx"> {
</span><del>-    ASSERT(dataBufferingPolicy() == BufferData);
</del><ins>+    ASSERT(m_options.dataBufferingPolicy() == BufferData);
</ins><span class="cx">     addIncrementalDataBuffer(data);
</span><del>-    CachedResource::addDataBuffer(data);
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void CachedImage::addData(const char* data, unsigned length)
</span><span class="cx"> {
</span><del>-    ASSERT(dataBufferingPolicy() == DoNotBufferData);
-    addIncrementalDataBuffer(*SharedBuffer::create(data, length));
-    CachedResource::addData(data, length);
</del><ins>+    ASSERT(m_options.dataBufferingPolicy() == DoNotBufferData);
+    addIncrementalDataBuffer(ResourceBuffer::create(data, length).get());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CachedImage::finishLoading(SharedBuffer* data)
</del><ins>+void CachedImage::finishLoading(ResourceBuffer* data)
</ins><span class="cx"> {
</span><span class="cx">     m_data = data;
</span><span class="cx">     if (!m_image &amp;&amp; data)
</span><span class="cx">         createImage();
</span><span class="cx"> 
</span><span class="cx">     if (m_image)
</span><del>-        m_image-&gt;setData(data, true);
</del><ins>+        m_image-&gt;setData(m_data-&gt;sharedBuffer(), true);
</ins><span class="cx"> 
</span><span class="cx">     if (!m_image || m_image-&gt;isNull()) {
</span><span class="cx">         // Image decoding failed; the image data is malformed.
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercacheCachedImageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cache/CachedImage.h (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/CachedImage.h        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebCore/loader/cache/CachedImage.h        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -71,8 +71,8 @@
</span><span class="cx">     bool imageHasRelativeWidth() const;
</span><span class="cx">     bool imageHasRelativeHeight() const;
</span><span class="cx"> 
</span><del>-    virtual void addDataBuffer(SharedBuffer&amp;) override;
-    virtual void finishLoading(SharedBuffer*) override;
</del><ins>+    virtual void addDataBuffer(ResourceBuffer*) override;
+    virtual void finishLoading(ResourceBuffer*) override;
</ins><span class="cx"> 
</span><span class="cx">     enum SizeType {
</span><span class="cx">         UsedSize,
</span><span class="lines">@@ -94,7 +94,7 @@
</span><span class="cx">     void createImage();
</span><span class="cx">     void clearImage();
</span><span class="cx">     // If not null, changeRect is the changed part of the image.
</span><del>-    void notifyObservers(const IntRect* changeRect = nullptr);
</del><ins>+    void notifyObservers(const IntRect* changeRect = 0);
</ins><span class="cx">     void checkShouldPaintBrokenImage();
</span><span class="cx"> 
</span><span class="cx">     virtual void switchClientsToRevalidatedResource() override;
</span><span class="lines">@@ -122,7 +122,7 @@
</span><span class="cx">     virtual void animationAdvanced(const Image*) override;
</span><span class="cx">     virtual void changedInRect(const Image*, const IntRect&amp;) override;
</span><span class="cx"> 
</span><del>-    void addIncrementalDataBuffer(SharedBuffer&amp;);
</del><ins>+    void addIncrementalDataBuffer(ResourceBuffer*);
</ins><span class="cx"> 
</span><span class="cx">     typedef std::pair&lt;LayoutSize, float&gt; SizeAndZoom;
</span><span class="cx">     typedef HashMap&lt;const CachedImageClient*, SizeAndZoom&gt; ContainerSizeRequests;
</span><span class="lines">@@ -130,8 +130,8 @@
</span><span class="cx"> 
</span><span class="cx">     RefPtr&lt;Image&gt; m_image;
</span><span class="cx">     std::unique_ptr&lt;SVGImageCache&gt; m_svgImageCache;
</span><del>-    unsigned m_isManuallyCached : 1;
-    unsigned m_shouldPaintBrokenImage : 1;
</del><ins>+    unsigned char m_isManuallyCached : 1;
+    unsigned char m_shouldPaintBrokenImage : 1;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercacheCachedRawResourcecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cache/CachedRawResource.cpp (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/CachedRawResource.cpp        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebCore/loader/cache/CachedRawResource.cpp        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -30,7 +30,7 @@
</span><span class="cx"> #include &quot;CachedResourceClientWalker.h&quot;
</span><span class="cx"> #include &quot;CachedResourceLoader.h&quot;
</span><span class="cx"> #include &quot;HTTPHeaderNames.h&quot;
</span><del>-#include &quot;SharedBuffer.h&quot;
</del><ins>+#include &quot;ResourceBuffer.h&quot;
</ins><span class="cx"> #include &quot;SubresourceLoader.h&quot;
</span><span class="cx"> #include &lt;wtf/PassRefPtr.h&gt;
</span><span class="cx"> #include &lt;wtf/text/StringView.h&gt;
</span><span class="lines">@@ -46,7 +46,7 @@
</span><span class="cx">     ASSERT(isMainOrRawResource());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-const char* CachedRawResource::calculateIncrementalDataChunk(SharedBuffer* data, unsigned&amp; incrementalDataLength)
</del><ins>+const char* CachedRawResource::calculateIncrementalDataChunk(ResourceBuffer* data, unsigned&amp; incrementalDataLength)
</ins><span class="cx"> {
</span><span class="cx">     incrementalDataLength = 0;
</span><span class="cx">     if (!data)
</span><span class="lines">@@ -58,37 +58,34 @@
</span><span class="cx">     return data-&gt;data() + previousDataLength;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CachedRawResource::addDataBuffer(SharedBuffer&amp; data)
</del><ins>+void CachedRawResource::addDataBuffer(ResourceBuffer* data)
</ins><span class="cx"> {
</span><span class="cx">     CachedResourceHandle&lt;CachedRawResource&gt; protect(this);
</span><del>-    ASSERT(dataBufferingPolicy() == BufferData);
-    m_data = &amp;data;
</del><ins>+    ASSERT(m_options.dataBufferingPolicy() == BufferData);
+    m_data = data;
</ins><span class="cx"> 
</span><span class="cx">     unsigned incrementalDataLength;
</span><del>-    const char* incrementalData = calculateIncrementalDataChunk(&amp;data, incrementalDataLength);
-    setEncodedSize(data.size());
</del><ins>+    const char* incrementalData = calculateIncrementalDataChunk(data, incrementalDataLength);
+    if (data)
+        setEncodedSize(data-&gt;size());
</ins><span class="cx">     notifyClientsDataWasReceived(incrementalData, incrementalDataLength);
</span><del>-    if (dataBufferingPolicy() == DoNotBufferData) {
</del><ins>+    if (m_options.dataBufferingPolicy() == DoNotBufferData) {
</ins><span class="cx">         if (m_loader)
</span><span class="cx">             m_loader-&gt;setDataBufferingPolicy(DoNotBufferData);
</span><span class="cx">         clear();
</span><del>-        return;
</del><span class="cx">     }
</span><del>-
-    CachedResource::addDataBuffer(data);
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void CachedRawResource::addData(const char* data, unsigned length)
</span><span class="cx"> {
</span><del>-    ASSERT(dataBufferingPolicy() == DoNotBufferData);
</del><ins>+    ASSERT(m_options.dataBufferingPolicy() == DoNotBufferData);
</ins><span class="cx">     notifyClientsDataWasReceived(data, length);
</span><del>-    CachedResource::addData(data, length);
</del><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CachedRawResource::finishLoading(SharedBuffer* data)
</del><ins>+void CachedRawResource::finishLoading(ResourceBuffer* data)
</ins><span class="cx"> {
</span><span class="cx">     CachedResourceHandle&lt;CachedRawResource&gt; protect(this);
</span><del>-    DataBufferingPolicy dataBufferingPolicy = this-&gt;dataBufferingPolicy();
</del><ins>+    DataBufferingPolicy dataBufferingPolicy = m_options.dataBufferingPolicy();
</ins><span class="cx">     if (dataBufferingPolicy == BufferData) {
</span><span class="cx">         m_data = data;
</span><span class="cx"> 
</span><span class="lines">@@ -102,7 +99,7 @@
</span><span class="cx">     m_allowEncodedDataReplacement = !m_loader-&gt;isQuickLookResource();
</span><span class="cx"> 
</span><span class="cx">     CachedResource::finishLoading(data);
</span><del>-    if (dataBufferingPolicy == BufferData &amp;&amp; this-&gt;dataBufferingPolicy() == DoNotBufferData) {
</del><ins>+    if (dataBufferingPolicy == BufferData &amp;&amp; m_options.dataBufferingPolicy() == DoNotBufferData) {
</ins><span class="cx">         if (m_loader)
</span><span class="cx">             m_loader-&gt;setDataBufferingPolicy(DoNotBufferData);
</span><span class="cx">         clear();
</span><span class="lines">@@ -225,7 +222,7 @@
</span><span class="cx"> 
</span><span class="cx"> bool CachedRawResource::canReuse(const ResourceRequest&amp; newRequest) const
</span><span class="cx"> {
</span><del>-    if (dataBufferingPolicy() == DoNotBufferData)
</del><ins>+    if (m_options.dataBufferingPolicy() == DoNotBufferData)
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="cx">     if (m_resourceRequest.httpMethod() != newRequest.httpMethod())
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercacheCachedRawResourceh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cache/CachedRawResource.h (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/CachedRawResource.h        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebCore/loader/cache/CachedRawResource.h        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -48,9 +48,9 @@
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     virtual void didAddClient(CachedResourceClient*) override;
</span><del>-    virtual void addDataBuffer(SharedBuffer&amp;) override;
</del><ins>+    virtual void addDataBuffer(ResourceBuffer*) override;
</ins><span class="cx">     virtual void addData(const char* data, unsigned length) override;
</span><del>-    virtual void finishLoading(SharedBuffer*) override;
</del><ins>+    virtual void finishLoading(ResourceBuffer*) override;
</ins><span class="cx"> 
</span><span class="cx">     virtual bool shouldIgnoreHTTPStatusCodeErrors() const override { return true; }
</span><span class="cx">     virtual void allClientsRemoved() override;
</span><span class="lines">@@ -64,7 +64,7 @@
</span><span class="cx"> 
</span><span class="cx">     virtual bool canReuse(const ResourceRequest&amp;) const override;
</span><span class="cx"> 
</span><del>-    const char* calculateIncrementalDataChunk(SharedBuffer*, unsigned&amp; incrementalDataLength);
</del><ins>+    const char* calculateIncrementalDataChunk(ResourceBuffer*, unsigned&amp; incrementalDataLength);
</ins><span class="cx">     void notifyClientsDataWasReceived(const char* data, unsigned length);
</span><span class="cx"> 
</span><span class="cx"> #if USE(SOUP)
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercacheCachedResourcecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cache/CachedResource.cpp (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/CachedResource.cpp        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebCore/loader/cache/CachedResource.cpp        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -40,6 +40,7 @@
</span><span class="cx"> #include &quot;Logging.h&quot;
</span><span class="cx"> #include &quot;MemoryCache.h&quot;
</span><span class="cx"> #include &quot;PlatformStrategies.h&quot;
</span><ins>+#include &quot;ResourceBuffer.h&quot;
</ins><span class="cx"> #include &quot;ResourceHandle.h&quot;
</span><span class="cx"> #include &quot;ResourceLoadScheduler.h&quot;
</span><span class="cx"> #include &quot;SchemeRegistry.h&quot;
</span><span class="lines">@@ -107,10 +108,10 @@
</span><span class="cx"> 
</span><span class="cx"> CachedResource::CachedResource(const ResourceRequest&amp; request, Type type, SessionID sessionID)
</span><span class="cx">     : m_resourceRequest(request)
</span><del>-    , m_decodedDataDeletionTimer(this, &amp;CachedResource::decodedDataDeletionTimerFired, deadDecodedDataDeletionIntervalForResourceType(type))
</del><span class="cx">     , m_sessionID(sessionID)
</span><span class="cx">     , m_loadPriority(defaultPriorityForResourceType(type))
</span><span class="cx">     , m_responseTimestamp(currentTime())
</span><ins>+    , m_decodedDataDeletionTimer(this, &amp;CachedResource::decodedDataDeletionTimerFired, deadDecodedDataDeletionIntervalForResourceType(type))
</ins><span class="cx">     , m_lastDecodedAccessTime(0)
</span><span class="cx">     , m_loadFinishTime(0)
</span><span class="cx">     , m_encodedSize(0)
</span><span class="lines">@@ -285,22 +286,22 @@
</span><span class="cx">     if (isLoading() || stillNeedsLoad())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    CachedResourceClientWalker&lt;CachedResourceClient&gt; walker(m_clients);
-    while (CachedResourceClient* client = walker.next())
-        client-&gt;notifyFinished(this);
</del><ins>+    CachedResourceClientWalker&lt;CachedResourceClient&gt; w(m_clients);
+    while (CachedResourceClient* c = w.next())
+        c-&gt;notifyFinished(this);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CachedResource::addDataBuffer(SharedBuffer&amp;)
</del><ins>+void CachedResource::addDataBuffer(ResourceBuffer*)
</ins><span class="cx"> {
</span><del>-    ASSERT(dataBufferingPolicy() == BufferData);
</del><ins>+    ASSERT(m_options.dataBufferingPolicy() == BufferData);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void CachedResource::addData(const char*, unsigned)
</span><span class="cx"> {
</span><del>-    ASSERT(dataBufferingPolicy() == DoNotBufferData);
</del><ins>+    ASSERT(m_options.dataBufferingPolicy() == DoNotBufferData);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CachedResource::finishLoading(SharedBuffer*)
</del><ins>+void CachedResource::finishLoading(ResourceBuffer*)
</ins><span class="cx"> {
</span><span class="cx">     setLoading(false);
</span><span class="cx">     checkNotify();
</span><span class="lines">@@ -390,15 +391,17 @@
</span><span class="cx">         didAddClient(client);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CachedResource::didAddClient(CachedResourceClient* client)
</del><ins>+void CachedResource::didAddClient(CachedResourceClient* c)
</ins><span class="cx"> {
</span><span class="cx">     if (m_decodedDataDeletionTimer.isActive())
</span><span class="cx">         m_decodedDataDeletionTimer.stop();
</span><span class="cx"> 
</span><del>-    if (m_clientsAwaitingCallback.remove(client))
-        m_clients.add(client);
</del><ins>+    if (m_clientsAwaitingCallback.contains(c)) {
+        m_clients.add(c);
+        m_clientsAwaitingCallback.remove(c);
+    }
</ins><span class="cx">     if (!isLoading() &amp;&amp; !stillNeedsLoad())
</span><del>-        client-&gt;notifyFinished(this);
</del><ins>+        c-&gt;notifyFinished(this);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool CachedResource::addClientToSet(CachedResourceClient* client)
</span><span class="lines">@@ -420,7 +423,7 @@
</span><span class="cx">         // Therefore, rather than immediately sending callbacks on a cache hit like other CachedResources,
</span><span class="cx">         // we schedule the callbacks and ensure we never finish synchronously.
</span><span class="cx">         ASSERT(!m_clientsAwaitingCallback.contains(client));
</span><del>-        m_clientsAwaitingCallback.add(client, std::make_unique&lt;Callback&gt;(*this, *client));
</del><ins>+        m_clientsAwaitingCallback.add(client, CachedResourceCallback::schedule(this, client));
</ins><span class="cx">         return false;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -728,28 +731,27 @@
</span><span class="cx">     m_loadPriority = loadPriority;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-inline CachedResource::Callback::Callback(CachedResource&amp; resource, CachedResourceClient&amp; client)
</del><ins>+CachedResource::CachedResourceCallback::CachedResourceCallback(CachedResource* resource, CachedResourceClient* client)
</ins><span class="cx">     : m_resource(resource)
</span><span class="cx">     , m_client(client)
</span><del>-    , m_timer(this, &amp;Callback::timerFired)
</del><ins>+    , m_callbackTimer(this, &amp;CachedResourceCallback::timerFired)
</ins><span class="cx"> {
</span><del>-    m_timer.startOneShot(0);
</del><ins>+    m_callbackTimer.startOneShot(0);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-inline void CachedResource::Callback::cancel()
</del><ins>+void CachedResource::CachedResourceCallback::cancel()
</ins><span class="cx"> {
</span><del>-    if (m_timer.isActive())
-        m_timer.stop();
</del><ins>+    if (m_callbackTimer.isActive())
+        m_callbackTimer.stop();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CachedResource::Callback::timerFired(Timer&lt;Callback&gt;&amp;)
</del><ins>+void CachedResource::CachedResourceCallback::timerFired(Timer&lt;CachedResourceCallback&gt;&amp;)
</ins><span class="cx"> {
</span><del>-    m_resource.didAddClient(&amp;m_client);
</del><ins>+    m_resource-&gt;didAddClient(m_client);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if USE(FOUNDATION)
</span><del>-
-void CachedResource::tryReplaceEncodedData(SharedBuffer&amp; newBuffer)
</del><ins>+void CachedResource::tryReplaceEncodedData(PassRefPtr&lt;SharedBuffer&gt; newBuffer)
</ins><span class="cx"> {
</span><span class="cx">     if (!m_data)
</span><span class="cx">         return;
</span><span class="lines">@@ -760,12 +762,11 @@
</span><span class="cx">     // We have to do the memcmp because we can't tell if the replacement file backed data is for the
</span><span class="cx">     // same resource or if we made a second request with the same URL which gave us a different
</span><span class="cx">     // resource. We have seen this happen for cached POST resources.
</span><del>-    if (m_data-&gt;size() != newBuffer.size() || memcmp(m_data-&gt;data(), newBuffer.data(), m_data-&gt;size()))
</del><ins>+    if (m_data-&gt;size() != newBuffer-&gt;size() || memcmp(m_data-&gt;data(), newBuffer-&gt;data(), m_data-&gt;size()))
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    m_data-&gt;tryReplaceContentsWithPlatformBuffer(newBuffer);
</del><ins>+    m_data-&gt;tryReplaceSharedBufferContents(newBuffer.get());
</ins><span class="cx"> }
</span><del>-
</del><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercacheCachedResourceh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cache/CachedResource.h (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/CachedResource.h        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebCore/loader/cache/CachedResource.h        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -47,6 +47,7 @@
</span><span class="cx"> class CachedResourceHandleBase;
</span><span class="cx"> class CachedResourceLoader;
</span><span class="cx"> class InspectorResource;
</span><ins>+class ResourceBuffer;
</ins><span class="cx"> class SecurityOrigin;
</span><span class="cx"> class SharedBuffer;
</span><span class="cx"> class SubresourceLoader;
</span><span class="lines">@@ -95,9 +96,9 @@
</span><span class="cx"> 
</span><span class="cx">     virtual void setEncoding(const String&amp;) { }
</span><span class="cx">     virtual String encoding() const { return String(); }
</span><del>-    virtual void addDataBuffer(SharedBuffer&amp;);
</del><ins>+    virtual void addDataBuffer(ResourceBuffer*);
</ins><span class="cx">     virtual void addData(const char* data, unsigned length);
</span><del>-    virtual void finishLoading(SharedBuffer*);
</del><ins>+    virtual void finishLoading(ResourceBuffer*);
</ins><span class="cx">     virtual void error(CachedResource::Status);
</span><span class="cx"> 
</span><span class="cx">     void setResourceError(const ResourceError&amp; error) { m_error = error; }
</span><span class="lines">@@ -186,7 +187,7 @@
</span><span class="cx">     
</span><span class="cx">     void clearLoader();
</span><span class="cx"> 
</span><del>-    SharedBuffer* resourceBuffer() const { return m_data.get(); }
</del><ins>+    ResourceBuffer* resourceBuffer() const { return m_data.get(); }
</ins><span class="cx"> 
</span><span class="cx">     virtual void willSendRequest(ResourceRequest&amp;, const ResourceResponse&amp;);
</span><span class="cx">     virtual void responseReceived(const ResourceResponse&amp;);
</span><span class="lines">@@ -244,35 +245,55 @@
</span><span class="cx">     virtual bool canReuse(const ResourceRequest&amp;) const { return true; }
</span><span class="cx"> 
</span><span class="cx"> #if USE(FOUNDATION)
</span><del>-    WEBCORE_EXPORT void tryReplaceEncodedData(SharedBuffer&amp;);
</del><ins>+    WEBCORE_EXPORT void tryReplaceEncodedData(PassRefPtr&lt;SharedBuffer&gt;);
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if USE(SOUP)
</span><del>-    virtual char* getOrCreateReadBuffer(size_t /* requestedSize */, size_t&amp; /* actualSize */) { return nullptr; }
</del><ins>+    virtual char* getOrCreateReadBuffer(size_t /* requestedSize */, size_t&amp; /* actualSize */) { return 0; }
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> protected:
</span><ins>+    virtual void checkNotify();
+
</ins><span class="cx">     void setEncodedSize(unsigned);
</span><span class="cx">     void setDecodedSize(unsigned);
</span><span class="cx">     void didAccessDecodedData(double timeStamp);
</span><span class="cx"> 
</span><del>-    // FIXME: Make the rest of these data members private and use functions in derived classes instead.
</del><span class="cx">     HashCountedSet&lt;CachedResourceClient*&gt; m_clients;
</span><ins>+
+    class CachedResourceCallback {
+    public:
+        CachedResourceCallback(CachedResource*, CachedResourceClient*);
+
+        static std::unique_ptr&lt;CachedResourceCallback&gt; schedule(CachedResource* resource, CachedResourceClient* client) { return std::make_unique&lt;CachedResourceCallback&gt;(resource, client); }
+        void cancel();
+    private:
+        void timerFired(Timer&lt;CachedResourceCallback&gt;&amp;);
+
+        CachedResource* m_resource;
+        CachedResourceClient* m_client;
+        Timer&lt;CachedResourceCallback&gt; m_callbackTimer;
+    };
+    HashMap&lt;CachedResourceClient*, std::unique_ptr&lt;CachedResourceCallback&gt;&gt; m_clientsAwaitingCallback;
+
</ins><span class="cx">     ResourceRequest m_resourceRequest;
</span><ins>+    SessionID m_sessionID;
+    String m_accept;
</ins><span class="cx">     RefPtr&lt;SubresourceLoader&gt; m_loader;
</span><span class="cx">     ResourceLoaderOptions m_options;
</span><ins>+    ResourceLoadPriority m_loadPriority;
+
</ins><span class="cx">     ResourceResponse m_response;
</span><del>-    RefPtr&lt;SharedBuffer&gt; m_data;
</del><ins>+    double m_responseTimestamp;
+
+    RefPtr&lt;ResourceBuffer&gt; m_data;
</ins><span class="cx">     DeferrableOneShotTimer m_decodedDataDeletionTimer;
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    class Callback;
-
</del><span class="cx">     bool addClientToSet(CachedResourceClient*);
</span><span class="cx"> 
</span><span class="cx">     void decodedDataDeletionTimerFired();
</span><span class="cx"> 
</span><del>-    virtual void checkNotify();
</del><span class="cx">     virtual bool mayTryReplaceEncodedData() const { return false; }
</span><span class="cx"> 
</span><span class="cx">     double freshnessLifetime(const ResourceResponse&amp;) const;
</span><span class="lines">@@ -280,12 +301,6 @@
</span><span class="cx">     void addAdditionalRequestHeaders(CachedResourceLoader*);
</span><span class="cx">     void failBeforeStarting();
</span><span class="cx"> 
</span><del>-    HashMap&lt;CachedResourceClient*, std::unique_ptr&lt;Callback&gt;&gt; m_clientsAwaitingCallback;
-    SessionID m_sessionID;
-    String m_accept;
-    ResourceLoadPriority m_loadPriority;
-    double m_responseTimestamp;
-
</del><span class="cx">     String m_fragmentIdentifierForRequest;
</span><span class="cx"> 
</span><span class="cx">     ResourceError m_error;
</span><span class="lines">@@ -323,7 +338,7 @@
</span><span class="cx">     CachedResource* m_nextInLiveResourcesList;
</span><span class="cx">     CachedResource* m_prevInLiveResourcesList;
</span><span class="cx"> 
</span><del>-    CachedResourceLoader* m_owningCachedResourceLoader; // only non-null for resources that are not in the cache
</del><ins>+    CachedResourceLoader* m_owningCachedResourceLoader; // only non-0 for resources that are not in the cache
</ins><span class="cx">     
</span><span class="cx">     // If this field is non-null we are using the resource as a proxy for checking whether an existing resource is still up to date
</span><span class="cx">     // using HTTP If-Modified-Since/If-None-Match headers. If the response is 304 all clients of this resource are moved
</span><span class="lines">@@ -340,20 +355,6 @@
</span><span class="cx">     RedirectChainCacheStatus m_redirectChainCacheStatus;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-class CachedResource::Callback {
-public:
-    Callback(CachedResource&amp;, CachedResourceClient&amp;);
-
-    void cancel();
-
-private:
-    void timerFired(Timer&lt;Callback&gt;&amp;);
-
-    CachedResource&amp; m_resource;
-    CachedResourceClient&amp; m_client;
-    Timer&lt;Callback&gt; m_timer;
-};
-
</del><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #define SPECIALIZE_TYPE_TRAITS_CACHED_RESOURCE(ToClassName, CachedResourceType) \
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercacheCachedResourceClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cache/CachedResourceClient.h (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/CachedResourceClient.h        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebCore/loader/cache/CachedResourceClient.h        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -25,8 +25,9 @@
</span><span class="cx"> #ifndef CachedResourceClient_h
</span><span class="cx"> #define CachedResourceClient_h
</span><span class="cx"> 
</span><ins>+#include &lt;wtf/FastMalloc.h&gt;
+
</ins><span class="cx"> namespace WebCore {
</span><del>-
</del><span class="cx"> class CachedResource;
</span><span class="cx"> 
</span><span class="cx"> class CachedResourceClient {
</span><span class="lines">@@ -43,14 +44,13 @@
</span><span class="cx">     virtual ~CachedResourceClient() { }
</span><span class="cx">     virtual void notifyFinished(CachedResource*) { }
</span><span class="cx">     virtual void deprecatedDidReceiveCachedResource(CachedResource*) { }
</span><del>-
</del><ins>+    
</ins><span class="cx">     static CachedResourceClientType expectedType() { return BaseResourceType; }
</span><span class="cx">     virtual CachedResourceClientType resourceClientType() const { return expectedType(); }
</span><span class="cx"> 
</span><span class="cx"> protected:
</span><span class="cx">     CachedResourceClient() { }
</span><span class="cx"> };
</span><del>-
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercacheCachedSVGDocumentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cache/CachedSVGDocument.cpp (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/CachedSVGDocument.cpp        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebCore/loader/cache/CachedSVGDocument.cpp        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -23,7 +23,10 @@
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;CachedSVGDocument.h&quot;
</span><span class="cx"> 
</span><del>-#include &quot;SharedBuffer.h&quot;
</del><ins>+#include &quot;CachedResourceClient.h&quot;
+#include &quot;CachedResourceHandle.h&quot;
+#include &quot;ResourceBuffer.h&quot;
+#include &lt;wtf/text/StringBuilder.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="lines">@@ -48,7 +51,7 @@
</span><span class="cx">     return m_decoder-&gt;encoding().name();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CachedSVGDocument::finishLoading(SharedBuffer* data)
</del><ins>+void CachedSVGDocument::finishLoading(ResourceBuffer* data)
</ins><span class="cx"> {
</span><span class="cx">     if (data) {
</span><span class="cx">         // We don't need to create a new frame because the new document belongs to the parent UseElement.
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercacheCachedSVGDocumenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cache/CachedSVGDocument.h (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/CachedSVGDocument.h        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebCore/loader/cache/CachedSVGDocument.h        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -37,14 +37,15 @@
</span><span class="cx"> 
</span><span class="cx">     SVGDocument* document() const { return m_document.get(); }
</span><span class="cx"> 
</span><ins>+protected:
+    RefPtr&lt;SVGDocument&gt; m_document;
+    RefPtr&lt;TextResourceDecoder&gt; m_decoder;
+
</ins><span class="cx"> private:
</span><span class="cx">     virtual bool mayTryReplaceEncodedData() const override { return true; }
</span><span class="cx">     virtual void setEncoding(const String&amp;) override;
</span><span class="cx">     virtual String encoding() const override;
</span><del>-    virtual void finishLoading(SharedBuffer*) override;
-
-    RefPtr&lt;SVGDocument&gt; m_document;
-    RefPtr&lt;TextResourceDecoder&gt; m_decoder;
</del><ins>+    virtual void finishLoading(ResourceBuffer*) override;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercacheCachedScriptcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cache/CachedScript.cpp (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/CachedScript.cpp        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebCore/loader/cache/CachedScript.cpp        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -33,8 +33,8 @@
</span><span class="cx"> #include &quot;HTTPParsers.h&quot;
</span><span class="cx"> #include &quot;MIMETypeRegistry.h&quot;
</span><span class="cx"> #include &quot;MemoryCache.h&quot;
</span><ins>+#include &quot;ResourceBuffer.h&quot;
</ins><span class="cx"> #include &quot;RuntimeApplicationChecks.h&quot;
</span><del>-#include &quot;SharedBuffer.h&quot;
</del><span class="cx"> #include &quot;TextResourceDecoder.h&quot;
</span><span class="cx"> #include &lt;wtf/Vector.h&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -76,13 +76,14 @@
</span><span class="cx">         setDecodedSize(m_script.sizeInBytes());
</span><span class="cx">     }
</span><span class="cx">     m_decodedDataDeletionTimer.restart();
</span><ins>+    
</ins><span class="cx">     return m_script;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CachedScript::finishLoading(SharedBuffer* data)
</del><ins>+void CachedScript::finishLoading(ResourceBuffer* data)
</ins><span class="cx"> {
</span><span class="cx">     m_data = data;
</span><del>-    setEncodedSize(data ? data-&gt;size() : 0);
</del><ins>+    setEncodedSize(m_data.get() ? m_data-&gt;size() : 0);
</ins><span class="cx">     CachedResource::finishLoading(data);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercacheCachedScripth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cache/CachedScript.h (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/CachedScript.h        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebCore/loader/cache/CachedScript.h        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -30,35 +30,36 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-class TextResourceDecoder;
</del><ins>+    class CachedResourceLoader;
+    class TextResourceDecoder;
</ins><span class="cx"> 
</span><del>-class CachedScript final : public CachedResource {
-public:
-    CachedScript(const ResourceRequest&amp;, const String&amp; charset, SessionID);
-    virtual ~CachedScript();
</del><ins>+    class CachedScript final : public CachedResource {
+    public:
+        CachedScript(const ResourceRequest&amp;, const String&amp; charset, SessionID);
+        virtual ~CachedScript();
</ins><span class="cx"> 
</span><del>-    const String&amp; script();
</del><ins>+        const String&amp; script();
</ins><span class="cx"> 
</span><del>-    String mimeType() const;
</del><ins>+        String mimeType() const;
</ins><span class="cx"> 
</span><span class="cx"> #if ENABLE(NOSNIFF)
</span><del>-    bool mimeTypeAllowedByNosniff() const;
</del><ins>+        bool mimeTypeAllowedByNosniff() const;
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-private:
-    virtual bool mayTryReplaceEncodedData() const override { return true; }
</del><ins>+    private:
+        virtual bool mayTryReplaceEncodedData() const override { return true; }
</ins><span class="cx"> 
</span><del>-    virtual bool shouldIgnoreHTTPStatusCodeErrors() const override;
</del><ins>+        virtual bool shouldIgnoreHTTPStatusCodeErrors() const override;
</ins><span class="cx"> 
</span><del>-    virtual void setEncoding(const String&amp;) override;
-    virtual String encoding() const override;
-    virtual void finishLoading(SharedBuffer*) override;
</del><ins>+        virtual void setEncoding(const String&amp;) override;
+        virtual String encoding() const override;
+        virtual void finishLoading(ResourceBuffer*) override;
</ins><span class="cx"> 
</span><del>-    virtual void destroyDecodedData() override;
</del><ins>+        virtual void destroyDecodedData() override;
</ins><span class="cx"> 
</span><del>-    String m_script;
-    RefPtr&lt;TextResourceDecoder&gt; m_decoder;
-};
</del><ins>+        String m_script;
+        RefPtr&lt;TextResourceDecoder&gt; m_decoder;
+    };
</ins><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercacheCachedTextTrackcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cache/CachedTextTrack.cpp (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/CachedTextTrack.cpp        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebCore/loader/cache/CachedTextTrack.cpp        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -32,6 +32,7 @@
</span><span class="cx"> #include &quot;CachedResourceClient.h&quot;
</span><span class="cx"> #include &quot;CachedResourceClientWalker.h&quot;
</span><span class="cx"> #include &quot;CachedResourceLoader.h&quot;
</span><ins>+#include &quot;ResourceBuffer.h&quot;
</ins><span class="cx"> #include &quot;SharedBuffer.h&quot;
</span><span class="cx"> #include &quot;TextResourceDecoder.h&quot;
</span><span class="cx"> #include &lt;wtf/Vector.h&gt;
</span><span class="lines">@@ -43,26 +44,24 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CachedTextTrack::updateData(SharedBuffer* data)
</del><ins>+CachedTextTrack::~CachedTextTrack()
</ins><span class="cx"> {
</span><del>-    ASSERT(dataBufferingPolicy() == BufferData);
</del><ins>+}
+
+void CachedTextTrack::addDataBuffer(ResourceBuffer* data)
+{
+    ASSERT(m_options.dataBufferingPolicy() == BufferData);
</ins><span class="cx">     m_data = data;
</span><del>-    setEncodedSize(data ? data-&gt;size() : 0);
</del><ins>+    setEncodedSize(m_data.get() ? m_data-&gt;size() : 0);
</ins><span class="cx"> 
</span><span class="cx">     CachedResourceClientWalker&lt;CachedResourceClient&gt; walker(m_clients);
</span><del>-    while (CachedResourceClient* client = walker.next())
</del><ins>+    while (CachedResourceClient *client = walker.next())
</ins><span class="cx">         client-&gt;deprecatedDidReceiveCachedResource(this);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CachedTextTrack::addDataBuffer(SharedBuffer&amp; data)
</del><ins>+void CachedTextTrack::finishLoading(ResourceBuffer* data)
</ins><span class="cx"> {
</span><del>-    updateData(&amp;data);
-    CachedResource::addDataBuffer(data);
-}
-
-void CachedTextTrack::finishLoading(SharedBuffer* data)
-{
-    updateData(data);
</del><ins>+    addDataBuffer(data);
</ins><span class="cx">     CachedResource::finishLoading(data);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercacheCachedTextTrackh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cache/CachedTextTrack.h (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/CachedTextTrack.h        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebCore/loader/cache/CachedTextTrack.h        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -36,13 +36,12 @@
</span><span class="cx"> class CachedTextTrack final : public CachedResource {
</span><span class="cx"> public:
</span><span class="cx">     CachedTextTrack(const ResourceRequest&amp;, SessionID);
</span><ins>+    virtual ~CachedTextTrack();
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     virtual bool mayTryReplaceEncodedData() const override { return true; }
</span><del>-    virtual void addDataBuffer(SharedBuffer&amp;) override;
-    virtual void finishLoading(SharedBuffer*) override;
-
-    void updateData(SharedBuffer*);
</del><ins>+    virtual void addDataBuffer(ResourceBuffer*) override;
+    virtual void finishLoading(ResourceBuffer*) override;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercacheCachedXSLStyleSheetcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cache/CachedXSLStyleSheet.cpp (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/CachedXSLStyleSheet.cpp        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebCore/loader/cache/CachedXSLStyleSheet.cpp        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -29,7 +29,7 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;CachedResourceClientWalker.h&quot;
</span><span class="cx"> #include &quot;CachedStyleSheetClient.h&quot;
</span><del>-#include &quot;SharedBuffer.h&quot;
</del><ins>+#include &quot;ResourceBuffer.h&quot;
</ins><span class="cx"> #include &quot;TextResourceDecoder.h&quot;
</span><span class="cx"> #include &lt;wtf/Vector.h&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -46,10 +46,6 @@
</span><span class="cx">     setAccept(&quot;text/xml, application/xml, application/xhtml+xml, text/xsl, application/rss+xml, application/atom+xml&quot;);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-CachedXSLStyleSheet::~CachedXSLStyleSheet()
-{
-}
-
</del><span class="cx"> void CachedXSLStyleSheet::didAddClient(CachedResourceClient* c)
</span><span class="cx"> {  
</span><span class="cx">     ASSERT(c-&gt;resourceClientType() == CachedStyleSheetClient::expectedType());
</span><span class="lines">@@ -67,12 +63,12 @@
</span><span class="cx">     return m_decoder-&gt;encoding().name();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CachedXSLStyleSheet::finishLoading(SharedBuffer* data)
</del><ins>+void CachedXSLStyleSheet::finishLoading(ResourceBuffer* data)
</ins><span class="cx"> {
</span><span class="cx">     m_data = data;
</span><del>-    setEncodedSize(data ? data-&gt;size() : 0);
-    if (data)
-        m_sheet = m_decoder-&gt;decodeAndFlush(data-&gt;data(), encodedSize());
</del><ins>+    setEncodedSize(m_data.get() ? m_data-&gt;size() : 0);
+    if (m_data.get())
+        m_sheet = m_decoder-&gt;decodeAndFlush(m_data-&gt;data(), encodedSize());
</ins><span class="cx">     setLoading(false);
</span><span class="cx">     checkNotify();
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercacheCachedXSLStyleSheeth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cache/CachedXSLStyleSheet.h (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/CachedXSLStyleSheet.h        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebCore/loader/cache/CachedXSLStyleSheet.h        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -29,30 +29,35 @@
</span><span class="cx"> #if ENABLE(XSLT)
</span><span class="cx"> 
</span><span class="cx"> #include &quot;CachedResource.h&quot;
</span><ins>+#include &lt;wtf/Vector.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-class TextResourceDecoder;
</del><ins>+    class CachedResourceLoader;
+    class TextResourceDecoder;
</ins><span class="cx"> 
</span><del>-class CachedXSLStyleSheet final : public CachedResource {
-public:
-    CachedXSLStyleSheet(const ResourceRequest&amp;, SessionID);
-    virtual ~CachedXSLStyleSheet();
</del><ins>+    class CachedXSLStyleSheet final : public CachedResource {
+    public:
+        CachedXSLStyleSheet(const ResourceRequest&amp;, SessionID);
</ins><span class="cx"> 
</span><del>-    const String&amp; sheet() const { return m_sheet; }
</del><ins>+        const String&amp; sheet() const { return m_sheet; }
</ins><span class="cx"> 
</span><del>-private:
-    virtual void checkNotify() override;
-    virtual bool mayTryReplaceEncodedData() const override { return true; }
-    virtual void didAddClient(CachedResourceClient*) override;
-    virtual void setEncoding(const String&amp;) override;
-    virtual String encoding() const override;
-    virtual void finishLoading(SharedBuffer*) override;
</del><ins>+    protected:
+        virtual void checkNotify() override;
</ins><span class="cx"> 
</span><del>-    String m_sheet;
-    RefPtr&lt;TextResourceDecoder&gt; m_decoder;
-};
</del><ins>+        String m_sheet;
+        RefPtr&lt;TextResourceDecoder&gt; m_decoder;
</ins><span class="cx"> 
</span><ins>+    private:
+        virtual bool mayTryReplaceEncodedData() const override { return true; }
+
+        virtual void didAddClient(CachedResourceClient*) override;
+
+        virtual void setEncoding(const String&amp;) override;
+        virtual String encoding() const override;
+        virtual void finishLoading(ResourceBuffer*) override;
+    };
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> SPECIALIZE_TYPE_TRAITS_CACHED_RESOURCE(CachedXSLStyleSheet, CachedResource::XSLStyleSheet)
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercfSubresourceLoaderCFcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cf/SubresourceLoaderCF.cpp (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cf/SubresourceLoaderCF.cpp        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebCore/loader/cf/SubresourceLoaderCF.cpp        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -51,8 +51,8 @@
</span><span class="cx">             // being cancelled. Bail out if we no longer have a cached resource.
</span><span class="cx">             if (!m_resource)
</span><span class="cx">                 return;
</span><del>-            if (auto* resourceData = this-&gt;resourceData())
-                m_resource-&gt;addDataBuffer(*resourceData);
</del><ins>+            if (ResourceBuffer* resourceData = this-&gt;resourceData())
+                m_resource-&gt;addDataBuffer(resourceData);
</ins><span class="cx">             else {
</span><span class="cx">                 CFDataRef cfData = reinterpret_cast&lt;CFDataRef&gt;(CFArrayGetValueAtIndex(dataArray, i));
</span><span class="cx">                 const char* data = reinterpret_cast&lt;const char *&gt;(CFDataGetBytePtr(cfData));
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercocoaDiskCacheMonitorCocoah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cocoa/DiskCacheMonitorCocoa.h (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cocoa/DiskCacheMonitorCocoa.h        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebCore/loader/cocoa/DiskCacheMonitorCocoa.h        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -45,7 +45,7 @@
</span><span class="cx"> protected:
</span><span class="cx">     WEBCORE_EXPORT DiskCacheMonitor(const ResourceRequest&amp;, SessionID, CFCachedURLResponseRef);
</span><span class="cx"> 
</span><del>-    virtual void resourceBecameFileBacked(SharedBuffer&amp;);
</del><ins>+    virtual void resourceBecameFileBacked(PassRefPtr&lt;SharedBuffer&gt;);
</ins><span class="cx"> 
</span><span class="cx">     const ResourceRequest&amp; resourceRequest() const { return m_resourceRequest; }
</span><span class="cx">     SessionID sessionID() const { return m_sessionID; }
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercocoaDiskCacheMonitorCocoamm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cocoa/DiskCacheMonitorCocoa.mm (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cocoa/DiskCacheMonitorCocoa.mm        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebCore/loader/cocoa/DiskCacheMonitorCocoa.mm        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -103,7 +103,7 @@
</span><span class="cx">         if (!fileBackedBuffer)
</span><span class="cx">             return;
</span><span class="cx"> 
</span><del>-        monitor-&gt;resourceBecameFileBacked(*fileBackedBuffer);
</del><ins>+        monitor-&gt;resourceBecameFileBacked(fileBackedBuffer);
</ins><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx"> #if USE(WEB_THREAD)
</span><span class="lines">@@ -121,7 +121,7 @@
</span><span class="cx">     _CFCachedURLResponseSetBecameFileBackedCallBackBlock(cachedResponse, blockToRun, dispatch_get_main_queue());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void DiskCacheMonitor::resourceBecameFileBacked(SharedBuffer&amp; fileBackedBuffer)
</del><ins>+void DiskCacheMonitor::resourceBecameFileBacked(PassRefPtr&lt;SharedBuffer&gt; fileBackedBuffer)
</ins><span class="cx"> {
</span><span class="cx">     CachedResource* resource = memoryCache()-&gt;resourceForRequest(m_resourceRequest, m_sessionID);
</span><span class="cx">     if (!resource)
</span></span></pre></div>
<a id="trunkSourceWebCoreloadericonIconLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/icon/IconLoader.cpp (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/icon/IconLoader.cpp        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebCore/loader/icon/IconLoader.cpp        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -37,6 +37,7 @@
</span><span class="cx"> #include &quot;IconController.h&quot;
</span><span class="cx"> #include &quot;IconDatabase.h&quot;
</span><span class="cx"> #include &quot;Logging.h&quot;
</span><ins>+#include &quot;ResourceBuffer.h&quot;
</ins><span class="cx"> #include &quot;ResourceRequest.h&quot;
</span><span class="cx"> #include &quot;SharedBuffer.h&quot;
</span><span class="cx"> #include &lt;wtf/text/CString.h&gt;
</span><span class="lines">@@ -84,16 +85,16 @@
</span><span class="cx"> 
</span><span class="cx">     // If we got a status code indicating an invalid response, then lets
</span><span class="cx">     // ignore the data and not try to decode the error page as an icon.
</span><del>-    auto* data = resource-&gt;resourceBuffer();
</del><ins>+    RefPtr&lt;ResourceBuffer&gt; data = resource-&gt;resourceBuffer();
</ins><span class="cx">     int status = resource-&gt;response().httpStatusCode();
</span><span class="cx">     if (status &amp;&amp; (status &lt; 200 || status &gt; 299))
</span><del>-        data = nullptr;
</del><ins>+        data = 0;
</ins><span class="cx"> 
</span><span class="cx">     static const char pdfMagicNumber[] = &quot;%PDF&quot;;
</span><span class="cx">     static unsigned pdfMagicNumberLength = sizeof(pdfMagicNumber) - 1;
</span><span class="cx">     if (data &amp;&amp; data-&gt;size() &gt;= pdfMagicNumberLength &amp;&amp; !memcmp(data-&gt;data(), pdfMagicNumber, pdfMagicNumberLength)) {
</span><span class="cx">         LOG(IconDatabase, &quot;IconLoader::finishLoading() - Ignoring icon at %s because it appears to be a PDF&quot;, resource-&gt;url().string().ascii().data());
</span><del>-        data = nullptr;
</del><ins>+        data = 0;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     LOG(IconDatabase, &quot;IconLoader::finishLoading() - Committing iconURL %s to database&quot;, resource-&gt;url().string().ascii().data());
</span><span class="lines">@@ -101,7 +102,7 @@
</span><span class="cx">     // Setting the icon data only after committing to the database ensures that the data is
</span><span class="cx">     // kept in memory (so it does not have to be read from the database asynchronously), since
</span><span class="cx">     // there is a page URL referencing it.
</span><del>-    iconDatabase().setIconDataForIconURL(data, resource-&gt;url().string());
</del><ins>+    iconDatabase().setIconDataForIconURL(data ? data-&gt;sharedBuffer() : 0, resource-&gt;url().string());
</ins><span class="cx">     m_frame.loader().client().dispatchDidReceiveIcon();
</span><span class="cx">     stopLoading();
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreloadermacResourceBuffermm"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/loader/mac/ResourceBuffer.mm (0 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/mac/ResourceBuffer.mm                                (rev 0)
+++ trunk/Source/WebCore/loader/mac/ResourceBuffer.mm        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -0,0 +1,46 @@
</span><ins>+/*
+ * Copyright (C) 2012 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. ``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
+ * 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;ResourceBuffer.h&quot;
+
+#include &quot;SharedBuffer.h&quot;
+
+namespace WebCore {
+
+RetainPtr&lt;NSData&gt; ResourceBuffer::createNSData()
+{
+    return m_sharedBuffer-&gt;createNSData();
+}
+
+void ResourceBuffer::tryReplaceSharedBufferContents(SharedBuffer* newContents)
+{
+    if (!m_sharedBuffer)
+        m_sharedBuffer = newContents;
+    else
+        m_sharedBuffer-&gt;tryReplaceContentsWithPlatformBuffer(newContents);
+}
+
+} // namespace WebCore
</ins></span></pre></div>
<a id="trunkSourceWebCoreloadermacResourceLoaderMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/mac/ResourceLoaderMac.mm (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/mac/ResourceLoaderMac.mm        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebCore/loader/mac/ResourceLoaderMac.mm        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -31,10 +31,10 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;FrameLoader.h&quot;
</span><span class="cx"> #include &quot;FrameLoaderClient.h&quot;
</span><del>-#include &quot;SharedBuffer.h&quot;
</del><span class="cx"> 
</span><span class="cx"> #if USE(NETWORK_CFDATA_ARRAY_CALLBACK)
</span><span class="cx"> #include &quot;InspectorInstrumentation.h&quot;
</span><ins>+#include &quot;ResourceBuffer.h&quot;
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if USE(CFNETWORK)
</span><span class="lines">@@ -83,7 +83,7 @@
</span><span class="cx"> 
</span><span class="cx">         if (m_options.dataBufferingPolicy() == BufferData) {
</span><span class="cx">             if (!m_resourceData)
</span><del>-                m_resourceData = SharedBuffer::create();
</del><ins>+                m_resourceData = ResourceBuffer::create();
</ins><span class="cx">             m_resourceData-&gt;append(data);
</span><span class="cx">         }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformSharedBuffercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/SharedBuffer.cpp (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/SharedBuffer.cpp        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebCore/platform/SharedBuffer.cpp        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -33,7 +33,6 @@
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> #if !USE(NETWORK_CFDATA_ARRAY_CALLBACK)
</span><del>-
</del><span class="cx"> static const unsigned segmentSize = 0x1000;
</span><span class="cx"> static const unsigned segmentPositionMask = 0x0FFF;
</span><span class="cx"> 
</span><span class="lines">@@ -57,7 +56,6 @@
</span><span class="cx"> {
</span><span class="cx">     fastFree(p);
</span><span class="cx"> }
</span><del>-
</del><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> SharedBuffer::SharedBuffer()
</span><span class="lines">@@ -216,8 +214,9 @@
</span><span class="cx">     clearPlatformData();
</span><span class="cx">     
</span><span class="cx"> #if !USE(NETWORK_CFDATA_ARRAY_CALLBACK)
</span><del>-    for (char* segment : m_segments)
-        freeSegment(segment);
</del><ins>+    for (unsigned i = 0; i &lt; m_segments.size(); ++i)
+        freeSegment(m_segments[i]);
+
</ins><span class="cx">     m_segments.clear();
</span><span class="cx"> #else
</span><span class="cx">     m_dataArray.clear();
</span><span class="lines">@@ -227,26 +226,24 @@
</span><span class="cx">     clearDataBuffer();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-PassRef&lt;SharedBuffer&gt; SharedBuffer::copy() const
</del><ins>+PassRefPtr&lt;SharedBuffer&gt; SharedBuffer::copy() const
</ins><span class="cx"> {
</span><del>-    PassRef&lt;SharedBuffer&gt; clone { adoptRef(*new SharedBuffer) };
</del><ins>+    RefPtr&lt;SharedBuffer&gt; clone(adoptRef(new SharedBuffer));
</ins><span class="cx">     if (hasPlatformData()) {
</span><del>-        clone.get().append(data(), size());
</del><ins>+        clone-&gt;append(data(), size());
</ins><span class="cx">         return clone;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    clone.get().m_size = m_size;
-    clone.get().m_buffer-&gt;data.reserveCapacity(m_size);
-    clone.get().m_buffer-&gt;data.append(m_buffer-&gt;data.data(), m_buffer-&gt;data.size());
-
</del><ins>+    clone-&gt;m_size = m_size;
+    clone-&gt;m_buffer-&gt;data.reserveCapacity(m_size);
+    clone-&gt;m_buffer-&gt;data.append(m_buffer-&gt;data.data(), m_buffer-&gt;data.size());
</ins><span class="cx"> #if !USE(NETWORK_CFDATA_ARRAY_CALLBACK)
</span><del>-    for (char* segment : m_segments)
-        clone.get().m_buffer-&gt;data.append(segment, segmentSize);
</del><ins>+    for (unsigned i = 0; i &lt; m_segments.size(); ++i)
+        clone-&gt;m_buffer-&gt;data.append(m_segments[i], segmentSize);
</ins><span class="cx"> #else
</span><del>-    for (auto&amp; data : m_dataArray)
-        clone.get().append(data.get());
</del><ins>+    for (unsigned i = 0; i &lt; m_dataArray.size(); ++i)
+        clone-&gt;append(m_dataArray[i].get());
</ins><span class="cx"> #endif
</span><del>-
</del><span class="cx">     return clone;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -278,19 +275,17 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if !USE(NETWORK_CFDATA_ARRAY_CALLBACK)
</span><del>-
</del><span class="cx"> void SharedBuffer::copyBufferAndClear(char* destination, unsigned bytesToCopy) const
</span><span class="cx"> {
</span><del>-    for (char* segment : m_segments) {
</del><ins>+    for (unsigned i = 0; i &lt; m_segments.size(); ++i) {
</ins><span class="cx">         unsigned effectiveBytesToCopy = std::min(bytesToCopy, segmentSize);
</span><del>-        memcpy(destination, segment, effectiveBytesToCopy);
</del><ins>+        memcpy(destination, m_segments[i], effectiveBytesToCopy);
</ins><span class="cx">         destination += effectiveBytesToCopy;
</span><span class="cx">         bytesToCopy -= effectiveBytesToCopy;
</span><del>-        freeSegment(segment);
</del><ins>+        freeSegment(m_segments[i]);
</ins><span class="cx">     }
</span><span class="cx">     m_segments.clear();
</span><span class="cx"> }
</span><del>-
</del><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> const Vector&lt;char&gt;&amp; SharedBuffer::buffer() const
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformSharedBufferh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/SharedBuffer.h (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/SharedBuffer.h        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebCore/platform/SharedBuffer.h        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -102,7 +102,7 @@
</span><span class="cx">     void append(CFDataRef);
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    PassRef&lt;SharedBuffer&gt; copy() const;
</del><ins>+    PassRefPtr&lt;SharedBuffer&gt; copy() const;
</ins><span class="cx">     
</span><span class="cx">     // Return the number of consecutive bytes after &quot;position&quot;. &quot;data&quot;
</span><span class="cx">     // points to the first byte.
</span><span class="lines">@@ -118,7 +118,7 @@
</span><span class="cx">     //      }
</span><span class="cx">     WEBCORE_EXPORT unsigned getSomeData(const char*&amp; data, unsigned position = 0) const;
</span><span class="cx"> 
</span><del>-    void tryReplaceContentsWithPlatformBuffer(SharedBuffer&amp;);
</del><ins>+    void tryReplaceContentsWithPlatformBuffer(SharedBuffer*);
</ins><span class="cx">     WEBCORE_EXPORT bool hasPlatformData() const;
</span><span class="cx"> 
</span><span class="cx">     struct DataBuffer : public ThreadSafeRefCounted&lt;DataBuffer&gt; {
</span><span class="lines">@@ -158,7 +158,6 @@
</span><span class="cx"> #else
</span><span class="cx">     mutable Vector&lt;char*&gt; m_segments;
</span><span class="cx"> #endif
</span><del>-
</del><span class="cx"> #if USE(CF)
</span><span class="cx">     explicit SharedBuffer(CFDataRef);
</span><span class="cx">     RetainPtr&lt;CFDataRef&gt; m_cfData;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformcfSharedBufferCFcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/cf/SharedBufferCF.cpp (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/cf/SharedBufferCF.cpp        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebCore/platform/cf/SharedBufferCF.cpp        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -92,13 +92,13 @@
</span><span class="cx">     m_cfData = 0;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void SharedBuffer::tryReplaceContentsWithPlatformBuffer(SharedBuffer&amp; newContents)
</del><ins>+void SharedBuffer::tryReplaceContentsWithPlatformBuffer(SharedBuffer* newContents)
</ins><span class="cx"> {
</span><del>-    if (!newContents.m_cfData)
</del><ins>+    if (!newContents-&gt;m_cfData)
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     clear();
</span><del>-    m_cfData = newContents.m_cfData;
</del><ins>+    m_cfData = newContents-&gt;m_cfData;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool SharedBuffer::maybeAppendPlatformData(SharedBuffer* newContents)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsPlatformMediaResourceLoaderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/PlatformMediaResourceLoader.h (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/PlatformMediaResourceLoader.h        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebCore/platform/graphics/PlatformMediaResourceLoader.h        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -27,7 +27,6 @@
</span><span class="cx"> #define PlatformMediaResourceLoader_h
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(VIDEO)
</span><del>-
</del><span class="cx"> #include &lt;wtf/Noncopyable.h&gt;
</span><span class="cx"> #include &lt;wtf/RefCounted.h&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -36,6 +35,7 @@
</span><span class="cx"> class ResourceError;
</span><span class="cx"> class ResourceRequest;
</span><span class="cx"> class ResourceResponse;
</span><ins>+class SharedBuffer;
</ins><span class="cx"> 
</span><span class="cx"> class PlatformMediaResourceLoaderClient {
</span><span class="cx"> public:
</span><span class="lines">@@ -43,9 +43,10 @@
</span><span class="cx"> 
</span><span class="cx">     virtual void responseReceived(const ResourceResponse&amp;) { }
</span><span class="cx">     virtual void dataReceived(const char*, int) { }
</span><ins>+    virtual void bufferReceived(SharedBuffer*) { }
</ins><span class="cx">     virtual void accessControlCheckFailed(const ResourceError&amp;) { }
</span><span class="cx">     virtual void loadFailed(const ResourceError&amp;) { }
</span><del>-    virtual void loadFinished() { }
</del><ins>+    virtual void loadFinished(SharedBuffer*) { }
</ins><span class="cx"> #if USE(SOUP)
</span><span class="cx">     virtual char* getOrCreateReadBuffer(size_t /*requestedSize*/, size_t&amp; /*actualSize*/) { return nullptr; };
</span><span class="cx"> #endif
</span><span class="lines">@@ -67,7 +68,7 @@
</span><span class="cx">     virtual bool didPassAccessControlCheck() const { return false; }
</span><span class="cx"> 
</span><span class="cx"> protected:
</span><del>-    explicit PlatformMediaResourceLoader(std::unique_ptr&lt;PlatformMediaResourceLoaderClient&gt; client)
</del><ins>+    PlatformMediaResourceLoader(std::unique_ptr&lt;PlatformMediaResourceLoaderClient&gt; client)
</ins><span class="cx">         : m_client(WTF::move(client))
</span><span class="cx">     {
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsavfoundationcfWebCoreAVCFResourceLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/avfoundation/cf/WebCoreAVCFResourceLoader.cpp (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/avfoundation/cf/WebCoreAVCFResourceLoader.cpp        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/cf/WebCoreAVCFResourceLoader.cpp        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -33,6 +33,7 @@
</span><span class="cx"> #include &quot;CachedResourceRequest.h&quot;
</span><span class="cx"> #include &quot;MediaPlayerPrivateAVFoundationCF.h&quot;
</span><span class="cx"> #include &quot;NotImplemented.h&quot;
</span><ins>+#include &quot;ResourceBuffer.h&quot;
</ins><span class="cx"> #include &quot;ResourceLoaderOptions.h&quot;
</span><span class="cx"> #include &quot;SharedBuffer.h&quot;
</span><span class="cx"> #include &quot;SoftLinking.h&quot;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsavfoundationobjcWebCoreAVFResourceLoadermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -32,6 +32,7 @@
</span><span class="cx"> #import &quot;CachedResourceLoader.h&quot;
</span><span class="cx"> #import &quot;CachedResourceRequest.h&quot;
</span><span class="cx"> #import &quot;MediaPlayerPrivateAVFoundationObjC.h&quot;
</span><ins>+#import &quot;ResourceBuffer.h&quot;
</ins><span class="cx"> #import &quot;ResourceLoaderOptions.h&quot;
</span><span class="cx"> #import &quot;SharedBuffer.h&quot;
</span><span class="cx"> #import &quot;SoftLinking.h&quot;
</span><span class="lines">@@ -151,7 +152,7 @@
</span><span class="cx">     if (!dataRequest)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    SharedBuffer* data = resource-&gt;resourceBuffer();
</del><ins>+    SharedBuffer* data = resource-&gt;resourceBuffer() ? resource-&gt;resourceBuffer()-&gt;sharedBuffer() : 0;
</ins><span class="cx">     if (!data)
</span><span class="cx">         return;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsgstreamerWebKitWebSourceGStreamercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -74,7 +74,7 @@
</span><span class="cx">         virtual void dataReceived(const char*, int) override;
</span><span class="cx">         virtual void accessControlCheckFailed(const ResourceError&amp;) override;
</span><span class="cx">         virtual void loadFailed(const ResourceError&amp;) override;
</span><del>-        virtual void loadFinished() override;
</del><ins>+        virtual void loadFinished(SharedBuffer*) override;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> class ResourceHandleStreamingClient : public ResourceHandleClient, public StreamingClient {
</span><span class="lines">@@ -1031,7 +1031,7 @@
</span><span class="cx">     gst_app_src_end_of_stream(src-&gt;priv-&gt;appsrc);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CachedResourceStreamingClient::loadFinished()
</del><ins>+void CachedResourceStreamingClient::loadFinished(SharedBuffer*)
</ins><span class="cx"> {
</span><span class="cx">     handleNotifyFinished();
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmacPasteboardMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mac/PasteboardMac.mm (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mac/PasteboardMac.mm        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebCore/platform/mac/PasteboardMac.mm        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -51,6 +51,7 @@
</span><span class="cx"> #import &quot;PasteboardStrategy.h&quot;
</span><span class="cx"> #import &quot;PlatformStrategies.h&quot;
</span><span class="cx"> #import &quot;RenderImage.h&quot;
</span><ins>+#import &quot;ResourceBuffer.h&quot;
</ins><span class="cx"> #import &quot;Text.h&quot;
</span><span class="cx"> #import &quot;WebCoreNSStringExtras.h&quot;
</span><span class="cx"> #import &quot;WebNSAttributedStringExtras.h&quot;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformsoupSharedBufferSoupcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/soup/SharedBufferSoup.cpp (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/soup/SharedBufferSoup.cpp        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebCore/platform/soup/SharedBufferSoup.cpp        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -44,6 +44,11 @@
</span><span class="cx">     m_soupBuffer.reset();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void SharedBuffer::tryReplaceContentsWithPlatformBuffer(SharedBuffer*)
+{
+    ASSERT_NOT_REACHED();
+}
+
</ins><span class="cx"> void SharedBuffer::maybeTransferPlatformData()
</span><span class="cx"> {
</span><span class="cx">     if (!m_soupBuffer)
</span></span></pre></div>
<a id="trunkSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/ChangeLog (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/ChangeLog        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebKit/mac/ChangeLog        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -1,3 +1,23 @@
</span><ins>+2014-11-03  Commit Queue  &lt;commit-queue@webkit.org&gt;
+
+        Unreviewed, rolling out r175406, r175413, and r175423.
+        https://bugs.webkit.org/show_bug.cgi?id=138327
+
+        Multipart tests are still broken (Requested by ap on #webkit).
+
+        Reverted changesets:
+
+        &quot;Eliminate ResourceBuffer and use SharedBuffer directly
+        instead&quot;
+        https://bugs.webkit.org/show_bug.cgi?id=138174
+        http://trac.webkit.org/changeset/175406
+
+        &quot;Unreviewed, iOS build fix since 175406.&quot;
+        http://trac.webkit.org/changeset/175413
+
+        &quot;Fix assertion in CachedResource::addDataBuffer&quot;
+        http://trac.webkit.org/changeset/175423
+
</ins><span class="cx"> 2014-10-31  Gyuyoung Kim  &lt;gyuyoung.kim@samsung.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Use std::unique_ptr for TypeCountSet
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebDataSourcemm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebDataSource.mm (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebDataSource.mm        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebKit/mac/WebView/WebDataSource.mm        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -53,6 +53,7 @@
</span><span class="cx"> #import &lt;WebCore/URL.h&gt;
</span><span class="cx"> #import &lt;WebCore/LegacyWebArchive.h&gt;
</span><span class="cx"> #import &lt;WebCore/MIMETypeRegistry.h&gt;
</span><ins>+#import &lt;WebCore/ResourceBuffer.h&gt;
</ins><span class="cx"> #import &lt;WebCore/ResourceRequest.h&gt;
</span><span class="cx"> #import &lt;WebCore/SharedBuffer.h&gt;
</span><span class="cx"> #import &lt;WebCore/WebCoreObjCExtras.h&gt;
</span><span class="lines">@@ -458,7 +459,7 @@
</span><span class="cx"> 
</span><span class="cx"> - (NSData *)data
</span><span class="cx"> {
</span><del>-    RefPtr&lt;SharedBuffer&gt; mainResourceData = toPrivate(_private)-&gt;loader-&gt;mainResourceData();
</del><ins>+    RefPtr&lt;ResourceBuffer&gt; mainResourceData = toPrivate(_private)-&gt;loader-&gt;mainResourceData();
</ins><span class="cx">     if (!mainResourceData)
</span><span class="cx">         return nil;
</span><span class="cx">     return mainResourceData-&gt;createNSData().autorelease();
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebHTMLViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebHTMLView.mm (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebHTMLView.mm        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebKit/mac/WebView/WebHTMLView.mm        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -108,6 +108,7 @@
</span><span class="cx"> #import &lt;WebCore/Range.h&gt;
</span><span class="cx"> #import &lt;WebCore/RenderView.h&gt;
</span><span class="cx"> #import &lt;WebCore/RenderWidget.h&gt;
</span><ins>+#import &lt;WebCore/ResourceBuffer.h&gt;
</ins><span class="cx"> #import &lt;WebCore/RuntimeApplicationChecks.h&gt;
</span><span class="cx"> #import &lt;WebCore/SharedBuffer.h&gt;
</span><span class="cx"> #import &lt;WebCore/SimpleFontData.h&gt;
</span><span class="lines">@@ -3954,7 +3955,7 @@
</span><span class="cx">     NSURL *draggingImageURL = nil;
</span><span class="cx">     
</span><span class="cx">     if (WebCore::CachedImage* tiffResource = [self promisedDragTIFFDataSource]) {
</span><del>-        if (auto* buffer = tiffResource-&gt;resourceBuffer()) {
</del><ins>+        if (ResourceBuffer *buffer = static_cast&lt;CachedResource*&gt;(tiffResource)-&gt;resourceBuffer()) {
</ins><span class="cx">             NSURLResponse *response = tiffResource-&gt;response().nsURLResponse();
</span><span class="cx">             draggingImageURL = [response URL];
</span><span class="cx">             wrapper = [[[NSFileWrapper alloc] initRegularFileWithContents:buffer-&gt;createNSData().get()] autorelease];
</span></span></pre></div>
<a id="trunkSourceWebKitwinChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/win/ChangeLog (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/win/ChangeLog        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebKit/win/ChangeLog        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -1,3 +1,23 @@
</span><ins>+2014-11-03  Commit Queue  &lt;commit-queue@webkit.org&gt;
+
+        Unreviewed, rolling out r175406, r175413, and r175423.
+        https://bugs.webkit.org/show_bug.cgi?id=138327
+
+        Multipart tests are still broken (Requested by ap on #webkit).
+
+        Reverted changesets:
+
+        &quot;Eliminate ResourceBuffer and use SharedBuffer directly
+        instead&quot;
+        https://bugs.webkit.org/show_bug.cgi?id=138174
+        http://trac.webkit.org/changeset/175406
+
+        &quot;Unreviewed, iOS build fix since 175406.&quot;
+        http://trac.webkit.org/changeset/175413
+
+        &quot;Fix assertion in CachedResource::addDataBuffer&quot;
+        http://trac.webkit.org/changeset/175423
+
</ins><span class="cx"> 2014-11-03  Sungmann Cho  &lt;sungmann.cho@navercorp.com&gt;
</span><span class="cx"> 
</span><span class="cx">         AX: Fix some minor typos related to the word &quot;accessibility&quot;.
</span></span></pre></div>
<a id="trunkSourceWebKitwinWebDataSourcecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/win/WebDataSource.cpp (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/win/WebDataSource.cpp        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebKit/win/WebDataSource.cpp        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -45,6 +45,7 @@
</span><span class="cx"> #include &lt;WebCore/Frame.h&gt;
</span><span class="cx"> #include &lt;WebCore/FrameLoader.h&gt;
</span><span class="cx"> #include &lt;WebCore/URL.h&gt;
</span><ins>+#include &lt;WebCore/ResourceBuffer.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> using namespace WebCore;
</span><span class="cx"> 
</span><span class="lines">@@ -180,7 +181,8 @@
</span><span class="cx">     if (!m_loader)
</span><span class="cx">         return E_FAIL;
</span><span class="cx"> 
</span><del>-    return MemoryStream::createInstance(m_loader-&gt;mainResourceData()).copyRefTo(stream);
</del><ins>+    RefPtr&lt;ResourceBuffer&gt; buffer = m_loader-&gt;mainResourceData();
+    return MemoryStream::createInstance(buffer ? buffer-&gt;sharedBuffer() : 0).copyRefTo(stream);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> HRESULT WebDataSource::representation(/* [retval][out] */ IWebDocumentRepresentation** rep)
</span><span class="lines">@@ -301,7 +303,8 @@
</span><span class="cx">     if (!cachedResource)
</span><span class="cx">         return E_FAIL;
</span><span class="cx"> 
</span><del>-    *resource = WebResource::createInstance(cachedResource-&gt;resourceBuffer(), cachedResource-&gt;response());
</del><ins>+    ResourceBuffer* buffer = cachedResource-&gt;resourceBuffer();
+    *resource = WebResource::createInstance(buffer ? buffer-&gt;sharedBuffer() : 0, cachedResource-&gt;response());
</ins><span class="cx">     return S_OK;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2CMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/CMakeLists.txt (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/CMakeLists.txt        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebKit2/CMakeLists.txt        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -235,6 +235,7 @@
</span><span class="cx">     Shared/WebProcessCreationParameters.cpp
</span><span class="cx">     Shared/WebRenderLayer.cpp
</span><span class="cx">     Shared/WebRenderObject.cpp
</span><ins>+    Shared/WebResourceBuffer.cpp
</ins><span class="cx">     Shared/WebTouchEvent.cpp
</span><span class="cx">     Shared/WebWheelEvent.cpp
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebKit2/ChangeLog        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -1,3 +1,23 @@
</span><ins>+2014-11-03  Commit Queue  &lt;commit-queue@webkit.org&gt;
+
+        Unreviewed, rolling out r175406, r175413, and r175423.
+        https://bugs.webkit.org/show_bug.cgi?id=138327
+
+        Multipart tests are still broken (Requested by ap on #webkit).
+
+        Reverted changesets:
+
+        &quot;Eliminate ResourceBuffer and use SharedBuffer directly
+        instead&quot;
+        https://bugs.webkit.org/show_bug.cgi?id=138174
+        http://trac.webkit.org/changeset/175406
+
+        &quot;Unreviewed, iOS build fix since 175406.&quot;
+        http://trac.webkit.org/changeset/175413
+
+        &quot;Fix assertion in CachedResource::addDataBuffer&quot;
+        http://trac.webkit.org/changeset/175423
+
</ins><span class="cx"> 2014-11-03  Tim Horton  &lt;timothy_horton@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         _actionMenuItemsForHitTestResult is given kWKActionMenuLink but an empty array of defaultMenuItems
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcessNetworkResourceLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -45,6 +45,7 @@
</span><span class="cx"> #include &lt;WebCore/BlobDataFileReference.h&gt;
</span><span class="cx"> #include &lt;WebCore/CertificateInfo.h&gt;
</span><span class="cx"> #include &lt;WebCore/NotImplemented.h&gt;
</span><ins>+#include &lt;WebCore/ResourceBuffer.h&gt;
</ins><span class="cx"> #include &lt;WebCore/ResourceHandle.h&gt;
</span><span class="cx"> #include &lt;WebCore/SharedBuffer.h&gt;
</span><span class="cx"> #include &lt;WebCore/SynchronousLoaderClient.h&gt;
</span><span class="lines">@@ -408,20 +409,18 @@
</span><span class="cx"> 
</span><span class="cx"> void NetworkResourceLoader::sendBuffer(WebCore::SharedBuffer* buffer, int encodedDataLength)
</span><span class="cx"> {
</span><del>-    ASSERT(buffer);
</del><span class="cx">     ASSERT(!isSynchronous());
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS) || (PLATFORM(MAC) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 1090)
</span><span class="cx">     ShareableResource::Handle shareableResourceHandle;
</span><del>-    NetworkResourceLoader::tryGetShareableHandleFromSharedBuffer(shareableResourceHandle, *buffer);
</del><ins>+    NetworkResourceLoader::tryGetShareableHandleFromSharedBuffer(shareableResourceHandle, buffer);
</ins><span class="cx">     if (!shareableResourceHandle.isNull()) {
</span><del>-        // Since we're delivering this resource by ourselves all at once and don't need any more data or callbacks from the network layer, abort the loader.
</del><ins>+        // Since we're delivering this resource by ourselves all at once and don't need anymore data or callbacks from the network layer, abort the loader.
</ins><span class="cx">         abort();
</span><span class="cx">         send(Messages::WebResourceLoader::DidReceiveResource(shareableResourceHandle, currentTime()));
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> #endif
</span><del>-
</del><span class="cx">     IPC::SharedBufferDataReference dataReference(buffer);
</span><span class="cx">     sendAbortingOnFailure(Messages::WebResourceLoader::DidReceiveData(dataReference, encodedDataLength));
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcessNetworkResourceLoaderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.h (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.h        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.h        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -46,6 +46,7 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> class BlobDataFileReference;
</span><ins>+class ResourceBuffer;
</ins><span class="cx"> class ResourceHandle;
</span><span class="cx"> class ResourceRequest;
</span><span class="cx"> }
</span><span class="lines">@@ -91,7 +92,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS) || (PLATFORM(MAC) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 1090)
</span><span class="cx">     static void tryGetShareableHandleFromCFURLCachedResponse(ShareableResource::Handle&amp;, CFCachedURLResponseRef);
</span><del>-    static void tryGetShareableHandleFromSharedBuffer(ShareableResource::Handle&amp;, WebCore::SharedBuffer&amp;);
</del><ins>+    static void tryGetShareableHandleFromSharedBuffer(ShareableResource::Handle&amp;, WebCore::SharedBuffer*);
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if USE(PROTECTION_SPACE_AUTH_CALLBACK)
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcessmacNetworkDiskCacheMonitorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/mac/NetworkDiskCacheMonitor.h (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/mac/NetworkDiskCacheMonitor.h        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebKit2/NetworkProcess/mac/NetworkDiskCacheMonitor.h        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -48,7 +48,7 @@
</span><span class="cx">     NetworkDiskCacheMonitor(CFCachedURLResponseRef, NetworkResourceLoader*);
</span><span class="cx"> 
</span><span class="cx">     // WebCore::DiskCacheMonitor
</span><del>-    virtual void resourceBecameFileBacked(WebCore::SharedBuffer&amp;) override;
</del><ins>+    virtual void resourceBecameFileBacked(PassRefPtr&lt;WebCore::SharedBuffer&gt;) override;
</ins><span class="cx"> 
</span><span class="cx">     // IPC::MessageSender
</span><span class="cx">     virtual IPC::Connection* messageSenderConnection() override;
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcessmacNetworkDiskCacheMonitormm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/mac/NetworkDiskCacheMonitor.mm (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/mac/NetworkDiskCacheMonitor.mm        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebKit2/NetworkProcess/mac/NetworkDiskCacheMonitor.mm        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -59,10 +59,10 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void NetworkDiskCacheMonitor::resourceBecameFileBacked(SharedBuffer&amp; fileBackedBuffer)
</del><ins>+void NetworkDiskCacheMonitor::resourceBecameFileBacked(PassRefPtr&lt;SharedBuffer&gt; fileBackedBuffer)
</ins><span class="cx"> {
</span><span class="cx">     ShareableResource::Handle handle;
</span><del>-    NetworkResourceLoader::tryGetShareableHandleFromSharedBuffer(handle, fileBackedBuffer);
</del><ins>+    NetworkResourceLoader::tryGetShareableHandleFromSharedBuffer(handle, fileBackedBuffer.get());
</ins><span class="cx">     if (handle.isNull())
</span><span class="cx">         return;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcessmacNetworkResourceLoaderMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/mac/NetworkResourceLoaderMac.mm (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/mac/NetworkResourceLoaderMac.mm        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebKit2/NetworkProcess/mac/NetworkResourceLoaderMac.mm        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -84,7 +84,7 @@
</span><span class="cx">     tryGetShareableHandleFromCFData(handle, data);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void NetworkResourceLoader::tryGetShareableHandleFromSharedBuffer(ShareableResource::Handle&amp; handle, SharedBuffer&amp; buffer)
</del><ins>+void NetworkResourceLoader::tryGetShareableHandleFromSharedBuffer(ShareableResource::Handle&amp; handle, SharedBuffer* buffer)
</ins><span class="cx"> {
</span><span class="cx">     static CFURLCacheRef cache = CFURLCacheCopySharedURLCache();
</span><span class="cx">     ASSERT(isMainThread());
</span><span class="lines">@@ -93,7 +93,7 @@
</span><span class="cx">     if (!cache)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    CFDataRef data = buffer.existingCFData();
</del><ins>+    CFDataRef data = buffer-&gt;existingCFData();
</ins><span class="cx">     if (!data)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="lines">@@ -102,16 +102,14 @@
</span><span class="cx"> 
</span><span class="cx">     tryGetShareableHandleFromCFData(handle, data);
</span><span class="cx"> }
</span><ins>+#endif // __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 1090
</ins><span class="cx"> 
</span><del>-#endif // IOS || __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 1090
-
</del><span class="cx"> size_t NetworkResourceLoader::fileBackedResourceMinimumSize()
</span><span class="cx"> {
</span><span class="cx">     return SharedMemory::systemPageSize();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if USE(CFNETWORK)
</span><del>-
</del><span class="cx"> void NetworkResourceLoader::willCacheResponseAsync(ResourceHandle* handle, CFCachedURLResponseRef cfResponse)
</span><span class="cx"> {
</span><span class="cx">     ASSERT_UNUSED(handle, handle == m_handle);
</span><span class="lines">@@ -135,7 +133,6 @@
</span><span class="cx"> 
</span><span class="cx">     m_handle-&gt;continueWillCacheResponse(nsResponse);
</span><span class="cx"> }
</span><del>-
</del><span class="cx"> #endif // !USE(CFNETWORK)
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2PlatformIPCDataReferenceh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Platform/IPC/DataReference.h (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Platform/IPC/DataReference.h        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebKit2/Platform/IPC/DataReference.h        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -83,27 +83,21 @@
</span><span class="cx">     size_t m_size;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-class SharedBufferDataReference : public DataReference {
</del><ins>+class SharedBufferDataReference: public DataReference {
</ins><span class="cx"> public:
</span><del>-    // FIXME: This class doesn't handle null, so the argument should be a reference or PassRef.
</del><span class="cx">     SharedBufferDataReference(WebCore::SharedBuffer* buffer)
</span><del>-        : m_buffer(buffer)
</del><span class="cx">     {
</span><ins>+        m_buffer = buffer;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-private:
-    // FIXME: It is a bad idea to violate the Liskov Substitution Principle as we do here.
-    // Since we are using DataReference as a polymoprhic base class in this fashion,
-    // then we need it to be a base class that does not have functions such as isEmpty,
-    // size, data, and vector, all of which will do the wrong thing if they are called.
-    // Deleting these functions here does not prevent them from being called.
-    bool isEmpty() const = delete;
-    size_t size() const = delete;
</del><ins>+    size_t size() const { return m_buffer-&gt;size(); }
</ins><span class="cx">     const uint8_t* data() const = delete;
</span><span class="cx">     Vector&lt;uint8_t&gt; vector() const = delete;
</span><span class="cx"> 
</span><del>-    virtual void encode(ArgumentEncoder&amp;) const override;
</del><ins>+    void encode(ArgumentEncoder&amp;) const override;
+    virtual ~SharedBufferDataReference() { m_buffer = 0; }
</ins><span class="cx"> 
</span><ins>+private:
</ins><span class="cx">     RefPtr&lt;WebCore::SharedBuffer&gt; m_buffer;
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedWebResourceBuffercppfromrev175490trunkSourceWebCoreloadercacheCachedTextTrackh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/Shared/WebResourceBuffer.cpp (from rev 175490, trunk/Source/WebCore/loader/cache/CachedTextTrack.h) (0 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/WebResourceBuffer.cpp                                (rev 0)
+++ trunk/Source/WebKit2/Shared/WebResourceBuffer.cpp        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -0,0 +1,63 @@
</span><ins>+/*
+ * Copyright (C) 2012 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;WebResourceBuffer.h&quot;
+
+#if ENABLE(SHAREABLE_RESOURCE)
+
+#include &quot;Logging.h&quot;
+#include &quot;ShareableResource.h&quot;
+
+namespace WebKit {
+
+WebResourceBuffer::WebResourceBuffer(PassRefPtr&lt;ShareableResource&gt; resource)
+    : m_resource(resource)
+{
+    ASSERT(m_resource);
+}
+
+WebResourceBuffer::~WebResourceBuffer()
+{
+}
+
+const char* WebResourceBuffer::data() const
+{
+    return reinterpret_cast&lt;const char*&gt;(m_resource-&gt;data());
+}
+
+unsigned WebResourceBuffer::size() const
+{
+    return m_resource-&gt;size();
+}
+
+bool WebResourceBuffer::isEmpty() const
+{
+    return !m_resource || !m_resource-&gt;size();
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(SHAREABLE_RESOURCE)
</ins></span></pre></div>
<a id="trunkSourceWebKit2SharedWebResourceBufferhfromrev175490trunkSourceWebCoreloadercacheCachedTextTrackh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/Shared/WebResourceBuffer.h (from rev 175490, trunk/Source/WebCore/loader/cache/CachedTextTrack.h) (0 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/WebResourceBuffer.h                                (rev 0)
+++ trunk/Source/WebKit2/Shared/WebResourceBuffer.h        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -0,0 +1,57 @@
</span><ins>+/*
+ * Copyright (C) 2012 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 WebResourceBuffer_h
+#define WebResourceBuffer_h
+
+#if ENABLE(SHAREABLE_RESOURCE)
+
+#include &lt;WebCore/ResourceBuffer.h&gt;
+
+namespace WebKit {
+
+class ShareableResource;
+
+class WebResourceBuffer : public WebCore::ResourceBuffer {
+public:
+    static PassRefPtr&lt;WebResourceBuffer&gt; create(PassRefPtr&lt;ShareableResource&gt; resource) { return adoptRef(new WebResourceBuffer(resource)); }
+
+    virtual ~WebResourceBuffer() override;
+
+    virtual const char* data() const override;
+    virtual unsigned size() const override;
+    virtual bool isEmpty() const override;
+
+private:
+    WebResourceBuffer(PassRefPtr&lt;ShareableResource&gt;);
+
+    RefPtr&lt;ShareableResource&gt; m_resource;
+};
+
+} // namespace WebKit
+
+#endif // ENABLE(SHAREABLE_RESOURCE)
+
+#endif // WebResourceBuffer_h
</ins></span></pre></div>
<a id="trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -821,6 +821,8 @@
</span><span class="cx">                 512127C41908239A00DAF35C /* WebPasteboardOverrides.h in Headers */ = {isa = PBXBuildFile; fileRef = 512127C21908239A00DAF35C /* WebPasteboardOverrides.h */; };
</span><span class="cx">                 51217460164C20E30037A5C1 /* ShareableResource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5121745E164C20E30037A5C1 /* ShareableResource.cpp */; };
</span><span class="cx">                 51217461164C20E30037A5C1 /* ShareableResource.h in Headers */ = {isa = PBXBuildFile; fileRef = 5121745F164C20E30037A5C1 /* ShareableResource.h */; };
</span><ins>+                51217464164C21370037A5C1 /* WebResourceBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51217462164C21370037A5C1 /* WebResourceBuffer.cpp */; };
+                51217465164C21370037A5C1 /* WebResourceBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 51217463164C21370037A5C1 /* WebResourceBuffer.h */; };
</ins><span class="cx">                 5123CF1B133D260A0056F800 /* WKIconDatabaseCG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5123CF19133D260A0056F800 /* WKIconDatabaseCG.cpp */; };
</span><span class="cx">                 5123CF1C133D260A0056F800 /* WKIconDatabaseCG.h in Headers */ = {isa = PBXBuildFile; fileRef = 5123CF1A133D260A0056F800 /* WKIconDatabaseCG.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 51290992183ACEAF005522A6 /* WebIDBServerConnection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51290990183ACEAF005522A6 /* WebIDBServerConnection.cpp */; };
</span><span class="lines">@@ -2850,6 +2852,8 @@
</span><span class="cx">                 512127C21908239A00DAF35C /* WebPasteboardOverrides.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPasteboardOverrides.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 5121745E164C20E30037A5C1 /* ShareableResource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ShareableResource.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 5121745F164C20E30037A5C1 /* ShareableResource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShareableResource.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                51217462164C21370037A5C1 /* WebResourceBuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebResourceBuffer.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                51217463164C21370037A5C1 /* WebResourceBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebResourceBuffer.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 5123CF19133D260A0056F800 /* WKIconDatabaseCG.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WKIconDatabaseCG.cpp; path = cg/WKIconDatabaseCG.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 5123CF1A133D260A0056F800 /* WKIconDatabaseCG.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKIconDatabaseCG.h; path = cg/WKIconDatabaseCG.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 51290990183ACEAF005522A6 /* WebIDBServerConnection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebIDBServerConnection.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -4521,6 +4525,8 @@
</span><span class="cx">                                 37948402150C350600E52CE9 /* WebRenderLayer.h */,
</span><span class="cx">                                 3760881C150413E900FC82C7 /* WebRenderObject.cpp */,
</span><span class="cx">                                 3760881D150413E900FC82C7 /* WebRenderObject.h */,
</span><ins>+                                51217462164C21370037A5C1 /* WebResourceBuffer.cpp */,
+                                51217463164C21370037A5C1 /* WebResourceBuffer.h */,
</ins><span class="cx">                                 F634445512A885C8000612D8 /* WebSecurityOrigin.h */,
</span><span class="cx">                                 A72D5D7F1236CBA800A88B15 /* WebSerializedScriptValue.h */,
</span><span class="cx">                                 C0337DD7127A51B6008FF4F4 /* WebTouchEvent.cpp */,
</span><span class="lines">@@ -7596,6 +7602,7 @@
</span><span class="cx">                                 51E351F6180F5C7500E53BE9 /* WebIDBFactoryBackend.h in Headers */,
</span><span class="cx">                                 2D29ECD0192F2C2E00984B78 /* RemoteLayerTreeDisplayRefreshMonitor.h in Headers */,
</span><span class="cx">                                 3760881F150413E900FC82C7 /* WebRenderObject.h in Headers */,
</span><ins>+                                51217465164C21370037A5C1 /* WebResourceBuffer.h in Headers */,
</ins><span class="cx">                                 33367630130C9998006C9DE2 /* WebResourceCacheManager.h in Headers */,
</span><span class="cx">                                 1AAF089B19267EE500B6390C /* WKUserScript.h in Headers */,
</span><span class="cx">                                 33367656130C9ECA006C9DE2 /* WebResourceCacheManagerMessages.h in Headers */,
</span><span class="lines">@@ -9277,6 +9284,7 @@
</span><span class="cx">                                 37948403150C350600E52CE9 /* WebRenderLayer.cpp in Sources */,
</span><span class="cx">                                 2D28F3E61885CCC1004B9EAE /* WebEditorClientIOS.mm in Sources */,
</span><span class="cx">                                 3760881E150413E900FC82C7 /* WebRenderObject.cpp in Sources */,
</span><ins>+                                51217464164C21370037A5C1 /* WebResourceBuffer.cpp in Sources */,
</ins><span class="cx">                                 3336762F130C9998006C9DE2 /* WebResourceCacheManager.cpp in Sources */,
</span><span class="cx">                                 E115C714190F89E400ECC516 /* DatabaseProcessIOS.mm in Sources */,
</span><span class="cx">                                 33F9D5B91312F1EE000D683F /* WebResourceCacheManagerCFNet.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessNetworkNetworkProcessConnectioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/Network/NetworkProcessConnection.cpp (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/Network/NetworkProcessConnection.cpp        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebKit2/WebProcess/Network/NetworkProcessConnection.cpp        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -30,10 +30,12 @@
</span><span class="cx"> #include &quot;NetworkConnectionToWebProcessMessages.h&quot;
</span><span class="cx"> #include &quot;WebCoreArgumentCoders.h&quot;
</span><span class="cx"> #include &quot;WebProcess.h&quot;
</span><ins>+#include &quot;WebResourceBuffer.h&quot;
</ins><span class="cx"> #include &quot;WebResourceLoadScheduler.h&quot;
</span><span class="cx"> #include &quot;WebResourceLoaderMessages.h&quot;
</span><span class="cx"> #include &lt;WebCore/CachedResource.h&gt;
</span><span class="cx"> #include &lt;WebCore/MemoryCache.h&gt;
</span><ins>+#include &lt;WebCore/ResourceBuffer.h&gt;
</ins><span class="cx"> #include &lt;WebCore/SessionID.h&gt;
</span><span class="cx"> #include &lt;WebCore/SharedBuffer.h&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -93,7 +95,7 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    resource-&gt;tryReplaceEncodedData(*buffer);
</del><ins>+    resource-&gt;tryReplaceEncodedData(buffer.release());
</ins><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessNetworkWebResourceLoadSchedulercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/Network/WebResourceLoadScheduler.cpp (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/Network/WebResourceLoadScheduler.cpp        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebKit2/WebProcess/Network/WebResourceLoadScheduler.cpp        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -46,6 +46,7 @@
</span><span class="cx"> #include &lt;WebCore/FrameLoader.h&gt;
</span><span class="cx"> #include &lt;WebCore/NetscapePlugInStreamLoader.h&gt;
</span><span class="cx"> #include &lt;WebCore/ReferrerPolicy.h&gt;
</span><ins>+#include &lt;WebCore/ResourceBuffer.h&gt;
</ins><span class="cx"> #include &lt;WebCore/ResourceLoader.h&gt;
</span><span class="cx"> #include &lt;WebCore/SessionID.h&gt;
</span><span class="cx"> #include &lt;WebCore/Settings.h&gt;
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessNetworkWebResourceLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.cpp (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.cpp        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.cpp        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -38,6 +38,7 @@
</span><span class="cx"> #include &lt;WebCore/ApplicationCacheHost.h&gt;
</span><span class="cx"> #include &lt;WebCore/CertificateInfo.h&gt;
</span><span class="cx"> #include &lt;WebCore/DocumentLoader.h&gt;
</span><ins>+#include &lt;WebCore/ResourceBuffer.h&gt;
</ins><span class="cx"> #include &lt;WebCore/ResourceError.h&gt;
</span><span class="cx"> #include &lt;WebCore/ResourceLoader.h&gt;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessNetworkWebResourceLoaderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.h (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.h        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.h        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -46,6 +46,7 @@
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> class CertificateInfo;
</span><span class="cx"> class ProtectionSpace;
</span><ins>+class ResourceBuffer;
</ins><span class="cx"> class ResourceError;
</span><span class="cx"> class ResourceLoader;
</span><span class="cx"> class ResourceRequest;
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebCoreSupportWebFrameLoaderClientcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -74,6 +74,7 @@
</span><span class="cx"> #include &lt;WebCore/PluginData.h&gt;
</span><span class="cx"> #include &lt;WebCore/PluginDocument.h&gt;
</span><span class="cx"> #include &lt;WebCore/ProgressTracker.h&gt;
</span><ins>+#include &lt;WebCore/ResourceBuffer.h&gt;
</ins><span class="cx"> #include &lt;WebCore/ResourceError.h&gt;
</span><span class="cx"> #include &lt;WebCore/ScriptController.h&gt;
</span><span class="cx"> #include &lt;WebCore/Settings.h&gt;
</span><span class="lines">@@ -918,7 +919,7 @@
</span><span class="cx">             if (!webPage)
</span><span class="cx">                 return;
</span><span class="cx"> 
</span><del>-            RefPtr&lt;SharedBuffer&gt; mainResourceData = loader-&gt;mainResourceData();
</del><ins>+            RefPtr&lt;ResourceBuffer&gt; mainResourceData = loader-&gt;mainResourceData();
</ins><span class="cx">             IPC::DataReference dataReference(reinterpret_cast&lt;const uint8_t*&gt;(mainResourceData ? mainResourceData-&gt;data() : 0), mainResourceData ? mainResourceData-&gt;size() : 0);
</span><span class="cx">             webPage-&gt;send(Messages::WebPageProxy::DidFinishLoadingDataForCustomContentProvider(loader-&gt;response().suggestedFilename(), dataReference));
</span><span class="cx">         }
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebFramecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -65,6 +65,7 @@
</span><span class="cx"> #include &lt;WebCore/Page.h&gt;
</span><span class="cx"> #include &lt;WebCore/PluginDocument.h&gt;
</span><span class="cx"> #include &lt;WebCore/RenderTreeAsText.h&gt;
</span><ins>+#include &lt;WebCore/ResourceBuffer.h&gt;
</ins><span class="cx"> #include &lt;WebCore/ResourceLoader.h&gt;
</span><span class="cx"> #include &lt;WebCore/ScriptController.h&gt;
</span><span class="cx"> #include &lt;WebCore/SecurityOrigin.h&gt;
</span><span class="lines">@@ -304,7 +305,7 @@
</span><span class="cx">     DocumentLoader* documentLoader = m_coreFrame-&gt;loader().activeDocumentLoader();
</span><span class="cx">     if (!documentLoader)
</span><span class="cx">         return String();
</span><del>-    RefPtr&lt;SharedBuffer&gt; mainResourceData = documentLoader-&gt;mainResourceData();
</del><ins>+    RefPtr&lt;ResourceBuffer&gt; mainResourceData = documentLoader-&gt;mainResourceData();
</ins><span class="cx">     if (!mainResourceData)
</span><span class="cx">         return String();
</span><span class="cx">     return decoder-&gt;encoding().decode(mainResourceData-&gt;data(), mainResourceData-&gt;size());
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -137,6 +137,7 @@
</span><span class="cx"> #include &lt;WebCore/RenderLayer.h&gt;
</span><span class="cx"> #include &lt;WebCore/RenderTreeAsText.h&gt;
</span><span class="cx"> #include &lt;WebCore/RenderView.h&gt;
</span><ins>+#include &lt;WebCore/ResourceBuffer.h&gt;
</ins><span class="cx"> #include &lt;WebCore/ResourceRequest.h&gt;
</span><span class="cx"> #include &lt;WebCore/ResourceResponse.h&gt;
</span><span class="cx"> #include &lt;WebCore/RuntimeEnabledFeatures.h&gt;
</span><span class="lines">@@ -2434,16 +2435,17 @@
</span><span class="cx">     // NOTE: We need to be careful when running scripts that the objects we depend on don't
</span><span class="cx">     // disappear during script execution.
</span><span class="cx"> 
</span><ins>+    // Retain the SerializedScriptValue at this level so it (and the internal data) lives
+    // long enough for the DataReference to be encoded by the sent message.
</ins><span class="cx">     RefPtr&lt;SerializedScriptValue&gt; serializedResultValue;
</span><ins>+    IPC::DataReference dataReference;
+
</ins><span class="cx">     JSLockHolder lock(JSDOMWindow::commonVM());
</span><span class="cx">     if (JSValue resultValue = m_mainFrame-&gt;coreFrame()-&gt;script().executeScript(script, true).jsValue()) {
</span><del>-        serializedResultValue = SerializedScriptValue::create(m_mainFrame-&gt;jsContext(),
-            toRef(m_mainFrame-&gt;coreFrame()-&gt;script().globalObject(mainThreadNormalWorld())-&gt;globalExec(), resultValue), nullptr);
</del><ins>+        if ((serializedResultValue = SerializedScriptValue::create(m_mainFrame-&gt;jsContext(), toRef(m_mainFrame-&gt;coreFrame()-&gt;script().globalObject(mainThreadNormalWorld())-&gt;globalExec(), resultValue), 0)))
+            dataReference = serializedResultValue-&gt;data();
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    IPC::DataReference dataReference;
-    if (serializedResultValue)
-        dataReference = serializedResultValue-&gt;data();
</del><span class="cx">     send(Messages::WebPageProxy::ScriptValueCallback(dataReference, callbackID));
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -2456,14 +2458,15 @@
</span><span class="cx"> #if ENABLE(MHTML)
</span><span class="cx"> void WebPage::getContentsAsMHTMLData(uint64_t callbackID, bool useBinaryEncoding)
</span><span class="cx"> {
</span><ins>+    IPC::DataReference dataReference;
+
</ins><span class="cx">     RefPtr&lt;SharedBuffer&gt; buffer = useBinaryEncoding
</span><span class="cx">         ? MHTMLArchive::generateMHTMLDataUsingBinaryEncoding(m_page.get())
</span><span class="cx">         : MHTMLArchive::generateMHTMLData(m_page.get());
</span><span class="cx"> 
</span><del>-    // FIXME: Use SharedBufferDataReference.
-    IPC::DataReference dataReference;
</del><span class="cx">     if (buffer)
</span><span class="cx">         dataReference = IPC::DataReference(reinterpret_cast&lt;const uint8_t*&gt;(buffer-&gt;data()), buffer-&gt;size());
</span><ins>+
</ins><span class="cx">     send(Messages::WebPageProxy::DataCallback(dataReference, callbackID));
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="lines">@@ -2486,17 +2489,20 @@
</span><span class="cx"> 
</span><span class="cx"> void WebPage::getSelectionAsWebArchiveData(uint64_t callbackID)
</span><span class="cx"> {
</span><ins>+    IPC::DataReference dataReference;
+
</ins><span class="cx"> #if PLATFORM(COCOA)
</span><ins>+    RefPtr&lt;LegacyWebArchive&gt; archive;
</ins><span class="cx">     RetainPtr&lt;CFDataRef&gt; data;
</span><del>-    if (Frame* frame = frameWithSelection(m_page.get()))
-        data = LegacyWebArchive::createFromSelection(frame)-&gt;rawDataRepresentation();
-#endif
</del><span class="cx"> 
</span><del>-    IPC::DataReference dataReference;
-#if PLATFORM(COCOA)
-    if (data)
</del><ins>+    Frame* frame = frameWithSelection(m_page.get());
+    if (frame) {
+        archive = LegacyWebArchive::createFromSelection(frame);
+        data = archive-&gt;rawDataRepresentation();
</ins><span class="cx">         dataReference = IPC::DataReference(CFDataGetBytePtr(data.get()), CFDataGetLength(data.get()));
</span><ins>+    }
</ins><span class="cx"> #endif
</span><ins>+
</ins><span class="cx">     send(Messages::WebPageProxy::DataCallback(dataReference, callbackID));
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -2519,20 +2525,24 @@
</span><span class="cx"> 
</span><span class="cx"> void WebPage::getMainResourceDataOfFrame(uint64_t frameID, uint64_t callbackID)
</span><span class="cx"> {
</span><del>-    RefPtr&lt;SharedBuffer&gt; buffer;
</del><ins>+    IPC::DataReference dataReference;
+
+    RefPtr&lt;ResourceBuffer&gt; buffer;
+    RefPtr&lt;SharedBuffer&gt; pdfResource;
</ins><span class="cx">     if (WebFrame* frame = WebProcess::shared().webFrame(frameID)) {
</span><del>-        if (PluginView* pluginView = pluginViewForFrame(frame-&gt;coreFrame()))
-            buffer = pluginView-&gt;liveResourceData();
-        if (!buffer) {
-            if (DocumentLoader* loader = frame-&gt;coreFrame()-&gt;loader().documentLoader())
-                buffer = loader-&gt;mainResourceData();
</del><ins>+        if (PluginView* pluginView = pluginViewForFrame(frame-&gt;coreFrame())) {
+            if ((pdfResource = pluginView-&gt;liveResourceData()))
+                dataReference = IPC::DataReference(reinterpret_cast&lt;const uint8_t*&gt;(pdfResource-&gt;data()), pdfResource-&gt;size());
</ins><span class="cx">         }
</span><ins>+
+        if (dataReference.isEmpty()) {
+            if (DocumentLoader* loader = frame-&gt;coreFrame()-&gt;loader().documentLoader()) {
+                if ((buffer = loader-&gt;mainResourceData()))
+                    dataReference = IPC::DataReference(reinterpret_cast&lt;const uint8_t*&gt;(buffer-&gt;data()), buffer-&gt;size());
+            }
+        }
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    // FIXME: Use SharedBufferDataReference.
-    IPC::DataReference dataReference;
-    if (buffer)
-        dataReference = IPC::DataReference(reinterpret_cast&lt;const uint8_t*&gt;(buffer-&gt;data()), buffer-&gt;size());
</del><span class="cx">     send(Messages::WebPageProxy::DataCallback(dataReference, callbackID));
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -2551,38 +2561,38 @@
</span><span class="cx"> 
</span><span class="cx"> void WebPage::getResourceDataFromFrame(uint64_t frameID, const String&amp; resourceURLString, uint64_t callbackID)
</span><span class="cx"> {
</span><ins>+    IPC::DataReference dataReference;
+    URL resourceURL(URL(), resourceURLString);
+
</ins><span class="cx">     RefPtr&lt;SharedBuffer&gt; buffer;
</span><span class="cx">     if (WebFrame* frame = WebProcess::shared().webFrame(frameID)) {
</span><del>-        URL resourceURL(URL(), resourceURLString);
</del><span class="cx">         buffer = resourceDataForFrame(frame-&gt;coreFrame(), resourceURL);
</span><span class="cx">         if (!buffer) {
</span><span class="cx">             // Try to get the resource data from the cache.
</span><span class="cx">             buffer = cachedResponseDataForURL(resourceURL);
</span><span class="cx">         }
</span><ins>+
+        if (buffer)
+            dataReference = IPC::DataReference(reinterpret_cast&lt;const uint8_t*&gt;(buffer-&gt;data()), buffer-&gt;size());
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    // FIXME: Use SharedBufferDataReference.
-    IPC::DataReference dataReference;
-    if (buffer)
-        dataReference = IPC::DataReference(reinterpret_cast&lt;const uint8_t*&gt;(buffer-&gt;data()), buffer-&gt;size());
</del><span class="cx">     send(Messages::WebPageProxy::DataCallback(dataReference, callbackID));
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebPage::getWebArchiveOfFrame(uint64_t frameID, uint64_t callbackID)
</span><span class="cx"> {
</span><ins>+    IPC::DataReference dataReference;
+
</ins><span class="cx"> #if PLATFORM(COCOA)
</span><span class="cx">     RetainPtr&lt;CFDataRef&gt; data;
</span><del>-    if (WebFrame* frame = WebProcess::shared().webFrame(frameID))
-        data = frame-&gt;webArchiveData(nullptr, nullptr);
</del><ins>+    if (WebFrame* frame = WebProcess::shared().webFrame(frameID)) {
+        if ((data = frame-&gt;webArchiveData(0, 0)))
+            dataReference = IPC::DataReference(CFDataGetBytePtr(data.get()), CFDataGetLength(data.get()));
+    }
</ins><span class="cx"> #else
</span><span class="cx">     UNUSED_PARAM(frameID);
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    IPC::DataReference dataReference;
-#if PLATFORM(COCOA)
-    if (data)
-        dataReference = IPC::DataReference(CFDataGetBytePtr(data.get()), CFDataGetLength(data.get()));
-#endif
</del><span class="cx">     send(Messages::WebPageProxy::DataCallback(dataReference, callbackID));
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageiosWebPageIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm (175490 => 175491)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm        2014-11-03 22:22:34 UTC (rev 175490)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm        2014-11-03 22:27:59 UTC (rev 175491)
</span><span class="lines">@@ -51,7 +51,6 @@
</span><span class="cx"> #import &lt;WebCore/Chrome.h&gt;
</span><span class="cx"> #import &lt;WebCore/DNS.h&gt;
</span><span class="cx"> #import &lt;WebCore/Element.h&gt;
</span><del>-#import &lt;WebCore/ElementAncestorIterator.h&gt;
</del><span class="cx"> #import &lt;WebCore/EventHandler.h&gt;
</span><span class="cx"> #import &lt;WebCore/FloatQuad.h&gt;
</span><span class="cx"> #import &lt;WebCore/FocusController.h&gt;
</span><span class="lines">@@ -82,6 +81,7 @@
</span><span class="cx"> #import &lt;WebCore/RenderImage.h&gt;
</span><span class="cx"> #import &lt;WebCore/RenderThemeIOS.h&gt;
</span><span class="cx"> #import &lt;WebCore/RenderView.h&gt;
</span><ins>+#import &lt;WebCore/ResourceBuffer.h&gt;
</ins><span class="cx"> #import &lt;WebCore/SharedBuffer.h&gt;
</span><span class="cx"> #import &lt;WebCore/TextIterator.h&gt;
</span><span class="cx"> #import &lt;WebCore/VisibleUnits.h&gt;
</span><span class="lines">@@ -1842,11 +1842,10 @@
</span><span class="cx"> 
</span><span class="cx"> static Element* containingLinkElement(Element* element)
</span><span class="cx"> {
</span><del>-    for (auto&amp; currentElement : elementLineage(element)) {
-        if (currentElement.isLink())
-            return &amp;currentElement;
-    }
-    return nullptr;
</del><ins>+    for (Element* currentElement = element; currentElement; currentElement = currentElement-&gt;parentElement())
+        if (currentElement-&gt;isLink())
+            return currentElement;
+    return 0;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebPage::getPositionInformation(const IntPoint&amp; point, InteractionInformationAtPosition&amp; info)
</span><span class="lines">@@ -1950,77 +1949,73 @@
</span><span class="cx">     if (!is&lt;HTMLElement&gt;(m_interactionNode.get()))
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    HTMLElement&amp; element = downcast&lt;HTMLElement&gt;(*m_interactionNode);
-    if (!element.renderer())
</del><ins>+    HTMLElement* element = downcast&lt;HTMLElement&gt;(m_interactionNode.get());
+    if (!element-&gt;renderer())
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     if (static_cast&lt;SheetAction&gt;(action) == SheetAction::Copy) {
</span><del>-        if (is&lt;RenderImage&gt;(*element.renderer())) {
-            Element* linkElement = containingLinkElement(&amp;element);
</del><ins>+        if (is&lt;RenderImage&gt;(*element-&gt;renderer())) {
+            Element* linkElement = containingLinkElement(element);
+        
</ins><span class="cx">             if (!linkElement)
</span><del>-                m_interactionNode-&gt;document().frame()-&gt;editor().writeImageToPasteboard(*Pasteboard::createForCopyAndPaste(), element, downcast&lt;RenderImage&gt;(*element.renderer()).cachedImage()-&gt;url(), String());
</del><ins>+                m_interactionNode-&gt;document().frame()-&gt;editor().writeImageToPasteboard(*Pasteboard::createForCopyAndPaste(), *element, downcast&lt;RenderImage&gt;(*element-&gt;renderer()).cachedImage()-&gt;url(), String());
</ins><span class="cx">             else
</span><del>-                m_interactionNode-&gt;document().frame()-&gt;editor().copyURL(linkElement-&gt;document().completeURL(stripLeadingAndTrailingHTMLSpaces(linkElement-&gt;fastGetAttribute(HTMLNames::hrefAttr))), linkElement-&gt;textContent());
-        } else if (element.isLink()) {
-            m_interactionNode-&gt;document().frame()-&gt;editor().copyURL(element.document().completeURL(stripLeadingAndTrailingHTMLSpaces(element.fastGetAttribute(HTMLNames::hrefAttr))), element.textContent());
</del><ins>+                m_interactionNode-&gt;document().frame()-&gt;editor().copyURL(linkElement-&gt;document().completeURL(stripLeadingAndTrailingHTMLSpaces(linkElement-&gt;getAttribute(HTMLNames::hrefAttr))), linkElement-&gt;textContent());
+        } else if (element-&gt;isLink()) {
+            m_interactionNode-&gt;document().frame()-&gt;editor().copyURL(element-&gt;document().completeURL(stripLeadingAndTrailingHTMLSpaces(element-&gt;getAttribute(HTMLNames::hrefAttr))), element-&gt;textContent());
</ins><span class="cx">         }
</span><span class="cx">     } else if (static_cast&lt;SheetAction&gt;(action) == SheetAction::SaveImage) {
</span><del>-        if (!is&lt;RenderImage&gt;(*element.renderer()))
</del><ins>+        if (!is&lt;RenderImage&gt;(*element-&gt;renderer()))
</ins><span class="cx">             return;
</span><del>-        CachedImage* cachedImage = downcast&lt;RenderImage&gt;(*element.renderer()).cachedImage();
-        if (!cachedImage)
-            return;
-        SharedBuffer* buffer = cachedImage-&gt;resourceBuffer();
-        if (!buffer)
-            return;
-        uint64_t bufferSize = buffer-&gt;size();
-        RefPtr&lt;SharedMemory&gt; sharedMemoryBuffer = SharedMemory::create(bufferSize);
-        memcpy(sharedMemoryBuffer-&gt;data(), buffer-&gt;data(), bufferSize);
-        SharedMemory::Handle handle;
-        sharedMemoryBuffer-&gt;createHandle(handle, SharedMemory::ReadOnly);
-        send(Messages::WebPageProxy::SaveImageToLibrary(handle, bufferSize));
</del><ins>+        if (CachedImage* cachedImage = downcast&lt;RenderImage&gt;(*element-&gt;renderer()).cachedImage()) {
+            SharedMemory::Handle handle;
+            RefPtr&lt;SharedBuffer&gt; buffer = cachedImage-&gt;resourceBuffer()-&gt;sharedBuffer();
+            if (buffer) {
+                uint64_t bufferSize = buffer-&gt;size();
+                RefPtr&lt;SharedMemory&gt; sharedMemoryBuffer = SharedMemory::create(bufferSize);
+                memcpy(sharedMemoryBuffer-&gt;data(), buffer-&gt;data(), bufferSize);
+                sharedMemoryBuffer-&gt;createHandle(handle, SharedMemory::ReadOnly);
+                send(Messages::WebPageProxy::SaveImageToLibrary(handle, bufferSize));
+            }
+        }
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static inline bool isAssistableElement(Element&amp; node)
</del><ins>+static inline bool isAssistableNode(Node* node)
</ins><span class="cx"> {
</span><del>-    if (is&lt;HTMLSelectElement&gt;(node))
</del><ins>+    if (is&lt;HTMLSelectElement&gt;(*node))
</ins><span class="cx">         return true;
</span><del>-    if (is&lt;HTMLTextAreaElement&gt;(node))
-        return !downcast&lt;HTMLTextAreaElement&gt;(node).isReadOnlyNode();
-    if (is&lt;HTMLInputElement&gt;(node)) {
-        HTMLInputElement&amp; inputElement = downcast&lt;HTMLInputElement&gt;(node);
-        // FIXME: This laundry list of types is not a good way to factor this. Need a suitable function on HTMLInputElement itself.
-        return !inputElement.isReadOnlyNode() &amp;&amp; (inputElement.isTextField() || inputElement.isDateField() || inputElement.isDateTimeLocalField() || inputElement.isMonthField() || inputElement.isTimeField());
</del><ins>+    if (is&lt;HTMLTextAreaElement&gt;(*node))
+        return !downcast&lt;HTMLTextAreaElement&gt;(*node).isReadOnlyNode();
+    if (is&lt;HTMLInputElement&gt;(*node)) {
+        HTMLInputElement&amp; element = downcast&lt;HTMLInputElement&gt;(*node);
+        return !element.isReadOnlyNode() &amp;&amp; (element.isTextField() || element.isDateField() || element.isDateTimeLocalField() || element.isMonthField() || element.isTimeField());
</ins><span class="cx">     }
</span><del>-    return node.isContentEditable();
</del><ins>+
+    return node-&gt;isContentEditable();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static inline Element* nextAssistableElement(Node* startNode, Page&amp; page, bool isForward)
</del><ins>+static inline Element* nextFocusableElement(Node* startNode, Page* page, bool isForward)
</ins><span class="cx"> {
</span><del>-    if (!is&lt;Element&gt;(startNode))
-        return nullptr;
-
</del><span class="cx">     RefPtr&lt;KeyboardEvent&gt; key = KeyboardEvent::create();
</span><span class="cx"> 
</span><span class="cx">     Element* nextElement = downcast&lt;Element&gt;(startNode);
</span><span class="cx">     do {
</span><del>-        nextElement = isForward
-            ? page.focusController().nextFocusableElement(FocusNavigationScope::focusNavigationScopeOf(&amp;nextElement-&gt;document()), nextElement, key.get())
-            : page.focusController().previousFocusableElement(FocusNavigationScope::focusNavigationScopeOf(&amp;nextElement-&gt;document()), nextElement, key.get());
-    } while (nextElement &amp;&amp; !isAssistableElement(*nextElement));
</del><ins>+        nextElement = isForward ? page-&gt;focusController().nextFocusableElement(FocusNavigationScope::focusNavigationScopeOf(&amp;nextElement-&gt;document()), nextElement, key.get())
+            : page-&gt;focusController().previousFocusableElement(FocusNavigationScope::focusNavigationScopeOf(&amp;nextElement-&gt;document()), nextElement, key.get());
+    } while (nextElement &amp;&amp; !isAssistableNode(nextElement));
</ins><span class="cx"> 
</span><span class="cx">     return nextElement;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static inline bool hasAssistableElement(Node* startNode, Page&amp; page, bool isForward)
</del><ins>+static inline bool hasFocusableElement(Node* startNode, Page* page, bool isForward)
</ins><span class="cx"> {
</span><del>-    return nextAssistableElement(startNode, page, isForward);
</del><ins>+    return nextFocusableElement(startNode, page, isForward) != nil;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebPage::focusNextAssistedNode(bool isForward)
</span><span class="cx"> {
</span><del>-    Element* nextElement = nextAssistableElement(m_assistedNode.get(), *m_page, isForward);
</del><ins>+    Element* nextElement = nextFocusableElement(m_assistedNode.get(), m_page.get(), isForward);
</ins><span class="cx">     m_userIsInteracting = true;
</span><span class="cx">     if (nextElement)
</span><span class="cx">         nextElement-&gt;focus();
</span><span class="lines">@@ -2061,8 +2056,8 @@
</span><span class="cx">     information.minimumScaleFactor = minimumPageScaleFactor();
</span><span class="cx">     information.maximumScaleFactor = maximumPageScaleFactor();
</span><span class="cx">     information.allowsUserScaling = m_viewportConfiguration.allowsUserScaling();
</span><del>-    information.hasNextNode = hasAssistableElement(m_assistedNode.get(), *m_page, true);
-    information.hasPreviousNode = hasAssistableElement(m_assistedNode.get(), *m_page, false);
</del><ins>+    information.hasNextNode = hasFocusableElement(m_assistedNode.get(), m_page.get(), true);
+    information.hasPreviousNode = hasFocusableElement(m_assistedNode.get(), m_page.get(), false);
</ins><span class="cx"> 
</span><span class="cx">     if (is&lt;HTMLSelectElement&gt;(*m_assistedNode)) {
</span><span class="cx">         HTMLSelectElement&amp; element = downcast&lt;HTMLSelectElement&gt;(*m_assistedNode);
</span></span></pre>
</div>
</div>

</body>
</html>