<!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>[202148] trunk/Source/WebKit2</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/202148">202148</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2016-06-16 16:39:29 -0700 (Thu, 16 Jun 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>[WK2] Improve serialization of SubresourcesEntry to network disk cache
https://bugs.webkit.org/show_bug.cgi?id=158851

Reviewed by Antti Koivisto.

Improve serialization of SubresourcesEntry to network disk cache:
- Do not bother serializing SubresourceInfo's first party for cookies
  and HTTP headers data members if the resource is transient. This is
  because those are never used for transient resources. This patch also
  makes it so that we do not even bother initializing those data members
  if the transient flag is set.
- Update SubresourceInfo::encode() / decode() to encode and decode
  the HTTPHeaderMap data member with the right NetworkCache::Coder
  template specialization instead of using directly HTTPHeaderMap::decode()
  and HTTPHeaderMap::encode(). HTTPHeaderMap::decode() / encode() is
  unsafe in the disk cache case (see <a href="http://trac.webkit.org/projects/webkit/changeset/200394">r200394</a>).

Also update entry types as so:
- &quot;resource&quot; -&gt; &quot;Resource&quot;
- &quot;subresources&quot; -&gt; &quot;SubResources&quot;

These entry types are used a folder names in the disk cache and other
folder names were capitalized. Antti suggested this was a good time
to harmonize since we're bumping the cache version.

* NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
(WebKit::NetworkCache::constructRevalidationRequest):
(WebKit::NetworkCache::SpeculativeLoadManager::startSpeculativeRevalidation):
* NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.h:
* NetworkProcess/cache/NetworkCacheStorage.h:
* NetworkProcess/cache/NetworkCacheSubresourcesEntry.cpp:
(WebKit::NetworkCache::SubresourceInfo::encode):
(WebKit::NetworkCache::SubresourceInfo::decode):
* NetworkProcess/cache/NetworkCacheSubresourcesEntry.h:
(WebKit::NetworkCache::SubresourceInfo::SubresourceInfo):
(WebKit::NetworkCache::SubresourceInfo::isTransient):
(WebKit::NetworkCache::SubresourceInfo::firstPartyForCookies):
(WebKit::NetworkCache::SubresourceInfo::requestHeaders):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcesscacheNetworkCachecpp">trunk/Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcesscacheNetworkCacheEntrycpp">trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheEntry.cpp</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcesscacheNetworkCacheSpeculativeLoadManagercpp">trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcesscacheNetworkCacheSpeculativeLoadManagerh">trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.h</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcesscacheNetworkCacheStatisticscpp">trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStatistics.cpp</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcesscacheNetworkCacheStorageh">trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStorage.h</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcesscacheNetworkCacheSubresourcesEntrycpp">trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheSubresourcesEntry.cpp</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcesscacheNetworkCacheSubresourcesEntryh">trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheSubresourcesEntry.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (202147 => 202148)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2016-06-16 23:34:17 UTC (rev 202147)
+++ trunk/Source/WebKit2/ChangeLog        2016-06-16 23:39:29 UTC (rev 202148)
</span><span class="lines">@@ -1,3 +1,44 @@
</span><ins>+2016-06-16  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        [WK2] Improve serialization of SubresourcesEntry to network disk cache
+        https://bugs.webkit.org/show_bug.cgi?id=158851
+
+        Reviewed by Antti Koivisto.
+
+        Improve serialization of SubresourcesEntry to network disk cache:
+        - Do not bother serializing SubresourceInfo's first party for cookies
+          and HTTP headers data members if the resource is transient. This is
+          because those are never used for transient resources. This patch also
+          makes it so that we do not even bother initializing those data members
+          if the transient flag is set.
+        - Update SubresourceInfo::encode() / decode() to encode and decode
+          the HTTPHeaderMap data member with the right NetworkCache::Coder
+          template specialization instead of using directly HTTPHeaderMap::decode()
+          and HTTPHeaderMap::encode(). HTTPHeaderMap::decode() / encode() is
+          unsafe in the disk cache case (see r200394).
+
+        Also update entry types as so:
+        - &quot;resource&quot; -&gt; &quot;Resource&quot;
+        - &quot;subresources&quot; -&gt; &quot;SubResources&quot;
+
+        These entry types are used a folder names in the disk cache and other
+        folder names were capitalized. Antti suggested this was a good time
+        to harmonize since we're bumping the cache version.
+
+        * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
+        (WebKit::NetworkCache::constructRevalidationRequest):
+        (WebKit::NetworkCache::SpeculativeLoadManager::startSpeculativeRevalidation):
+        * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.h:
+        * NetworkProcess/cache/NetworkCacheStorage.h:
+        * NetworkProcess/cache/NetworkCacheSubresourcesEntry.cpp:
+        (WebKit::NetworkCache::SubresourceInfo::encode):
+        (WebKit::NetworkCache::SubresourceInfo::decode):
+        * NetworkProcess/cache/NetworkCacheSubresourcesEntry.h:
+        (WebKit::NetworkCache::SubresourceInfo::SubresourceInfo):
+        (WebKit::NetworkCache::SubresourceInfo::isTransient):
+        (WebKit::NetworkCache::SubresourceInfo::firstPartyForCookies):
+        (WebKit::NetworkCache::SubresourceInfo::requestHeaders):
+
</ins><span class="cx"> 2016-06-16  Anders Carlsson  &lt;andersca@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Fix macOS Sierra build
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcesscacheNetworkCachecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp (202147 => 202148)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp        2016-06-16 23:34:17 UTC (rev 202147)
+++ trunk/Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp        2016-06-16 23:39:29 UTC (rev 202148)
</span><span class="lines">@@ -55,7 +55,7 @@
</span><span class="cx"> static const AtomicString&amp; resourceType()
</span><span class="cx"> {
</span><span class="cx">     ASSERT(WTF::isMainThread());
</span><del>-    static NeverDestroyed&lt;const AtomicString&gt; resource(&quot;resource&quot;, AtomicString::ConstructFromLiteral);
</del><ins>+    static NeverDestroyed&lt;const AtomicString&gt; resource(&quot;Resource&quot;, AtomicString::ConstructFromLiteral);
</ins><span class="cx">     return resource;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcesscacheNetworkCacheEntrycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheEntry.cpp (202147 => 202148)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheEntry.cpp        2016-06-16 23:34:17 UTC (rev 202147)
+++ trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheEntry.cpp        2016-06-16 23:39:29 UTC (rev 202148)
</span><span class="lines">@@ -46,7 +46,7 @@
</span><span class="cx">     , m_varyingRequestHeaders(varyingRequestHeaders)
</span><span class="cx">     , m_buffer(WTFMove(buffer))
</span><span class="cx"> {
</span><del>-    ASSERT(m_key.type() == &quot;resource&quot;);
</del><ins>+    ASSERT(m_key.type() == &quot;Resource&quot;);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Entry::Entry(const Key&amp; key, const WebCore::ResourceResponse&amp; response, const WebCore::ResourceRequest&amp; redirectRequest, const Vector&lt;std::pair&lt;String, String&gt;&gt;&amp; varyingRequestHeaders)
</span><span class="lines">@@ -55,7 +55,7 @@
</span><span class="cx">     , m_response(response)
</span><span class="cx">     , m_varyingRequestHeaders(varyingRequestHeaders)
</span><span class="cx"> {
</span><del>-    ASSERT(m_key.type() == &quot;resource&quot;);
</del><ins>+    ASSERT(m_key.type() == &quot;Resource&quot;);
</ins><span class="cx">     // Redirect body is not needed even if exists.
</span><span class="cx"> 
</span><span class="cx">     m_redirectRequest = std::make_unique&lt;WebCore::ResourceRequest&gt;();
</span><span class="lines">@@ -78,7 +78,7 @@
</span><span class="cx">     , m_timeStamp(storageEntry.timeStamp)
</span><span class="cx">     , m_sourceStorageRecord(storageEntry)
</span><span class="cx"> {
</span><del>-    ASSERT(m_key.type() == &quot;resource&quot;);
</del><ins>+    ASSERT(m_key.type() == &quot;Resource&quot;);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Storage::Record Entry::encodeAsStorageRecord() const
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcesscacheNetworkCacheSpeculativeLoadManagercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp (202147 => 202148)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp        2016-06-16 23:34:17 UTC (rev 202147)
+++ trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp        2016-06-16 23:39:29 UTC (rev 202148)
</span><span class="lines">@@ -75,7 +75,7 @@
</span><span class="cx"> static const AtomicString&amp; subresourcesType()
</span><span class="cx"> {
</span><span class="cx">     ASSERT(RunLoop::isMain());
</span><del>-    static NeverDestroyed&lt;const AtomicString&gt; resource(&quot;subresources&quot;, AtomicString::ConstructFromLiteral);
</del><ins>+    static NeverDestroyed&lt;const AtomicString&gt; resource(&quot;SubResources&quot;, AtomicString::ConstructFromLiteral);
</ins><span class="cx">     return resource;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -87,8 +87,8 @@
</span><span class="cx"> static inline ResourceRequest constructRevalidationRequest(const Entry&amp; entry, const SubresourceInfo&amp; subResourceInfo)
</span><span class="cx"> {
</span><span class="cx">     ResourceRequest revalidationRequest(entry.key().identifier());
</span><del>-    revalidationRequest.setHTTPHeaderFields(subResourceInfo.requestHeaders);
-    revalidationRequest.setFirstPartyForCookies(subResourceInfo.firstPartyForCookies);
</del><ins>+    revalidationRequest.setHTTPHeaderFields(subResourceInfo.requestHeaders());
+    revalidationRequest.setFirstPartyForCookies(subResourceInfo.firstPartyForCookies());
</ins><span class="cx"> #if ENABLE(CACHE_PARTITIONING)
</span><span class="cx">     if (entry.key().hasPartition())
</span><span class="cx">         revalidationRequest.setCachePartition(entry.key().partition());
</span><span class="lines">@@ -504,7 +504,7 @@
</span><span class="cx">     for (auto&amp; subresourcePair : entry.subresources()) {
</span><span class="cx">         auto&amp; key = subresourcePair.key;
</span><span class="cx">         auto&amp; subresourceInfo = subresourcePair.value;
</span><del>-        if (!subresourceInfo.isTransient)
</del><ins>+        if (!subresourceInfo.isTransient())
</ins><span class="cx">             preloadEntry(key, subresourceInfo, frameID);
</span><span class="cx">         else {
</span><span class="cx">             LOG(NetworkCacheSpeculativePreloading, &quot;(NetworkProcess) Not preloading '%s' because it is marked as transient&quot;, key.identifier().utf8().data());
</span><span class="lines">@@ -518,7 +518,7 @@
</span><span class="cx"> 
</span><span class="cx"> void SpeculativeLoadManager::retrieveSubresourcesEntry(const Key&amp; storageKey, std::function&lt;void (std::unique_ptr&lt;SubresourcesEntry&gt;)&gt;&amp;&amp; completionHandler)
</span><span class="cx"> {
</span><del>-    ASSERT(storageKey.type() == &quot;resource&quot;);
</del><ins>+    ASSERT(storageKey.type() == &quot;Resource&quot;);
</ins><span class="cx">     auto subresourcesStorageKey = makeSubresourcesKey(storageKey);
</span><span class="cx">     m_storage.retrieve(subresourcesStorageKey, static_cast&lt;unsigned&gt;(ResourceLoadPriority::Medium), [completionHandler = WTFMove(completionHandler)](auto record) {
</span><span class="cx">         if (!record) {
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcesscacheNetworkCacheSpeculativeLoadManagerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.h (202147 => 202148)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.h        2016-06-16 23:34:17 UTC (rev 202147)
+++ trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.h        2016-06-16 23:39:29 UTC (rev 202148)
</span><span class="lines">@@ -40,8 +40,8 @@
</span><span class="cx"> 
</span><span class="cx"> class Entry;
</span><span class="cx"> class SpeculativeLoad;
</span><ins>+class SubresourceInfo;
</ins><span class="cx"> class SubresourcesEntry;
</span><del>-struct SubresourceInfo;
</del><span class="cx"> 
</span><span class="cx"> class SpeculativeLoadManager {
</span><span class="cx">     WTF_MAKE_FAST_ALLOCATED;
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcesscacheNetworkCacheStatisticscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStatistics.cpp (202147 => 202148)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStatistics.cpp        2016-06-16 23:34:17 UTC (rev 202147)
+++ trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStatistics.cpp        2016-06-16 23:39:29 UTC (rev 202148)
</span><span class="lines">@@ -141,7 +141,7 @@
</span><span class="cx">     LOG(NetworkCache, &quot;(NetworkProcess) Bootstrapping the network cache statistics database from the network cache...&quot;);
</span><span class="cx"> 
</span><span class="cx">     HashSet&lt;String&gt; hashes;
</span><del>-    traverseRecordsFiles(networkCachePath, ASCIILiteral(&quot;resource&quot;), [&amp;hashes](const String&amp; fileName, const String&amp; hashString, const String&amp; type, bool isBodyBlob, const String&amp; recordDirectoryPath) {
</del><ins>+    traverseRecordsFiles(networkCachePath, ASCIILiteral(&quot;Resource&quot;), [&amp;hashes](const String&amp; fileName, const String&amp; hashString, const String&amp; type, bool isBodyBlob, const String&amp; recordDirectoryPath) {
</ins><span class="cx">         if (isBodyBlob)
</span><span class="cx">             return;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcesscacheNetworkCacheStorageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStorage.h (202147 => 202148)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStorage.h        2016-06-16 23:34:17 UTC (rev 202147)
+++ trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStorage.h        2016-06-16 23:39:29 UTC (rev 202148)
</span><span class="lines">@@ -87,7 +87,7 @@
</span><span class="cx">     size_t capacity() const { return m_capacity; }
</span><span class="cx">     size_t approximateSize() const;
</span><span class="cx"> 
</span><del>-    static const unsigned version = 7;
</del><ins>+    static const unsigned version = 8;
</ins><span class="cx"> 
</span><span class="cx">     String basePath() const;
</span><span class="cx">     String versionPath() const;
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcesscacheNetworkCacheSubresourcesEntrycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheSubresourcesEntry.cpp (202147 => 202148)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheSubresourcesEntry.cpp        2016-06-16 23:34:17 UTC (rev 202147)
+++ trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheSubresourcesEntry.cpp        2016-06-16 23:39:29 UTC (rev 202148)
</span><span class="lines">@@ -38,19 +38,30 @@
</span><span class="cx"> 
</span><span class="cx"> void SubresourceInfo::encode(Encoder&amp; encoder) const
</span><span class="cx"> {
</span><del>-    encoder &lt;&lt; firstPartyForCookies;
-    encoder &lt;&lt; isTransient;
-    requestHeaders.encode(encoder);
</del><ins>+    encoder &lt;&lt; m_isTransient;
+
+    // Do not bother serializing other data members of transient resources as they are empty.
+    if (m_isTransient)
+        return;
+
+    encoder &lt;&lt; m_firstPartyForCookies;
+    encoder &lt;&lt; m_requestHeaders;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool SubresourceInfo::decode(Decoder&amp; decoder, SubresourceInfo&amp; info)
</span><span class="cx"> {
</span><del>-    if (!decoder.decode(info.firstPartyForCookies))
</del><ins>+    if (!decoder.decode(info.m_isTransient))
</ins><span class="cx">         return false;
</span><del>-    if (!decoder.decode(info.isTransient))
</del><ins>+
+    if (info.m_isTransient)
+        return true;
+
+    if (!decoder.decode(info.m_firstPartyForCookies))
</ins><span class="cx">         return false;
</span><del>-    if (!WebCore::HTTPHeaderMap::decode(decoder, info.requestHeaders))
</del><ins>+
+    if (!decoder.decode(info.m_requestHeaders))
</ins><span class="cx">         return false;
</span><ins>+
</ins><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -84,14 +95,14 @@
</span><span class="cx">     : m_key(storageEntry.key)
</span><span class="cx">     , m_timeStamp(storageEntry.timeStamp)
</span><span class="cx"> {
</span><del>-    ASSERT(m_key.type() == &quot;subresources&quot;);
</del><ins>+    ASSERT(m_key.type() == &quot;SubResources&quot;);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> SubresourcesEntry::SubresourcesEntry(Key&amp;&amp; key, const Vector&lt;std::unique_ptr&lt;SubresourceLoad&gt;&gt;&amp; subresourceLoads)
</span><span class="cx">     : m_key(WTFMove(key))
</span><span class="cx">     , m_timeStamp(std::chrono::system_clock::now())
</span><span class="cx"> {
</span><del>-    ASSERT(m_key.type() == &quot;subresources&quot;);
</del><ins>+    ASSERT(m_key.type() == &quot;SubResources&quot;);
</ins><span class="cx">     for (auto&amp; subresourceLoad : subresourceLoads)
</span><span class="cx">         m_subresources.add(subresourceLoad-&gt;key, SubresourceInfo(subresourceLoad-&gt;request));
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcesscacheNetworkCacheSubresourcesEntryh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheSubresourcesEntry.h (202147 => 202148)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheSubresourcesEntry.h        2016-06-16 23:34:17 UTC (rev 202147)
+++ trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheSubresourcesEntry.h        2016-06-16 23:39:29 UTC (rev 202148)
</span><span class="lines">@@ -38,23 +38,28 @@
</span><span class="cx"> namespace WebKit {
</span><span class="cx"> namespace NetworkCache {
</span><span class="cx"> 
</span><del>-struct SubresourceInfo {
</del><ins>+class SubresourceInfo {
</ins><span class="cx">     WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><del>-
</del><span class="cx">     void encode(Encoder&amp;) const;
</span><span class="cx">     static bool decode(Decoder&amp;, SubresourceInfo&amp;);
</span><span class="cx"> 
</span><span class="cx">     SubresourceInfo() = default;
</span><span class="cx">     SubresourceInfo(const WebCore::ResourceRequest&amp; request, bool isTransient = false)
</span><del>-        : firstPartyForCookies(request.firstPartyForCookies())
-        , requestHeaders(request.httpHeaderFields())
-        , isTransient(isTransient)
-    { }
</del><ins>+        : m_isTransient(isTransient)
+        , m_firstPartyForCookies(isTransient ? WebCore::URL() : request.firstPartyForCookies())
+        , m_requestHeaders(isTransient ? WebCore::HTTPHeaderMap() : request.httpHeaderFields())
+    {
+    }
</ins><span class="cx"> 
</span><del>-    WebCore::URL firstPartyForCookies;
-    WebCore::HTTPHeaderMap requestHeaders;
-    bool isTransient { false };
</del><ins>+    bool isTransient() const { return m_isTransient; }
+    const WebCore::URL&amp; firstPartyForCookies() const { ASSERT(!m_isTransient); return m_firstPartyForCookies; }
+    const WebCore::HTTPHeaderMap&amp; requestHeaders() const { ASSERT(!m_isTransient); return m_requestHeaders; }
+
+private:
+    bool m_isTransient { true };
+    WebCore::URL m_firstPartyForCookies;
+    WebCore::HTTPHeaderMap m_requestHeaders;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> struct SubresourceLoad {
</span></span></pre>
</div>
</div>

</body>
</html>