<!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>[174921] 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/174921">174921</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2014-10-20 19:10:47 -0700 (Mon, 20 Oct 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>ResourceRequest deserialization unnecessarily calls partitionName() on encoded cache partition
https://bugs.webkit.org/show_bug.cgi?id=137797

Reviewed by Darin Adler.

Source/WebCore:

ResourceRequest deserialization was unnecessarily calling partitionName()
on the decoded cache partition. In the deserialization case, we already
know the cache partition is a valid partition name so we can bypass the
call to partitionName() (which is fairly expensive) for performance.

This patch adds a setDomainForCachePartion() method to ResourceRequest
that calls partitionName() on the domain argument, and moves all the
callers of setCachedPartition() to this new setter, except
ArgumentCoder&lt;ResourceRequest&gt;::decode().

This patch updates the setCachedPartition() to merely set the
m_cachePartition member, without calling partitionName() on the
argument. There is also a new assertion in place to make sure the
argument is a valid partition name.

No new tests, no behavior change.

* html/DOMURL.cpp:
(WebCore::DOMURL::revokeObjectURL):
* inspector/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::cachedResource):
* inspector/InspectorResourceAgent.cpp:
(WebCore::InspectorResourceAgent::replayXHR):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::loadURL):
* loader/archive/cf/LegacyWebArchive.cpp:
(WebCore::LegacyWebArchive::create):
* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::requestUserCSSStyleSheet):
(WebCore::CachedResourceLoader::requestResource):
* loader/cache/MemoryCache.cpp:
(WebCore::MemoryCache::addImageToCache):
(WebCore::MemoryCache::removeImageFromCache):
* loader/cache/MemoryCache.h:
* page/SecurityOrigin.cpp:
(WebCore::SecurityOrigin::domainForCachePartition):
(WebCore::SecurityOrigin::cachePartition): Deleted.
Rename cachePartition() getter to domainForCachePartition() to make it
clear it returns a domain and not a partition name. As such, the caller
should then use ResourceRequest::setDomainForCachePartition(), not
setCachePartition().

* page/SecurityOrigin.h:
* platform/network/cf/ResourceRequest.h:
(WebCore::ResourceRequest::setCachePartition):
(WebCore::ResourceRequest::setDomainForCachePartition):

Source/WebKit/mac:

Call ResourceRequest::setDomainForPartitionName() instead of
setPartitionName() as the argument is a domain, not a valid
partition name.

* Misc/WebCache.mm:
(+[WebCache addImageToCache:forURL:forFrame:]):
(+[WebCache removeImageFromCacheForURL:forFrame:]):

Source/WebKit2:

This patch adds a |needsValidation| argument to
ResourceRequest::setCachePartition() setter so that the caller can
indicate that the partition name is valid (because it was already
processed by partitionName() before). Use this new argument in
ArgumentCoder&lt;ResourceRequest&gt;::decode() to spent a bit less time
deserializing resource requests.

* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder&lt;ResourceRequest&gt;::decode):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorehtmlDOMURLcpp">trunk/Source/WebCore/html/DOMURL.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="#trunkSourceWebCoreloaderFrameLoadercpp">trunk/Source/WebCore/loader/FrameLoader.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderarchivecfLegacyWebArchivecpp">trunk/Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp</a></li>
<li><a href="#trunkSourceWebCoreloadercacheCachedResourceLoadercpp">trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp</a></li>
<li><a href="#trunkSourceWebCoreloadercacheMemoryCachecpp">trunk/Source/WebCore/loader/cache/MemoryCache.cpp</a></li>
<li><a href="#trunkSourceWebCoreloadercacheMemoryCacheh">trunk/Source/WebCore/loader/cache/MemoryCache.h</a></li>
<li><a href="#trunkSourceWebCorepageSecurityOrigincpp">trunk/Source/WebCore/page/SecurityOrigin.cpp</a></li>
<li><a href="#trunkSourceWebCorepageSecurityOriginh">trunk/Source/WebCore/page/SecurityOrigin.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkcfResourceRequesth">trunk/Source/WebCore/platform/network/cf/ResourceRequest.h</a></li>
<li><a href="#trunkSourceWebKitmacChangeLog">trunk/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitmacMiscWebCachemm">trunk/Source/WebKit/mac/Misc/WebCache.mm</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (174920 => 174921)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-10-21 01:50:41 UTC (rev 174920)
+++ trunk/Source/WebCore/ChangeLog        2014-10-21 02:10:47 UTC (rev 174921)
</span><span class="lines">@@ -1,3 +1,57 @@
</span><ins>+2014-10-20  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        ResourceRequest deserialization unnecessarily calls partitionName() on encoded cache partition
+        https://bugs.webkit.org/show_bug.cgi?id=137797
+
+        Reviewed by Darin Adler.
+
+        ResourceRequest deserialization was unnecessarily calling partitionName()
+        on the decoded cache partition. In the deserialization case, we already
+        know the cache partition is a valid partition name so we can bypass the
+        call to partitionName() (which is fairly expensive) for performance.
+
+        This patch adds a setDomainForCachePartion() method to ResourceRequest
+        that calls partitionName() on the domain argument, and moves all the
+        callers of setCachedPartition() to this new setter, except
+        ArgumentCoder&lt;ResourceRequest&gt;::decode().
+
+        This patch updates the setCachedPartition() to merely set the
+        m_cachePartition member, without calling partitionName() on the
+        argument. There is also a new assertion in place to make sure the
+        argument is a valid partition name.
+
+        No new tests, no behavior change.
+
+        * html/DOMURL.cpp:
+        (WebCore::DOMURL::revokeObjectURL):
+        * inspector/InspectorPageAgent.cpp:
+        (WebCore::InspectorPageAgent::cachedResource):
+        * inspector/InspectorResourceAgent.cpp:
+        (WebCore::InspectorResourceAgent::replayXHR):
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::loadURL):
+        * loader/archive/cf/LegacyWebArchive.cpp:
+        (WebCore::LegacyWebArchive::create):
+        * loader/cache/CachedResourceLoader.cpp:
+        (WebCore::CachedResourceLoader::requestUserCSSStyleSheet):
+        (WebCore::CachedResourceLoader::requestResource):
+        * loader/cache/MemoryCache.cpp:
+        (WebCore::MemoryCache::addImageToCache):
+        (WebCore::MemoryCache::removeImageFromCache):
+        * loader/cache/MemoryCache.h:
+        * page/SecurityOrigin.cpp:
+        (WebCore::SecurityOrigin::domainForCachePartition):
+        (WebCore::SecurityOrigin::cachePartition): Deleted.
+        Rename cachePartition() getter to domainForCachePartition() to make it
+        clear it returns a domain and not a partition name. As such, the caller
+        should then use ResourceRequest::setDomainForCachePartition(), not
+        setCachePartition().
+
+        * page/SecurityOrigin.h:
+        * platform/network/cf/ResourceRequest.h:
+        (WebCore::ResourceRequest::setCachePartition):
+        (WebCore::ResourceRequest::setDomainForCachePartition):
+
</ins><span class="cx"> 2014-10-20  Youenn Fablet  &lt;youenn.fablet@crf.canon.fr&gt;
</span><span class="cx"> 
</span><span class="cx">         Tighten XMLHttpRequest setRequestHeader value check
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlDOMURLcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/DOMURL.cpp (174920 => 174921)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/DOMURL.cpp        2014-10-21 01:50:41 UTC (rev 174920)
+++ trunk/Source/WebCore/html/DOMURL.cpp        2014-10-21 02:10:47 UTC (rev 174921)
</span><span class="lines">@@ -116,7 +116,7 @@
</span><span class="cx">     URL url(URL(), urlString);
</span><span class="cx">     ResourceRequest request(url);
</span><span class="cx"> #if ENABLE(CACHE_PARTITIONING)
</span><del>-    request.setCachePartition(scriptExecutionContext-&gt;topOrigin()-&gt;cachePartition());
</del><ins>+    request.setDomainForCachePartition(scriptExecutionContext-&gt;topOrigin()-&gt;domainForCachePartition());
</ins><span class="cx"> #endif
</span><span class="cx">     MemoryCache::removeRequestFromSessionCaches(scriptExecutionContext, request);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorPageAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorPageAgent.cpp (174920 => 174921)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorPageAgent.cpp        2014-10-21 01:50:41 UTC (rev 174920)
+++ trunk/Source/WebCore/inspector/InspectorPageAgent.cpp        2014-10-21 02:10:47 UTC (rev 174921)
</span><span class="lines">@@ -266,7 +266,7 @@
</span><span class="cx">     if (!cachedResource) {
</span><span class="cx">         ResourceRequest request(url);
</span><span class="cx"> #if ENABLE(CACHE_PARTITIONING)
</span><del>-        request.setCachePartition(frame-&gt;document()-&gt;topOrigin()-&gt;cachePartition());
</del><ins>+        request.setDomainForCachePartition(frame-&gt;document()-&gt;topOrigin()-&gt;domainForCachePartition());
</ins><span class="cx"> #endif
</span><span class="cx">         cachedResource = memoryCache()-&gt;resourceForRequest(request, frame-&gt;page()-&gt;sessionID());
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorResourceAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorResourceAgent.cpp (174920 => 174921)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorResourceAgent.cpp        2014-10-21 01:50:41 UTC (rev 174920)
+++ trunk/Source/WebCore/inspector/InspectorResourceAgent.cpp        2014-10-21 02:10:47 UTC (rev 174921)
</span><span class="lines">@@ -698,7 +698,7 @@
</span><span class="cx"> 
</span><span class="cx">     ResourceRequest request(xhrReplayData-&gt;url());
</span><span class="cx"> #if ENABLE(CACHE_PARTITIONING)
</span><del>-    request.setCachePartition(m_pageAgent-&gt;mainFrame()-&gt;document()-&gt;topOrigin()-&gt;cachePartition());
</del><ins>+    request.setDomainForCachePartition(m_pageAgent-&gt;mainFrame()-&gt;document()-&gt;topOrigin()-&gt;domainForCachePartition());
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     CachedResource* cachedResource = memoryCache()-&gt;resourceForRequest(request, m_pageAgent-&gt;page()-&gt;sessionID());
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderFrameLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (174920 => 174921)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/FrameLoader.cpp        2014-10-21 01:50:41 UTC (rev 174920)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp        2014-10-21 02:10:47 UTC (rev 174921)
</span><span class="lines">@@ -1248,7 +1248,7 @@
</span><span class="cx">     }
</span><span class="cx"> #if ENABLE(CACHE_PARTITIONING)
</span><span class="cx">     if (&amp;m_frame.tree().top() != &amp;m_frame)
</span><del>-        request.setCachePartition(m_frame.tree().top().document()-&gt;securityOrigin()-&gt;cachePartition());
</del><ins>+        request.setDomainForCachePartition(m_frame.tree().top().document()-&gt;securityOrigin()-&gt;domainForCachePartition());
</ins><span class="cx"> #endif
</span><span class="cx">     addExtraFieldsToRequest(request, newLoadType, true);
</span><span class="cx">     if (newLoadType == FrameLoadType::Reload || newLoadType == FrameLoadType::ReloadFromOrigin)
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderarchivecfLegacyWebArchivecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp (174920 => 174921)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp        2014-10-21 01:50:41 UTC (rev 174920)
+++ trunk/Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp        2014-10-21 02:10:47 UTC (rev 174921)
</span><span class="lines">@@ -546,7 +546,7 @@
</span><span class="cx"> 
</span><span class="cx">                 ResourceRequest request(subresourceURL);
</span><span class="cx"> #if ENABLE(CACHE_PARTITIONING)
</span><del>-                request.setCachePartition(frame-&gt;document()-&gt;topOrigin()-&gt;cachePartition());
</del><ins>+                request.setDomainForCachePartition(frame-&gt;document()-&gt;topOrigin()-&gt;domainForCachePartition());
</ins><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></span></pre></div>
<a id="trunkSourceWebCoreloadercacheCachedResourceLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp (174920 => 174921)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp        2014-10-21 01:50:41 UTC (rev 174920)
+++ trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp        2014-10-21 02:10:47 UTC (rev 174921)
</span><span class="lines">@@ -195,7 +195,7 @@
</span><span class="cx">     URL url = MemoryCache::removeFragmentIdentifierIfNeeded(request.resourceRequest().url());
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(CACHE_PARTITIONING)
</span><del>-    request.mutableResourceRequest().setCachePartition(document()-&gt;topOrigin()-&gt;cachePartition());
</del><ins>+    request.mutableResourceRequest().setDomainForCachePartition(document()-&gt;topOrigin()-&gt;domainForCachePartition());
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     if (CachedResource* existing = memoryCache()-&gt;resourceForRequest(request.resourceRequest(), sessionID())) {
</span><span class="lines">@@ -439,7 +439,7 @@
</span><span class="cx">     CachedResourceHandle&lt;CachedResource&gt; resource;
</span><span class="cx"> #if ENABLE(CACHE_PARTITIONING)
</span><span class="cx">     if (document())
</span><del>-        request.mutableResourceRequest().setCachePartition(document()-&gt;topOrigin()-&gt;cachePartition());
</del><ins>+        request.mutableResourceRequest().setDomainForCachePartition(document()-&gt;topOrigin()-&gt;domainForCachePartition());
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     resource = memoryCache()-&gt;resourceForRequest(request.resourceRequest(), sessionID());
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercacheMemoryCachecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cache/MemoryCache.cpp (174920 => 174921)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/MemoryCache.cpp        2014-10-21 01:50:41 UTC (rev 174920)
+++ trunk/Source/WebCore/loader/cache/MemoryCache.cpp        2014-10-21 02:10:47 UTC (rev 174921)
</span><span class="lines">@@ -233,11 +233,11 @@
</span><span class="cx">     return client;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool MemoryCache::addImageToCache(NativeImagePtr image, const URL&amp; url, const String&amp; cachePartition)
</del><ins>+bool MemoryCache::addImageToCache(NativeImagePtr image, const URL&amp; url, const String&amp; domainForCachePartition)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(image);
</span><span class="cx">     SessionID sessionID = SessionID::defaultSessionID();
</span><del>-    removeImageFromCache(url, cachePartition); // Remove cache entry if it already exists.
</del><ins>+    removeImageFromCache(url, domainForCachePartition); // Remove cache entry if it already exists.
</ins><span class="cx"> 
</span><span class="cx">     RefPtr&lt;BitmapImage&gt; bitmapImage = BitmapImage::create(image, nullptr);
</span><span class="cx">     if (!bitmapImage)
</span><span class="lines">@@ -250,22 +250,22 @@
</span><span class="cx">     cachedImage-&gt;addClient(&amp;dummyCachedImageClient());
</span><span class="cx">     cachedImage-&gt;setDecodedSize(bitmapImage-&gt;decodedSize());
</span><span class="cx"> #if ENABLE(CACHE_PARTITIONING)
</span><del>-    cachedImage-&gt;resourceRequest().setCachePartition(cachePartition);
</del><ins>+    cachedImage-&gt;resourceRequest().setDomainForCachePartition(domainForCachePartition);
</ins><span class="cx"> #endif
</span><span class="cx">     return add(cachedImage.release());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void MemoryCache::removeImageFromCache(const URL&amp; url, const String&amp; cachePartition)
</del><ins>+void MemoryCache::removeImageFromCache(const URL&amp; url, const String&amp; domainForCachePartition)
</ins><span class="cx"> {
</span><span class="cx">     CachedResourceMap&amp; resources = getSessionMap(SessionID::defaultSessionID());
</span><span class="cx"> #if ENABLE(CACHE_PARTITIONING)
</span><span class="cx">     CachedResource* resource;
</span><span class="cx">     if (CachedResourceItem* item = resources.get(url))
</span><del>-        resource = item-&gt;get(ResourceRequest::partitionName(cachePartition));
</del><ins>+        resource = item-&gt;get(ResourceRequest::partitionName(domainForCachePartition));
</ins><span class="cx">     else
</span><span class="cx">         resource = nullptr;
</span><span class="cx"> #else
</span><del>-    UNUSED_PARAM(cachePartition);
</del><ins>+    UNUSED_PARAM(domainForCachePartition);
</ins><span class="cx">     CachedResource* resource = resources.get(url);
</span><span class="cx"> #endif
</span><span class="cx">     if (!resource)
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercacheMemoryCacheh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cache/MemoryCache.h (174920 => 174921)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/MemoryCache.h        2014-10-21 01:50:41 UTC (rev 174920)
+++ trunk/Source/WebCore/loader/cache/MemoryCache.h        2014-10-21 02:10:47 UTC (rev 174921)
</span><span class="lines">@@ -174,8 +174,8 @@
</span><span class="cx"> #if USE(CG)
</span><span class="cx">     // FIXME: Remove the USE(CG) once we either make NativeImagePtr a smart pointer on all platforms or
</span><span class="cx">     // remove the usage of CFRetain() in MemoryCache::addImageToCache() so as to make the code platform-independent.
</span><del>-    WEBCORE_EXPORT bool addImageToCache(NativeImagePtr, const URL&amp;, const String&amp; cachePartition);
-    WEBCORE_EXPORT void removeImageFromCache(const URL&amp;, const String&amp; cachePartition);
</del><ins>+    WEBCORE_EXPORT bool addImageToCache(NativeImagePtr, const URL&amp;, const String&amp; domainForCachePartition);
+    WEBCORE_EXPORT void removeImageFromCache(const URL&amp;, const String&amp; domainForCachePartition);
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     // pruneDead*() - Flush decoded and encoded data from resources not referenced by Web pages.
</span></span></pre></div>
<a id="trunkSourceWebCorepageSecurityOrigincpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/SecurityOrigin.cpp (174920 => 174921)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/SecurityOrigin.cpp        2014-10-21 01:50:41 UTC (rev 174920)
+++ trunk/Source/WebCore/page/SecurityOrigin.cpp        2014-10-21 02:10:47 UTC (rev 174921)
</span><span class="lines">@@ -434,7 +434,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(CACHE_PARTITIONING)
</span><del>-String SecurityOrigin::cachePartition() const
</del><ins>+String SecurityOrigin::domainForCachePartition() const
</ins><span class="cx"> {
</span><span class="cx">     if (m_storageBlockingPolicy != BlockThirdPartyStorage)
</span><span class="cx">         return String();
</span></span></pre></div>
<a id="trunkSourceWebCorepageSecurityOriginh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/SecurityOrigin.h (174920 => 174921)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/SecurityOrigin.h        2014-10-21 01:50:41 UTC (rev 174920)
+++ trunk/Source/WebCore/page/SecurityOrigin.h        2014-10-21 02:10:47 UTC (rev 174921)
</span><span class="lines">@@ -147,7 +147,7 @@
</span><span class="cx">     void setStorageBlockingPolicy(StorageBlockingPolicy policy) { m_storageBlockingPolicy = policy; }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(CACHE_PARTITIONING)
</span><del>-    WEBCORE_EXPORT String cachePartition() const;
</del><ins>+    WEBCORE_EXPORT String domainForCachePartition() const;
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     bool canAccessDatabase(const SecurityOrigin* topOrigin = 0) const { return canAccessStorage(topOrigin); };
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkcfResourceRequesth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/cf/ResourceRequest.h (174920 => 174921)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/cf/ResourceRequest.h        2014-10-21 01:50:41 UTC (rev 174920)
+++ trunk/Source/WebCore/platform/network/cf/ResourceRequest.h        2014-10-21 02:10:47 UTC (rev 174921)
</span><span class="lines">@@ -99,7 +99,12 @@
</span><span class="cx"> #if ENABLE(CACHE_PARTITIONING)
</span><span class="cx">         WEBCORE_EXPORT static String partitionName(const String&amp; domain);
</span><span class="cx">         const String&amp; cachePartition() const { return m_cachePartition.isNull() ? emptyString() : m_cachePartition; }
</span><del>-        void setCachePartition(const String&amp; cachePartition) { m_cachePartition = partitionName(cachePartition); }
</del><ins>+        void setCachePartition(const String&amp; cachePartition)
+        {
+            ASSERT(cachePartition == partitionName(cachePartition));
+            m_cachePartition = cachePartition;
+        }
+        void setDomainForCachePartition(const String&amp; domain) { m_cachePartition = partitionName(domain); }
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(COCOA) || USE(CFNETWORK)
</span></span></pre></div>
<a id="trunkSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/ChangeLog (174920 => 174921)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/ChangeLog        2014-10-21 01:50:41 UTC (rev 174920)
+++ trunk/Source/WebKit/mac/ChangeLog        2014-10-21 02:10:47 UTC (rev 174921)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2014-10-20  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        ResourceRequest deserialization unnecessarily calls partitionName() on encoded cache partition
+        https://bugs.webkit.org/show_bug.cgi?id=137797
+
+        Reviewed by Darin Adler.
+
+        Call ResourceRequest::setDomainForPartitionName() instead of
+        setPartitionName() as the argument is a domain, not a valid
+        partition name.
+
+        * Misc/WebCache.mm:
+        (+[WebCache addImageToCache:forURL:forFrame:]):
+        (+[WebCache removeImageFromCacheForURL:forFrame:]):
+
</ins><span class="cx"> 2014-10-20  Andy Estes  &lt;aestes@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Fix the iOS build.
</span></span></pre></div>
<a id="trunkSourceWebKitmacMiscWebCachemm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/Misc/WebCache.mm (174920 => 174921)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Misc/WebCache.mm        2014-10-21 01:50:41 UTC (rev 174920)
+++ trunk/Source/WebKit/mac/Misc/WebCache.mm        2014-10-21 02:10:47 UTC (rev 174921)
</span><span class="lines">@@ -176,7 +176,7 @@
</span><span class="cx">     if (frame)
</span><span class="cx">         topOrigin = core(frame)-&gt;document()-&gt;topOrigin();
</span><span class="cx"> #endif
</span><del>-    return WebCore::memoryCache()-&gt;addImageToCache(image, url, topOrigin ? topOrigin-&gt;cachePartition() : emptyString());
</del><ins>+    return WebCore::memoryCache()-&gt;addImageToCache(image, url, topOrigin ? topOrigin-&gt;domainForCachePartition() : emptyString());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> + (void)removeImageFromCacheForURL:(NSURL *)url
</span><span class="lines">@@ -193,7 +193,7 @@
</span><span class="cx">     if (frame)
</span><span class="cx">         topOrigin = core(frame)-&gt;document()-&gt;topOrigin();
</span><span class="cx"> #endif
</span><del>-    WebCore::memoryCache()-&gt;removeImageFromCache(url, topOrigin ? topOrigin-&gt;cachePartition() : emptyString());
</del><ins>+    WebCore::memoryCache()-&gt;removeImageFromCache(url, topOrigin ? topOrigin-&gt;domainForCachePartition() : emptyString());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> + (CGImageRef)imageForURL:(NSURL *)url
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (174920 => 174921)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-10-21 01:50:41 UTC (rev 174920)
+++ trunk/Source/WebKit2/ChangeLog        2014-10-21 02:10:47 UTC (rev 174921)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2014-10-20  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        ResourceRequest deserialization unnecessarily calls partitionName() on encoded cache partition
+        https://bugs.webkit.org/show_bug.cgi?id=137797
+
+        Reviewed by Darin Adler.
+
+        This patch adds a |needsValidation| argument to
+        ResourceRequest::setCachePartition() setter so that the caller can
+        indicate that the partition name is valid (because it was already
+        processed by partitionName() before). Use this new argument in
+        ArgumentCoder&lt;ResourceRequest&gt;::decode() to spent a bit less time
+        deserializing resource requests.
+
+        * Shared/WebCoreArgumentCoders.cpp:
+        (IPC::ArgumentCoder&lt;ResourceRequest&gt;::decode):
+
</ins><span class="cx"> 2014-10-20  Beth Dakin  &lt;bdakin@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Action menu items should have tags
</span></span></pre>
</div>
</div>

</body>
</html>