<!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>[259922] 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/259922">259922</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2020-04-10 23:39:36 -0700 (Fri, 10 Apr 2020)</dd>
</dl>

<h3>Log Message</h3>
<pre>PersistentCoders should use modern decoding syntax
https://bugs.webkit.org/show_bug.cgi?id=207497

Patch by Alex Christensen <achristensen@webkit.org> on 2020-04-10
Reviewed by Darin Adler.

Source/WebCore:

* inspector/InspectorFrontendHost.cpp:
(WebCore::InspectorFrontendHost::showCertificate):
* loader/FetchOptions.h:
(WebCore::FetchOptions::decodePersistent):
* page/csp/ContentSecurityPolicyResponseHeaders.h:
(WebCore::ContentSecurityPolicyResponseHeaders::encode const):
(WebCore::ContentSecurityPolicyResponseHeaders::decode):
* platform/PasteboardCustomData.cpp:
(WebCore::PasteboardCustomData::fromSharedBuffer):
* platform/network/ResourceLoadPriority.h:
* platform/network/ResourceRequestBase.h:
(WebCore::ResourceRequestBase::encodeBase const):
(WebCore::ResourceRequestBase::decodeBase):
* platform/network/cf/CertificateInfo.h:
(WTF::Persistence::decodeCFData):
(WTF::Persistence::decodeSecTrustRef):
(WTF::Persistence::decodeCertificateChain):
(WTF::Persistence::Coder<WebCore::CertificateInfo>::encode):
(WTF::Persistence::Coder<WebCore::CertificateInfo>::decode):
* workers/service/server/RegistrationDatabase.cpp:
(WebCore::RegistrationDatabase::doPushChanges):
(WebCore::RegistrationDatabase::importRecords):

Source/WebKit:

* NetworkProcess/cache/CacheStorageEngineCache.cpp:
(WebKit::CacheStorage::decodeDOMCacheRecord):
(WebKit::CacheStorage::Cache::decodeRecordHeader):
* NetworkProcess/cache/CacheStorageEngineCaches.cpp:
(WebKit::CacheStorage::Caches::readOrigin):
(WebKit::CacheStorage::decodeCachesNames):
* NetworkProcess/cache/NetworkCacheCoders.cpp:
(WTF::Persistence::Coder<WebCore::HTTPHeaderMap>::decode):
* NetworkProcess/cache/NetworkCacheEntry.cpp:
(WebKit::NetworkCache::Entry::decodeStorageRecord):
* NetworkProcess/cache/NetworkCacheKey.cpp:
(WebKit::NetworkCache::Key::decode):
* NetworkProcess/cache/NetworkCacheKey.h:
* NetworkProcess/cache/NetworkCacheStorage.cpp:
(WebKit::NetworkCache::decodeRecordMetaData):
* NetworkProcess/cache/NetworkCacheSubresourcesEntry.cpp:
(WebKit::NetworkCache::SubresourceInfo::encode const):
(WebKit::NetworkCache::SubresourceInfo::decode):
(WebKit::NetworkCache::SubresourcesEntry::decodeStorageRecord):
* NetworkProcess/cache/NetworkCacheSubresourcesEntry.h:
* Shared/UserData.cpp:
(WebKit::UserData::decode):
* UIProcess/API/APIContentRuleListStore.cpp:
(API::decodeContentRuleListMetaData):

Source/WTF:

This paves the way for more serialized types that do not have a default constructor.

* wtf/persistence/PersistentCoder.h:
(WTF::Persistence::Coder::encode):
(WTF::Persistence::Coder::decode):
* wtf/persistence/PersistentCoders.cpp:
(WTF::Persistence::Coder<AtomString>::decode):
(WTF::Persistence::Coder<CString>::decode):
(WTF::Persistence::decodeStringText):
(WTF::Persistence::Coder<String>::decode):
(WTF::Persistence::Coder<SHA1::Digest>::decode):
* wtf/persistence/PersistentCoders.h:
(WTF::Persistence::Coder<Optional<T>>::decode):
(WTF::Persistence::Coder<Seconds>::decode):
(WTF::Persistence::Coder<WallTime>::decode):
* wtf/persistence/PersistentDecoder.cpp:
(WTF::Persistence::Decoder::decodeNumber):
(WTF::Persistence::Decoder::operator>>):
(WTF::Persistence::Decoder::decode): Deleted.
* wtf/persistence/PersistentDecoder.h:
(WTF::Persistence::Decoder::operator>>):
(WTF::Persistence::Decoder::decode): Deleted.
(WTF::Persistence::Decoder::decodeEnum): Deleted.
* wtf/persistence/PersistentEncoder.h:
(WTF::Persistence::Encoder::operator<<):
(WTF::Persistence::Encoder::encode): Deleted.
(WTF::Persistence::Encoder::encodeEnum): Deleted.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWTFChangeLog">trunk/Source/WTF/ChangeLog</a></li>
<li><a href="#trunkSourceWTFwtfURLh">trunk/Source/WTF/wtf/URL.h</a></li>
<li><a href="#trunkSourceWTFwtfpersistencePersistentCoderh">trunk/Source/WTF/wtf/persistence/PersistentCoder.h</a></li>
<li><a href="#trunkSourceWTFwtfpersistencePersistentCoderscpp">trunk/Source/WTF/wtf/persistence/PersistentCoders.cpp</a></li>
<li><a href="#trunkSourceWTFwtfpersistencePersistentCodersh">trunk/Source/WTF/wtf/persistence/PersistentCoders.h</a></li>
<li><a href="#trunkSourceWTFwtfpersistencePersistentDecodercpp">trunk/Source/WTF/wtf/persistence/PersistentDecoder.cpp</a></li>
<li><a href="#trunkSourceWTFwtfpersistencePersistentDecoderh">trunk/Source/WTF/wtf/persistence/PersistentDecoder.h</a></li>
<li><a href="#trunkSourceWTFwtfpersistencePersistentEncodercpp">trunk/Source/WTF/wtf/persistence/PersistentEncoder.cpp</a></li>
<li><a href="#trunkSourceWTFwtfpersistencePersistentEncoderh">trunk/Source/WTF/wtf/persistence/PersistentEncoder.h</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorFrontendHostcpp">trunk/Source/WebCore/inspector/InspectorFrontendHost.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectoragentsInspectorNetworkAgentcpp">trunk/Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderFetchOptionsh">trunk/Source/WebCore/loader/FetchOptions.h</a></li>
<li><a href="#trunkSourceWebCorepageSecurityOriginDatah">trunk/Source/WebCore/page/SecurityOriginData.h</a></li>
<li><a href="#trunkSourceWebCorepagecspContentSecurityPolicyResponseHeadersh">trunk/Source/WebCore/page/csp/ContentSecurityPolicyResponseHeaders.h</a></li>
<li><a href="#trunkSourceWebCoreplatformPasteboardCustomDatacpp">trunk/Source/WebCore/platform/PasteboardCustomData.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgenericKeyedDecoderGenericcpp">trunk/Source/WebCore/platform/generic/KeyedDecoderGeneric.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkNetworkLoadMetricsh">trunk/Source/WebCore/platform/network/NetworkLoadMetrics.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkResourceLoadPriorityh">trunk/Source/WebCore/platform/network/ResourceLoadPriority.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkResourceRequestBaseh">trunk/Source/WebCore/platform/network/ResourceRequestBase.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkResourceResponseBaseh">trunk/Source/WebCore/platform/network/ResourceResponseBase.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkcfCertificateInfoh">trunk/Source/WebCore/platform/network/cf/CertificateInfo.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkcfCertificateInfoCFNetcpp">trunk/Source/WebCore/platform/network/cf/CertificateInfoCFNet.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkcurlCertificateInfoh">trunk/Source/WebCore/platform/network/curl/CertificateInfo.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworksoupCertificateInfoh">trunk/Source/WebCore/platform/network/soup/CertificateInfo.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworksoupResourceResponseh">trunk/Source/WebCore/platform/network/soup/ResourceResponse.h</a></li>
<li><a href="#trunkSourceWebCoreworkersserviceServiceWorkerContextDatah">trunk/Source/WebCore/workers/service/ServiceWorkerContextData.h</a></li>
<li><a href="#trunkSourceWebCoreworkersserviceserverRegistrationDatabasecpp">trunk/Source/WebCore/workers/service/server/RegistrationDatabase.cpp</a></li>
<li><a href="#trunkSourceWebKitChangeLog">trunk/Source/WebKit/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitNetworkProcesscacheCacheStorageEngineCachecpp">trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngineCache.cpp</a></li>
<li><a href="#trunkSourceWebKitNetworkProcesscacheCacheStorageEngineCachescpp">trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp</a></li>
<li><a href="#trunkSourceWebKitNetworkProcesscacheNetworkCacheCoderscpp">trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheCoders.cpp</a></li>
<li><a href="#trunkSourceWebKitNetworkProcesscacheNetworkCacheCodersh">trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheCoders.h</a></li>
<li><a href="#trunkSourceWebKitNetworkProcesscacheNetworkCacheEntrycpp">trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheEntry.cpp</a></li>
<li><a href="#trunkSourceWebKitNetworkProcesscacheNetworkCacheKeycpp">trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheKey.cpp</a></li>
<li><a href="#trunkSourceWebKitNetworkProcesscacheNetworkCacheKeyh">trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheKey.h</a></li>
<li><a href="#trunkSourceWebKitNetworkProcesscacheNetworkCacheStoragecpp">trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheStorage.cpp</a></li>
<li><a href="#trunkSourceWebKitNetworkProcesscacheNetworkCacheSubresourcesEntrycpp">trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheSubresourcesEntry.cpp</a></li>
<li><a href="#trunkSourceWebKitNetworkProcesscacheNetworkCacheSubresourcesEntryh">trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheSubresourcesEntry.h</a></li>
<li><a href="#trunkSourceWebKitSharedUserDatacpp">trunk/Source/WebKit/Shared/UserData.cpp</a></li>
<li><a href="#trunkSourceWebKitUIProcessAPIAPIContentRuleListStorecpp">trunk/Source/WebKit/UIProcess/API/APIContentRuleListStore.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (259921 => 259922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/ChangeLog       2020-04-11 05:17:24 UTC (rev 259921)
+++ trunk/Source/WTF/ChangeLog  2020-04-11 06:39:36 UTC (rev 259922)
</span><span class="lines">@@ -1,3 +1,38 @@
</span><ins>+2020-04-10  Alex Christensen  <achristensen@webkit.org>
+
+        PersistentCoders should use modern decoding syntax
+        https://bugs.webkit.org/show_bug.cgi?id=207497
+
+        Reviewed by Darin Adler.
+
+        This paves the way for more serialized types that do not have a default constructor.
+
+        * wtf/persistence/PersistentCoder.h:
+        (WTF::Persistence::Coder::encode):
+        (WTF::Persistence::Coder::decode):
+        * wtf/persistence/PersistentCoders.cpp:
+        (WTF::Persistence::Coder<AtomString>::decode):
+        (WTF::Persistence::Coder<CString>::decode):
+        (WTF::Persistence::decodeStringText):
+        (WTF::Persistence::Coder<String>::decode):
+        (WTF::Persistence::Coder<SHA1::Digest>::decode):
+        * wtf/persistence/PersistentCoders.h:
+        (WTF::Persistence::Coder<Optional<T>>::decode):
+        (WTF::Persistence::Coder<Seconds>::decode):
+        (WTF::Persistence::Coder<WallTime>::decode):
+        * wtf/persistence/PersistentDecoder.cpp:
+        (WTF::Persistence::Decoder::decodeNumber):
+        (WTF::Persistence::Decoder::operator>>):
+        (WTF::Persistence::Decoder::decode): Deleted.
+        * wtf/persistence/PersistentDecoder.h:
+        (WTF::Persistence::Decoder::operator>>):
+        (WTF::Persistence::Decoder::decode): Deleted.
+        (WTF::Persistence::Decoder::decodeEnum): Deleted.
+        * wtf/persistence/PersistentEncoder.h:
+        (WTF::Persistence::Encoder::operator<<):
+        (WTF::Persistence::Encoder::encode): Deleted.
+        (WTF::Persistence::Encoder::encodeEnum): Deleted.
+
</ins><span class="cx"> 2020-04-10  David Kilzer  <ddkilzer@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Follow-up: Add WARN_UNUSED_RETURN to decode methods in Source/WTF
</span></span></pre></div>
<a id="trunkSourceWTFwtfURLh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/URL.h (259921 => 259922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/URL.h       2020-04-11 05:17:24 UTC (rev 259921)
+++ trunk/Source/WTF/wtf/URL.h  2020-04-11 06:39:36 UTC (rev 259922)
</span><span class="lines">@@ -248,10 +248,11 @@
</span><span class="cx"> template <class Decoder>
</span><span class="cx"> Optional<URL> URL::decode(Decoder& decoder)
</span><span class="cx"> {
</span><del>-    String string;
-    if (!decoder.decode(string))
</del><ins>+    Optional<String> string;
+    decoder >> string;
+    if (!string)
</ins><span class="cx">         return WTF::nullopt;
</span><del>-    return URL(URL(), string);
</del><ins>+    return URL(URL(), WTFMove(*string));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> WTF_EXPORT_PRIVATE bool equalIgnoringFragmentIdentifier(const URL&, const URL&);
</span></span></pre></div>
<a id="trunkSourceWTFwtfpersistencePersistentCoderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/persistence/PersistentCoder.h (259921 => 259922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/persistence/PersistentCoder.h       2020-04-11 05:17:24 UTC (rev 259921)
+++ trunk/Source/WTF/wtf/persistence/PersistentCoder.h  2020-04-11 06:39:36 UTC (rev 259922)
</span><span class="lines">@@ -30,7 +30,7 @@
</span><span class="cx"> 
</span><span class="cx"> class Decoder;
</span><span class="cx"> class Encoder;
</span><del>-    
</del><ins>+
</ins><span class="cx"> template<typename T> struct Coder {
</span><span class="cx">     static void encode(Encoder& encoder, const T& t)
</span><span class="cx">     {
</span><span class="lines">@@ -37,9 +37,9 @@
</span><span class="cx">         t.encode(encoder);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    static WARN_UNUSED_RETURN bool decode(Decoder& decoder, T& t)
</del><ins>+    static Optional<T> decode(Decoder& decoder)
</ins><span class="cx">     {
</span><del>-        return T::decode(decoder, t);
</del><ins>+        return T::decode(decoder);
</ins><span class="cx">     }
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWTFwtfpersistencePersistentCoderscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/persistence/PersistentCoders.cpp (259921 => 259922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/persistence/PersistentCoders.cpp    2020-04-11 05:17:24 UTC (rev 259921)
+++ trunk/Source/WTF/wtf/persistence/PersistentCoders.cpp       2020-04-11 06:39:36 UTC (rev 259922)
</span><span class="lines">@@ -37,14 +37,14 @@
</span><span class="cx">     encoder << atomString.string();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool Coder<AtomString>::decode(Decoder& decoder, AtomString& atomString)
</del><ins>+Optional<AtomString> Coder<AtomString>::decode(Decoder& decoder)
</ins><span class="cx"> {
</span><del>-    String string;
-    if (!decoder.decode(string))
-        return false;
</del><ins>+    Optional<String> string;
+    decoder >> string;
+    if (!string)
+        return WTF::nullopt;
</ins><span class="cx"> 
</span><del>-    atomString = string;
-    return true;
</del><ins>+    return {{ WTFMove(*string) }};
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void Coder<CString>::encode(Encoder& encoder, const CString& string)
</span><span class="lines">@@ -60,32 +60,30 @@
</span><span class="cx">     encoder.encodeFixedLengthData(reinterpret_cast<const uint8_t*>(string.data()), length);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool Coder<CString>::decode(Decoder& decoder, CString& result)
</del><ins>+Optional<CString> Coder<CString>::decode(Decoder& decoder)
</ins><span class="cx"> {
</span><del>-    uint32_t length;
-    if (!decoder.decode(length))
-        return false;
</del><ins>+    Optional<uint32_t> length;
+    decoder >> length;
+    if (!length)
+        return WTF::nullopt;
</ins><span class="cx"> 
</span><span class="cx">     if (length == std::numeric_limits<uint32_t>::max()) {
</span><span class="cx">         // This is the null string.
</span><del>-        result = CString();
-        return true;
</del><ins>+        return CString();
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // Before allocating the string, make sure that the decoder buffer is big enough.
</span><del>-    if (!decoder.bufferIsLargeEnoughToContain<char>(length))
-        return false;
</del><ins>+    if (!decoder.bufferIsLargeEnoughToContain<char>(*length))
+        return WTF::nullopt;
</ins><span class="cx"> 
</span><span class="cx">     char* buffer;
</span><del>-    CString string = CString::newUninitialized(length, buffer);
-    if (!decoder.decodeFixedLengthData(reinterpret_cast<uint8_t*>(buffer), length))
-        return false;
</del><ins>+    CString string = CString::newUninitialized(*length, buffer);
+    if (!decoder.decodeFixedLengthData(reinterpret_cast<uint8_t*>(buffer), *length))
+        return WTF::nullopt;
</ins><span class="cx"> 
</span><del>-    result = string;
-    return true;
</del><ins>+    return WTFMove(string);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-
</del><span class="cx"> void Coder<String>::encode(Encoder& encoder, const String& string)
</span><span class="cx"> {
</span><span class="cx">     // Special case the null string.
</span><span class="lines">@@ -106,40 +104,40 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> template <typename CharacterType>
</span><del>-static inline WARN_UNUSED_RETURN bool decodeStringText(Decoder& decoder, uint32_t length, String& result)
</del><ins>+static inline Optional<String> decodeStringText(Decoder& decoder, uint32_t length)
</ins><span class="cx"> {
</span><span class="cx">     // Before allocating the string, make sure that the decoder buffer is big enough.
</span><span class="cx">     if (!decoder.bufferIsLargeEnoughToContain<CharacterType>(length))
</span><del>-        return false;
</del><ins>+        return WTF::nullopt;
</ins><span class="cx"> 
</span><span class="cx">     CharacterType* buffer;
</span><span class="cx">     String string = String::createUninitialized(length, buffer);
</span><span class="cx">     if (!decoder.decodeFixedLengthData(reinterpret_cast<uint8_t*>(buffer), length * sizeof(CharacterType)))
</span><del>-        return false;
</del><ins>+        return WTF::nullopt;
</ins><span class="cx">     
</span><del>-    result = string;
-    return true;    
</del><ins>+    return WTFMove(string);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool Coder<String>::decode(Decoder& decoder, String& result)
</del><ins>+Optional<String> Coder<String>::decode(Decoder& decoder)
</ins><span class="cx"> {
</span><del>-    uint32_t length;
-    if (!decoder.decode(length))
-        return false;
</del><ins>+    Optional<uint32_t> length;
+    decoder >> length;
+    if (!length)
+        return WTF::nullopt;
</ins><span class="cx"> 
</span><del>-    if (length == std::numeric_limits<uint32_t>::max()) {
</del><ins>+    if (*length == std::numeric_limits<uint32_t>::max()) {
</ins><span class="cx">         // This is the null string.
</span><del>-        result = String();
-        return true;
</del><ins>+        return String();
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    bool is8Bit;
-    if (!decoder.decode(is8Bit))
-        return false;
</del><ins>+    Optional<bool> is8Bit;
+    decoder >> is8Bit;
+    if (!is8Bit)
+        return WTF::nullopt;
</ins><span class="cx"> 
</span><del>-    if (is8Bit)
-        return decodeStringText<LChar>(decoder, length, result);
-    return decodeStringText<UChar>(decoder, length, result);
</del><ins>+    if (*is8Bit)
+        return decodeStringText<LChar>(decoder, *length);
+    return decodeStringText<UChar>(decoder, *length);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void Coder<SHA1::Digest>::encode(Encoder& encoder, const SHA1::Digest& digest)
</span><span class="lines">@@ -147,9 +145,12 @@
</span><span class="cx">     encoder.encodeFixedLengthData(digest.data(), sizeof(digest));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool Coder<SHA1::Digest>::decode(Decoder& decoder, SHA1::Digest& digest)
</del><ins>+Optional<SHA1::Digest> Coder<SHA1::Digest>::decode(Decoder& decoder)
</ins><span class="cx"> {
</span><del>-    return decoder.decodeFixedLengthData(digest.data(), sizeof(digest));
</del><ins>+    SHA1::Digest tmp;
+    if (!decoder.decodeFixedLengthData(tmp.data(), sizeof(tmp)))
+        return WTF::nullopt;
+    return WTFMove(tmp);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWTFwtfpersistencePersistentCodersh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/persistence/PersistentCoders.h (259921 => 259922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/persistence/PersistentCoders.h      2020-04-11 05:17:24 UTC (rev 259921)
+++ trunk/Source/WTF/wtf/persistence/PersistentCoders.h 2020-04-11 06:39:36 UTC (rev 259922)
</span><span class="lines">@@ -46,19 +46,19 @@
</span><span class="cx">         encoder << pair.first << pair.second;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    static WARN_UNUSED_RETURN bool decode(Decoder& decoder, std::pair<T, U>& pair)
</del><ins>+    static Optional<std::pair<T, U>> decode(Decoder& decoder)
</ins><span class="cx">     {
</span><del>-        T first;
-        if (!decoder.decode(first))
-            return false;
</del><ins>+        Optional<T> first;
+        decoder >> first;
+        if (!first)
+            return WTF::nullopt;
</ins><span class="cx"> 
</span><del>-        U second;
-        if (!decoder.decode(second))
-            return false;
</del><ins>+        Optional<U> second;
+        decoder >> second;
+        if (!second)
+            return WTF::nullopt;
</ins><span class="cx"> 
</span><del>-        pair.first = first;
-        pair.second = second;
-        return true;
</del><ins>+        return {{ WTFMove(*first), WTFMove(*second) }};
</ins><span class="cx">     }
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="lines">@@ -74,23 +74,21 @@
</span><span class="cx">         encoder << optional.value();
</span><span class="cx">     }
</span><span class="cx">     
</span><del>-    static WARN_UNUSED_RETURN bool decode(Decoder& decoder, Optional<T>& optional)
</del><ins>+    static Optional<Optional<T>> decode(Decoder& decoder)
</ins><span class="cx">     {
</span><del>-        bool isEngaged;
-        if (!decoder.decode(isEngaged))
-            return false;
</del><ins>+        Optional<bool> isEngaged;
+        decoder >> isEngaged;
+        if (!isEngaged)
+            return WTF::nullopt;
+        if (!*isEngaged)
+            return Optional<Optional<T>> { Optional<T> { WTF::nullopt } };
</ins><span class="cx">         
</span><del>-        if (!isEngaged) {
-            optional = WTF::nullopt;
-            return true;
-        }
</del><ins>+        Optional<T> value;
+        decoder >> value;
+        if (!value)
+            return WTF::nullopt;
</ins><span class="cx">         
</span><del>-        T value;
-        if (!decoder.decode(value))
-            return false;
-        
-        optional = WTFMove(value);
-        return true;
</del><ins>+        return Optional<Optional<T>> { Optional<T> { WTFMove(*value) } };
</ins><span class="cx">     }
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="lines">@@ -100,19 +98,19 @@
</span><span class="cx">         encoder << pair.key << pair.value;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    static WARN_UNUSED_RETURN bool decode(Decoder& decoder, WTF::KeyValuePair<KeyType, ValueType>& pair)
</del><ins>+    static Optional<WTF::KeyValuePair<KeyType, ValueType>> decode(Decoder& decoder)
</ins><span class="cx">     {
</span><del>-        KeyType key;
-        if (!decoder.decode(key))
-            return false;
</del><ins>+        Optional<KeyType> key;
+        decoder >> key;
+        if (!key)
+            return WTF::nullopt;
</ins><span class="cx"> 
</span><del>-        ValueType value;
-        if (!decoder.decode(value))
-            return false;
</del><ins>+        Optional<ValueType> value;
+        decoder >>value;
+        if (!value)
+            return WTF::nullopt;
</ins><span class="cx"> 
</span><del>-        pair.key = key;
-        pair.value = value;
-        return true;
</del><ins>+        return {{ WTFMove(*key), WTFMove(*value) }};
</ins><span class="cx">     }
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="lines">@@ -126,24 +124,24 @@
</span><span class="cx">             encoder << vector[i];
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    static WARN_UNUSED_RETURN bool decode(Decoder& decoder, Vector<T, inlineCapacity>& vector)
</del><ins>+    static Optional<Vector<T, inlineCapacity>> decode(Decoder& decoder)
</ins><span class="cx">     {
</span><del>-        uint64_t size;
-        if (!decoder.decode(size))
-            return false;
</del><ins>+        Optional<uint64_t> size;
+        decoder >> size;
+        if (!size)
+            return WTF::nullopt;
</ins><span class="cx"> 
</span><span class="cx">         Vector<T, inlineCapacity> tmp;
</span><del>-        for (size_t i = 0; i < size; ++i) {
-            T element;
-            if (!decoder.decode(element))
-                return false;
-            
-            tmp.append(WTFMove(element));
</del><ins>+        for (size_t i = 0; i < *size; ++i) {
+            Optional<T> element;
+            decoder >> element;
+            if (!element)
+                return WTF::nullopt;
+            tmp.append(WTFMove(*element));
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         tmp.shrinkToFit();
</span><del>-        vector.swap(tmp);
-        return true;
</del><ins>+        return WTFMove(tmp);
</ins><span class="cx">     }
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="lines">@@ -154,31 +152,31 @@
</span><span class="cx">         encoder.encodeFixedLengthData(reinterpret_cast<const uint8_t*>(vector.data()), vector.size() * sizeof(T));
</span><span class="cx">     }
</span><span class="cx">     
</span><del>-    static WARN_UNUSED_RETURN bool decode(Decoder& decoder, Vector<T, inlineCapacity>& vector)
</del><ins>+    static Optional<Vector<T, inlineCapacity>> decode(Decoder& decoder)
</ins><span class="cx">     {
</span><del>-        uint64_t decodedSize;
-        if (!decoder.decode(decodedSize))
-            return false;
</del><ins>+        Optional<uint64_t> decodedSize;
+        decoder >> decodedSize;
+        if (!decodedSize)
+            return WTF::nullopt;
</ins><span class="cx"> 
</span><del>-        if (!isInBounds<size_t>(decodedSize))
-            return false;
</del><ins>+        if (!isInBounds<size_t>(*decodedSize))
+            return WTF::nullopt;
</ins><span class="cx"> 
</span><del>-        auto size = static_cast<size_t>(decodedSize);
</del><ins>+        auto size = static_cast<size_t>(*decodedSize);
</ins><span class="cx"> 
</span><span class="cx">         // Since we know the total size of the elements, we can allocate the vector in
</span><span class="cx">         // one fell swoop. Before allocating we must however make sure that the decoder buffer
</span><span class="cx">         // is big enough.
</span><span class="cx">         if (!decoder.bufferIsLargeEnoughToContain<T>(size))
</span><del>-            return false;
</del><ins>+            return WTF::nullopt;
</ins><span class="cx"> 
</span><span class="cx">         Vector<T, inlineCapacity> temp;
</span><span class="cx">         temp.grow(size);
</span><span class="cx"> 
</span><span class="cx">         if (!decoder.decodeFixedLengthData(reinterpret_cast<uint8_t*>(temp.data()), size * sizeof(T)))
</span><del>-            return false;
</del><ins>+            return WTF::nullopt;
</ins><span class="cx"> 
</span><del>-        vector.swap(temp);
-        return true;
</del><ins>+        return WTFMove(temp);
</ins><span class="cx">     }
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="lines">@@ -194,30 +192,32 @@
</span><span class="cx">             encoder << *it;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    static WARN_UNUSED_RETURN bool decode(Decoder& decoder, HashMapType& hashMap)
</del><ins>+    static Optional<HashMapType> decode(Decoder& decoder)
</ins><span class="cx">     {
</span><del>-        uint64_t hashMapSize;
-        if (!decoder.decode(hashMapSize))
-            return false;
</del><ins>+        Optional<uint64_t> hashMapSize;
+        decoder >> hashMapSize;
+        if (!hashMapSize)
+            return WTF::nullopt;
</ins><span class="cx"> 
</span><span class="cx">         HashMapType tempHashMap;
</span><del>-        tempHashMap.reserveInitialCapacity(static_cast<unsigned>(hashMapSize));
-        for (uint64_t i = 0; i < hashMapSize; ++i) {
-            KeyArg key;
-            MappedArg value;
-            if (!decoder.decode(key))
-                return false;
-            if (!decoder.decode(value))
-                return false;
</del><ins>+        tempHashMap.reserveInitialCapacity(static_cast<unsigned>(*hashMapSize));
+        for (uint64_t i = 0; i < *hashMapSize; ++i) {
+            Optional<KeyArg> key;
+            decoder >> key;
+            if (!key)
+                return WTF::nullopt;
+            Optional<MappedArg> value;
+            decoder >> value;
+            if (!value)
+                return WTF::nullopt;
</ins><span class="cx"> 
</span><del>-            if (!tempHashMap.add(key, value).isNewEntry) {
</del><ins>+            if (!tempHashMap.add(WTFMove(*key), WTFMove(*value)).isNewEntry) {
</ins><span class="cx">                 // The hash map already has the specified key, bail.
</span><del>-                return false;
</del><ins>+                return WTF::nullopt;
</ins><span class="cx">             }
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        hashMap.swap(tempHashMap);
-        return true;
</del><ins>+        return WTFMove(tempHashMap);
</ins><span class="cx">     }
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="lines">@@ -231,26 +231,27 @@
</span><span class="cx">             encoder << *it;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    static WARN_UNUSED_RETURN bool decode(Decoder& decoder, HashSetType& hashSet)
</del><ins>+    static Optional<HashSetType> decode(Decoder& decoder)
</ins><span class="cx">     {
</span><del>-        uint64_t hashSetSize;
-        if (!decoder.decode(hashSetSize))
-            return false;
</del><ins>+        Optional<uint64_t> hashSetSize;
+        decoder >> hashSetSize;
+        if (!hashSetSize)
+            return WTF::nullopt;
</ins><span class="cx"> 
</span><span class="cx">         HashSetType tempHashSet;
</span><del>-        for (uint64_t i = 0; i < hashSetSize; ++i) {
-            KeyArg key;
-            if (!decoder.decode(key))
-                return false;
</del><ins>+        for (uint64_t i = 0; i < *hashSetSize; ++i) {
+            Optional<KeyArg> key;
+            decoder >> key;
+            if (!key)
+                return WTF::nullopt;
</ins><span class="cx"> 
</span><del>-            if (!tempHashSet.add(key).isNewEntry) {
</del><ins>+            if (!tempHashSet.add(WTFMove(*key)).isNewEntry) {
</ins><span class="cx">                 // The hash map already has the specified key, bail.
</span><del>-                return false;
</del><ins>+                return WTF::nullopt;
</ins><span class="cx">             }
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        hashSet.swap(tempHashSet);
-        return true;
</del><ins>+        return WTFMove(tempHashSet);
</ins><span class="cx">     }
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="lines">@@ -260,14 +261,13 @@
</span><span class="cx">         encoder << seconds.value();
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    static WARN_UNUSED_RETURN bool decode(Decoder& decoder, Seconds& result)
</del><ins>+    static Optional<Seconds> decode(Decoder& decoder)
</ins><span class="cx">     {
</span><del>-        double value;
-        if (!decoder.decode(value))
-            return false;
-
-        result = Seconds(value);
-        return true;
</del><ins>+        Optional<double> value;
+        decoder >> value;
+        if (!value)
+            return WTF::nullopt;
+        return Seconds(*value);
</ins><span class="cx">     }
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="lines">@@ -277,35 +277,35 @@
</span><span class="cx">         encoder << time.secondsSinceEpoch().value();
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    static WARN_UNUSED_RETURN bool decode(Decoder& decoder, WallTime& result)
</del><ins>+    static Optional<WallTime> decode(Decoder& decoder)
</ins><span class="cx">     {
</span><del>-        double value;
-        if (!decoder.decode(value))
-            return false;
</del><ins>+        Optional<double> value;
+        decoder >> value;
+        if (!value)
+            return WTF::nullopt;
</ins><span class="cx"> 
</span><del>-        result = WallTime::fromRawSeconds(value);
-        return true;
</del><ins>+        return WallTime::fromRawSeconds(*value);
</ins><span class="cx">     }
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> template<> struct Coder<AtomString> {
</span><span class="cx">     WTF_EXPORT_PRIVATE static void encode(Encoder&, const AtomString&);
</span><del>-    WTF_EXPORT_PRIVATE static bool decode(Decoder&, AtomString&) WARN_UNUSED_RETURN;
</del><ins>+    WTF_EXPORT_PRIVATE static Optional<AtomString> decode(Decoder&);
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> template<> struct Coder<CString> {
</span><span class="cx">     WTF_EXPORT_PRIVATE static void encode(Encoder&, const CString&);
</span><del>-    WTF_EXPORT_PRIVATE static bool decode(Decoder&, CString&) WARN_UNUSED_RETURN;
</del><ins>+    WTF_EXPORT_PRIVATE static Optional<CString> decode(Decoder&);
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> template<> struct Coder<String> {
</span><span class="cx">     WTF_EXPORT_PRIVATE static void encode(Encoder&, const String&);
</span><del>-    WTF_EXPORT_PRIVATE static bool decode(Decoder&, String&) WARN_UNUSED_RETURN;
</del><ins>+    WTF_EXPORT_PRIVATE static Optional<String> decode(Decoder&);
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> template<> struct Coder<SHA1::Digest> {
</span><span class="cx">     WTF_EXPORT_PRIVATE static void encode(Encoder&, const SHA1::Digest&);
</span><del>-    WTF_EXPORT_PRIVATE static bool decode(Decoder&, SHA1::Digest&) WARN_UNUSED_RETURN;
</del><ins>+    WTF_EXPORT_PRIVATE static Optional<SHA1::Digest> decode(Decoder&);
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWTFwtfpersistencePersistentDecodercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/persistence/PersistentDecoder.cpp (259921 => 259922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/persistence/PersistentDecoder.cpp   2020-04-11 05:17:24 UTC (rev 259921)
+++ trunk/Source/WTF/wtf/persistence/PersistentDecoder.cpp      2020-04-11 06:39:36 UTC (rev 259922)
</span><span class="lines">@@ -59,65 +59,67 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-template<typename Type>
-bool Decoder::decodeNumber(Type& value)
</del><ins>+template<typename T>
+Decoder& Decoder::decodeNumber(Optional<T>& optional)
</ins><span class="cx"> {
</span><del>-    if (!bufferIsLargeEnoughToContain(sizeof(value)))
-        return false;
</del><ins>+    if (!bufferIsLargeEnoughToContain(sizeof(T)))
+        return *this;
</ins><span class="cx"> 
</span><del>-    memcpy(&value, m_bufferPosition, sizeof(value));
-    m_bufferPosition += sizeof(Type);
</del><ins>+    T value;
+    memcpy(&value, m_bufferPosition, sizeof(T));
+    m_bufferPosition += sizeof(T);
</ins><span class="cx"> 
</span><span class="cx">     Encoder::updateChecksumForNumber(m_sha1, value);
</span><del>-    return true;
</del><ins>+    optional = value;
+    return *this;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool Decoder::decode(bool& result)
</del><ins>+Decoder& Decoder::operator>>(Optional<bool>& result)
</ins><span class="cx"> {
</span><span class="cx">     return decodeNumber(result);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool Decoder::decode(uint8_t& result)
</del><ins>+Decoder& Decoder::operator>>(Optional<uint8_t>& result)
</ins><span class="cx"> {
</span><span class="cx">     return decodeNumber(result);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool Decoder::decode(uint16_t& result)
</del><ins>+Decoder& Decoder::operator>>(Optional<uint16_t>& result)
</ins><span class="cx"> {
</span><span class="cx">     return decodeNumber(result);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool Decoder::decode(int16_t& result)
</del><ins>+Decoder& Decoder::operator>>(Optional<int16_t>& result)
</ins><span class="cx"> {
</span><span class="cx">     return decodeNumber(result);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool Decoder::decode(uint32_t& result)
</del><ins>+Decoder& Decoder::operator>>(Optional<uint32_t>& result)
</ins><span class="cx"> {
</span><span class="cx">     return decodeNumber(result);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool Decoder::decode(uint64_t& result)
</del><ins>+Decoder& Decoder::operator>>(Optional<uint64_t>& result)
</ins><span class="cx"> {
</span><span class="cx">     return decodeNumber(result);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool Decoder::decode(int32_t& result)
</del><ins>+Decoder& Decoder::operator>>(Optional<int32_t>& result)
</ins><span class="cx"> {
</span><span class="cx">     return decodeNumber(result);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool Decoder::decode(int64_t& result)
</del><ins>+Decoder& Decoder::operator>>(Optional<int64_t>& result)
</ins><span class="cx"> {
</span><span class="cx">     return decodeNumber(result);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool Decoder::decode(float& result)
</del><ins>+Decoder& Decoder::operator>>(Optional<float>& result)
</ins><span class="cx"> {
</span><span class="cx">     return decodeNumber(result);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool Decoder::decode(double& result)
</del><ins>+Decoder& Decoder::operator>>(Optional<double>& result)
</ins><span class="cx"> {
</span><span class="cx">     return decodeNumber(result);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWTFwtfpersistencePersistentDecoderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/persistence/PersistentDecoder.h (259921 => 259922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/persistence/PersistentDecoder.h     2020-04-11 05:17:24 UTC (rev 259921)
+++ trunk/Source/WTF/wtf/persistence/PersistentDecoder.h        2020-04-11 06:39:36 UTC (rev 259922)
</span><span class="lines">@@ -45,50 +45,39 @@
</span><span class="cx"> 
</span><span class="cx">     WTF_EXPORT_PRIVATE bool decodeFixedLengthData(uint8_t*, size_t) WARN_UNUSED_RETURN;
</span><span class="cx"> 
</span><del>-    WTF_EXPORT_PRIVATE bool decode(bool&) WARN_UNUSED_RETURN;
-    WTF_EXPORT_PRIVATE bool decode(uint8_t&) WARN_UNUSED_RETURN;
-    WTF_EXPORT_PRIVATE bool decode(uint16_t&) WARN_UNUSED_RETURN;
-    WTF_EXPORT_PRIVATE bool decode(uint32_t&) WARN_UNUSED_RETURN;
-    WTF_EXPORT_PRIVATE bool decode(uint64_t&) WARN_UNUSED_RETURN;
-    WTF_EXPORT_PRIVATE bool decode(int16_t&) WARN_UNUSED_RETURN;
-    WTF_EXPORT_PRIVATE bool decode(int32_t&) WARN_UNUSED_RETURN;
-    WTF_EXPORT_PRIVATE bool decode(int64_t&) WARN_UNUSED_RETURN;
-    WTF_EXPORT_PRIVATE bool decode(float&) WARN_UNUSED_RETURN;
-    WTF_EXPORT_PRIVATE bool decode(double&) WARN_UNUSED_RETURN;
</del><ins>+    WTF_EXPORT_PRIVATE Decoder& operator>>(Optional<bool>&);
+    WTF_EXPORT_PRIVATE Decoder& operator>>(Optional<uint8_t>&);
+    WTF_EXPORT_PRIVATE Decoder& operator>>(Optional<uint16_t>&);
+    WTF_EXPORT_PRIVATE Decoder& operator>>(Optional<uint32_t>&);
+    WTF_EXPORT_PRIVATE Decoder& operator>>(Optional<uint64_t>&);
+    WTF_EXPORT_PRIVATE Decoder& operator>>(Optional<int16_t>&);
+    WTF_EXPORT_PRIVATE Decoder& operator>>(Optional<int32_t>&);
+    WTF_EXPORT_PRIVATE Decoder& operator>>(Optional<int64_t>&);
+    WTF_EXPORT_PRIVATE Decoder& operator>>(Optional<float>&);
+    WTF_EXPORT_PRIVATE Decoder& operator>>(Optional<double>&);
</ins><span class="cx"> 
</span><del>-    template<typename E> WARN_UNUSED_RETURN
-    auto decode(E& e) -> std::enable_if_t<std::is_enum<E>::value, bool>
</del><ins>+    template<typename T, std::enable_if_t<!std::is_arithmetic<typename std::remove_const<T>>::value && !std::is_enum<T>::value>* = nullptr>
+    Decoder& operator>>(Optional<T>& result)
</ins><span class="cx">     {
</span><del>-        uint64_t value;
-        if (!decode(value))
-            return false;
-        if (!isValidEnum<E>(value))
-            return false;
-
-        e = static_cast<E>(value);
-        return true;
</del><ins>+        result = Coder<T>::decode(*this);
+        return *this;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    template<typename T> WARN_UNUSED_RETURN
-    bool decodeEnum(T& result)
</del><ins>+    template<typename E, std::enable_if_t<std::is_enum<E>::value>* = nullptr>
+    Decoder& operator>>(Optional<E>& result)
</ins><span class="cx">     {
</span><del>-        static_assert(sizeof(T) <= 8, "Enum type T must not be larger than 64 bits!");
-
-        uint64_t value;
-        if (!decode(value))
-            return false;
-        
-        result = static_cast<T>(value);
-        return true;
</del><ins>+        static_assert(sizeof(E) <= 8, "Enum type T must not be larger than 64 bits!");
+        Optional<uint64_t> value;
+        *this >> value;
+        if (!value)
+            return *this;
+        if (!isValidEnum<E>(*value))
+            return *this;
+        result = static_cast<E>(*value);
+        return *this;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     template<typename T> WARN_UNUSED_RETURN
</span><del>-    auto decode(T& t) -> std::enable_if_t<!std::is_enum<T>::value, bool>
-    {
-        return Coder<T>::decode(*this, t);
-    }
-
-    template<typename T> WARN_UNUSED_RETURN
</del><span class="cx">     bool bufferIsLargeEnoughToContain(size_t numElements) const
</span><span class="cx">     {
</span><span class="cx">         static_assert(std::is_arithmetic<T>::value, "Type T must have a fixed, known encoded size!");
</span><span class="lines">@@ -103,7 +92,7 @@
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     WTF_EXPORT_PRIVATE bool bufferIsLargeEnoughToContain(size_t) const WARN_UNUSED_RETURN;
</span><del>-    template<typename Type> bool decodeNumber(Type&) WARN_UNUSED_RETURN;
</del><ins>+    template<typename Type> Decoder& decodeNumber(Optional<Type>&) WARN_UNUSED_RETURN;
</ins><span class="cx"> 
</span><span class="cx">     const uint8_t* m_buffer;
</span><span class="cx">     const uint8_t* m_bufferPosition;
</span></span></pre></div>
<a id="trunkSourceWTFwtfpersistencePersistentEncodercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/persistence/PersistentEncoder.cpp (259921 => 259922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/persistence/PersistentEncoder.cpp   2020-04-11 05:17:24 UTC (rev 259921)
+++ trunk/Source/WTF/wtf/persistence/PersistentEncoder.cpp      2020-04-11 06:39:36 UTC (rev 259922)
</span><span class="lines">@@ -62,62 +62,63 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> template<typename Type>
</span><del>-void Encoder::encodeNumber(Type value)
</del><ins>+Encoder& Encoder::encodeNumber(Type value)
</ins><span class="cx"> {
</span><span class="cx">     Encoder::updateChecksumForNumber(m_sha1, value);
</span><span class="cx"> 
</span><span class="cx">     uint8_t* buffer = grow(sizeof(Type));
</span><span class="cx">     memcpy(buffer, &value, sizeof(Type));
</span><ins>+    return *this;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void Encoder::encode(bool value)
</del><ins>+Encoder& Encoder::operator<<(bool value)
</ins><span class="cx"> {
</span><del>-    encodeNumber(value);
</del><ins>+    return encodeNumber(value);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void Encoder::encode(uint8_t value)
</del><ins>+Encoder& Encoder::operator<<(uint8_t value)
</ins><span class="cx"> {
</span><del>-    encodeNumber(value);
</del><ins>+    return encodeNumber(value);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void Encoder::encode(uint16_t value)
</del><ins>+Encoder& Encoder::operator<<(uint16_t value)
</ins><span class="cx"> {
</span><del>-    encodeNumber(value);
</del><ins>+    return encodeNumber(value);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void Encoder::encode(int16_t value)
</del><ins>+Encoder& Encoder::operator<<(int16_t value)
</ins><span class="cx"> {
</span><del>-    encodeNumber(value);
</del><ins>+    return encodeNumber(value);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void Encoder::encode(uint32_t value)
</del><ins>+Encoder& Encoder::operator<<(uint32_t value)
</ins><span class="cx"> {
</span><del>-    encodeNumber(value);
</del><ins>+    return encodeNumber(value);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void Encoder::encode(uint64_t value)
</del><ins>+Encoder& Encoder::operator<<(uint64_t value)
</ins><span class="cx"> {
</span><del>-    encodeNumber(value);
</del><ins>+    return encodeNumber(value);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void Encoder::encode(int32_t value)
</del><ins>+Encoder& Encoder::operator<<(int32_t value)
</ins><span class="cx"> {
</span><del>-    encodeNumber(value);
</del><ins>+    return encodeNumber(value);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void Encoder::encode(int64_t value)
</del><ins>+Encoder& Encoder::operator<<(int64_t value)
</ins><span class="cx"> {
</span><del>-    encodeNumber(value);
</del><ins>+    return encodeNumber(value);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void Encoder::encode(float value)
</del><ins>+Encoder& Encoder::operator<<(float value)
</ins><span class="cx"> {
</span><del>-    encodeNumber(value);
</del><ins>+    return encodeNumber(value);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void Encoder::encode(double value)
</del><ins>+Encoder& Encoder::operator<<(double value)
</ins><span class="cx"> {
</span><del>-    encodeNumber(value);
</del><ins>+    return encodeNumber(value);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void Encoder::encodeChecksum()
</span></span></pre></div>
<a id="trunkSourceWTFwtfpersistencePersistentEncoderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/persistence/PersistentEncoder.h (259921 => 259922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/persistence/PersistentEncoder.h     2020-04-11 05:17:24 UTC (rev 259921)
+++ trunk/Source/WTF/wtf/persistence/PersistentEncoder.h        2020-04-11 06:39:36 UTC (rev 259922)
</span><span class="lines">@@ -45,32 +45,31 @@
</span><span class="cx">     WTF_EXPORT_PRIVATE void encodeChecksum();
</span><span class="cx">     WTF_EXPORT_PRIVATE void encodeFixedLengthData(const uint8_t*, size_t);
</span><span class="cx"> 
</span><del>-    template<typename E> auto encode(E value) -> std::enable_if_t<std::is_enum<E>::value>
</del><ins>+    template<typename T, std::enable_if_t<std::is_enum<T>::value>* = nullptr>
+    Encoder& operator<<(const T& t)
</ins><span class="cx">     {
</span><del>-        static_assert(sizeof(E) <= sizeof(uint64_t), "Enum type must not be larger than 64 bits.");
-
-        ASSERT(isValidEnum<E>(static_cast<uint64_t>(value)));
-        encode(static_cast<uint64_t>(value));
</del><ins>+        static_assert(sizeof(T) <= sizeof(uint64_t), "Enum type must not be larger than 64 bits.");
+        return *this << static_cast<uint64_t>(t);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    template<typename T> void encodeEnum(T t)
</del><ins>+    template<typename T, std::enable_if_t<!std::is_enum<T>::value && !std::is_arithmetic<typename std::remove_const<T>>::value>* = nullptr>
+    Encoder& operator<<(const T& t)
</ins><span class="cx">     {
</span><del>-        COMPILE_ASSERT(sizeof(T) <= sizeof(uint64_t), enum_type_must_not_be_larger_than_64_bits);
-
-        encode(static_cast<uint64_t>(t));
-    }
-
-    template<typename T> auto encode(const T& t) -> std::enable_if_t<!std::is_enum<T>::value>
-    {
</del><span class="cx">         Coder<T>::encode(*this, t);
</span><del>-    }
-
-    template<typename T> Encoder& operator<<(const T& t)
-    {
-        encode(t);
</del><span class="cx">         return *this;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    WTF_EXPORT_PRIVATE Encoder& operator<<(bool);
+    WTF_EXPORT_PRIVATE Encoder& operator<<(uint8_t);
+    WTF_EXPORT_PRIVATE Encoder& operator<<(uint16_t);
+    WTF_EXPORT_PRIVATE Encoder& operator<<(uint32_t);
+    WTF_EXPORT_PRIVATE Encoder& operator<<(uint64_t);
+    WTF_EXPORT_PRIVATE Encoder& operator<<(int16_t);
+    WTF_EXPORT_PRIVATE Encoder& operator<<(int32_t);
+    WTF_EXPORT_PRIVATE Encoder& operator<<(int64_t);
+    WTF_EXPORT_PRIVATE Encoder& operator<<(float);
+    WTF_EXPORT_PRIVATE Encoder& operator<<(double);
+
</ins><span class="cx">     const uint8_t* buffer() const { return m_buffer.data(); }
</span><span class="cx">     size_t bufferSize() const { return m_buffer.size(); }
</span><span class="cx"> 
</span><span class="lines">@@ -80,18 +79,8 @@
</span><span class="cx">     static constexpr bool isIPCEncoder = false;
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    WTF_EXPORT_PRIVATE void encode(bool);
-    WTF_EXPORT_PRIVATE void encode(uint8_t);
-    WTF_EXPORT_PRIVATE void encode(uint16_t);
-    WTF_EXPORT_PRIVATE void encode(uint32_t);
-    WTF_EXPORT_PRIVATE void encode(uint64_t);
-    WTF_EXPORT_PRIVATE void encode(int16_t);
-    WTF_EXPORT_PRIVATE void encode(int32_t);
-    WTF_EXPORT_PRIVATE void encode(int64_t);
-    WTF_EXPORT_PRIVATE void encode(float);
-    WTF_EXPORT_PRIVATE void encode(double);
</del><span class="cx"> 
</span><del>-    template<typename Type> void encodeNumber(Type);
</del><ins>+    template<typename Type> Encoder& encodeNumber(Type);
</ins><span class="cx"> 
</span><span class="cx">     uint8_t* grow(size_t);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (259921 => 259922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog   2020-04-11 05:17:24 UTC (rev 259921)
+++ trunk/Source/WebCore/ChangeLog      2020-04-11 06:39:36 UTC (rev 259922)
</span><span class="lines">@@ -1,3 +1,33 @@
</span><ins>+2020-04-10  Alex Christensen  <achristensen@webkit.org>
+
+        PersistentCoders should use modern decoding syntax
+        https://bugs.webkit.org/show_bug.cgi?id=207497
+
+        Reviewed by Darin Adler.
+
+        * inspector/InspectorFrontendHost.cpp:
+        (WebCore::InspectorFrontendHost::showCertificate):
+        * loader/FetchOptions.h:
+        (WebCore::FetchOptions::decodePersistent):
+        * page/csp/ContentSecurityPolicyResponseHeaders.h:
+        (WebCore::ContentSecurityPolicyResponseHeaders::encode const):
+        (WebCore::ContentSecurityPolicyResponseHeaders::decode):
+        * platform/PasteboardCustomData.cpp:
+        (WebCore::PasteboardCustomData::fromSharedBuffer):
+        * platform/network/ResourceLoadPriority.h:
+        * platform/network/ResourceRequestBase.h:
+        (WebCore::ResourceRequestBase::encodeBase const):
+        (WebCore::ResourceRequestBase::decodeBase):
+        * platform/network/cf/CertificateInfo.h:
+        (WTF::Persistence::decodeCFData):
+        (WTF::Persistence::decodeSecTrustRef):
+        (WTF::Persistence::decodeCertificateChain):
+        (WTF::Persistence::Coder<WebCore::CertificateInfo>::encode):
+        (WTF::Persistence::Coder<WebCore::CertificateInfo>::decode):
+        * workers/service/server/RegistrationDatabase.cpp:
+        (WebCore::RegistrationDatabase::doPushChanges):
+        (WebCore::RegistrationDatabase::importRecords):
+
</ins><span class="cx"> 2020-04-10  Simon Fraser  <simon.fraser@apple.com>
</span><span class="cx"> 
</span><span class="cx">         [macOS] Fix scrollbar display for async-scrolling overflow
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorFrontendHostcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorFrontendHost.cpp (259921 => 259922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorFrontendHost.cpp 2020-04-11 05:17:24 UTC (rev 259921)
+++ trunk/Source/WebCore/inspector/InspectorFrontendHost.cpp    2020-04-11 06:39:36 UTC (rev 259922)
</span><span class="lines">@@ -60,6 +60,7 @@
</span><span class="cx"> #include <pal/system/Sound.h>
</span><span class="cx"> #include <wtf/JSONValues.h>
</span><span class="cx"> #include <wtf/StdLibExtras.h>
</span><ins>+#include <wtf/persistence/PersistentDecoder.h>
</ins><span class="cx"> #include <wtf/text/Base64.h>
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -574,15 +575,16 @@
</span><span class="cx">     if (!base64Decode(serializedCertificate, data))
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-    CertificateInfo certificateInfo;
</del><span class="cx">     WTF::Persistence::Decoder decoder(data.data(), data.size());
</span><del>-    if (!decoder.decode(certificateInfo))
</del><ins>+    Optional<CertificateInfo> certificateInfo;
+    decoder >> certificateInfo;
+    if (!certificateInfo)
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-    if (certificateInfo.isEmpty())
</del><ins>+    if (certificateInfo->isEmpty())
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-    m_client->showCertificate(certificateInfo);
</del><ins>+    m_client->showCertificate(*certificateInfo);
</ins><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectoragentsInspectorNetworkAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp (259921 => 259922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp  2020-04-11 05:17:24 UTC (rev 259921)
+++ trunk/Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp     2020-04-11 06:39:36 UTC (rev 259922)
</span><span class="lines">@@ -969,7 +969,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     WTF::Persistence::Encoder encoder;
</span><del>-    encoder << certificate.value();
</del><ins>+    WTF::Persistence::Coder<WebCore::CertificateInfo>::encode(encoder, certificate.value());
</ins><span class="cx">     *serializedCertificate = base64Encode(encoder.buffer(), encoder.bufferSize());
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderFetchOptionsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/FetchOptions.h (259921 => 259922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/FetchOptions.h       2020-04-11 05:17:24 UTC (rev 259921)
+++ trunk/Source/WebCore/loader/FetchOptions.h  2020-04-11 06:39:36 UTC (rev 259922)
</span><span class="lines">@@ -167,7 +167,8 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-template<class Encoder> inline void FetchOptions::encodePersistent(Encoder& encoder) const
</del><ins>+template<class Encoder>
+inline void FetchOptions::encodePersistent(Encoder& encoder) const
</ins><span class="cx"> {
</span><span class="cx">     // Changes to encoding here should bump NetworkCache Storage format version.
</span><span class="cx">     encoder << destination;
</span><span class="lines">@@ -180,59 +181,70 @@
</span><span class="cx">     encoder << keepAlive;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-template<class Decoder> inline bool FetchOptions::decodePersistent(Decoder& decoder, FetchOptions& options)
</del><ins>+template<class Decoder>
+inline WARN_UNUSED_RETURN bool FetchOptions::decodePersistent(Decoder& decoder, FetchOptions& options)
</ins><span class="cx"> {
</span><del>-    FetchOptions::Destination destination;
-    if (!decoder.decode(destination))
</del><ins>+    Optional<FetchOptions::Destination> destination;
+    decoder >> destination;
+    if (!destination)
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-    FetchOptions::Mode mode;
-    if (!decoder.decode(mode))
</del><ins>+    Optional<FetchOptions::Mode> mode;
+    decoder >> mode;
+    if (!mode)
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-    FetchOptions::Credentials credentials;
-    if (!decoder.decode(credentials))
</del><ins>+    Optional<FetchOptions::Credentials> credentials;
+    decoder >> credentials;
+    if (!credentials)
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-    FetchOptions::Cache cache;
-    if (!decoder.decode(cache))
</del><ins>+    Optional<FetchOptions::Cache> cache;
+    decoder >> cache;
+    if (!cache)
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-    FetchOptions::Redirect redirect;
-    if (!decoder.decode(redirect))
</del><ins>+    Optional<FetchOptions::Redirect> redirect;
+    decoder >> redirect;
+    if (!redirect)
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-    ReferrerPolicy referrerPolicy;
-    if (!decoder.decode(referrerPolicy))
</del><ins>+    Optional<ReferrerPolicy> referrerPolicy;
+    decoder >> referrerPolicy;
+    if (!referrerPolicy)
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-    String integrity;
-    if (!decoder.decode(integrity))
</del><ins>+    Optional<String> integrity;
+    decoder >> integrity;
+    if (!integrity)
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-    bool keepAlive;
-    if (!decoder.decode(keepAlive))
</del><ins>+    Optional<bool> keepAlive;
+    decoder >> keepAlive;
+    if (!keepAlive)
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-    options.destination = destination;
-    options.mode = mode;
-    options.credentials = credentials;
-    options.cache = cache;
-    options.redirect = redirect;
-    options.referrerPolicy = referrerPolicy;
-    options.integrity = WTFMove(integrity);
-    options.keepAlive = keepAlive;
</del><ins>+    options.destination = *destination;
+    options.mode = *mode;
+    options.credentials = *credentials;
+    options.cache = *cache;
+    options.redirect = *redirect;
+    options.referrerPolicy = *referrerPolicy;
+    options.integrity = WTFMove(*integrity);
+    options.keepAlive = *keepAlive;
</ins><span class="cx"> 
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-template<class Encoder> inline void FetchOptions::encode(Encoder& encoder) const
</del><ins>+template<class Encoder>
+inline void FetchOptions::encode(Encoder& encoder) const
</ins><span class="cx"> {
</span><span class="cx">     encodePersistent(encoder);
</span><span class="cx">     encoder << clientIdentifier.asOptional();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-template<class Decoder> inline Optional<FetchOptions> FetchOptions::decode(Decoder& decoder)
</del><ins>+template<class Decoder>
+inline Optional<FetchOptions> FetchOptions::decode(Decoder& decoder)
</ins><span class="cx"> {
</span><span class="cx">     FetchOptions options;
</span><span class="cx">     if (!decodePersistent(decoder, options))
</span></span></pre></div>
<a id="trunkSourceWebCorepageSecurityOriginDatah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/SecurityOriginData.h (259921 => 259922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/SecurityOriginData.h   2020-04-11 05:17:24 UTC (rev 259921)
+++ trunk/Source/WebCore/page/SecurityOriginData.h      2020-04-11 06:39:36 UTC (rev 259922)
</span><span class="lines">@@ -115,11 +115,12 @@
</span><span class="cx">     if (!host)
</span><span class="cx">         return WTF::nullopt;
</span><span class="cx">     
</span><del>-    Optional<uint16_t> port;
-    if (!decoder.decode(port))
</del><ins>+    Optional<Optional<uint16_t>> port;
+    decoder >> port;
+    if (!port)
</ins><span class="cx">         return WTF::nullopt;
</span><span class="cx">     
</span><del>-    SecurityOriginData data { WTFMove(*protocol), WTFMove(*host), WTFMove(port) };
</del><ins>+    SecurityOriginData data { WTFMove(*protocol), WTFMove(*host), WTFMove(*port) };
</ins><span class="cx">     if (data.isHashTableDeletedValue())
</span><span class="cx">         return WTF::nullopt;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorepagecspContentSecurityPolicyResponseHeadersh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/csp/ContentSecurityPolicyResponseHeaders.h (259921 => 259922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/csp/ContentSecurityPolicyResponseHeaders.h     2020-04-11 05:17:24 UTC (rev 259921)
+++ trunk/Source/WebCore/page/csp/ContentSecurityPolicyResponseHeaders.h        2020-04-11 06:39:36 UTC (rev 259922)
</span><span class="lines">@@ -33,7 +33,7 @@
</span><span class="cx"> class ContentSecurityPolicy;
</span><span class="cx"> class ResourceResponse;
</span><span class="cx"> 
</span><del>-enum class ContentSecurityPolicyHeaderType {
</del><ins>+enum class ContentSecurityPolicyHeaderType : bool {
</ins><span class="cx">     Report,
</span><span class="cx">     Enforce,
</span><span class="cx"> };
</span><span class="lines">@@ -46,7 +46,7 @@
</span><span class="cx">     ContentSecurityPolicyResponseHeaders isolatedCopy() const;
</span><span class="cx"> 
</span><span class="cx">     template <class Encoder> void encode(Encoder&) const;
</span><del>-    template <class Decoder> static bool decode(Decoder&, ContentSecurityPolicyResponseHeaders&);
</del><ins>+    template <class Decoder> static Optional<ContentSecurityPolicyResponseHeaders> decode(Decoder&);
</ins><span class="cx"> 
</span><span class="cx">     enum EmptyTag { Empty };
</span><span class="cx">     struct MarkableTraits {
</span><span class="lines">@@ -78,32 +78,40 @@
</span><span class="cx">     encoder << static_cast<uint64_t>(m_headers.size());
</span><span class="cx">     for (auto& pair : m_headers) {
</span><span class="cx">         encoder << pair.first;
</span><del>-        encoder.encodeEnum(pair.second);
</del><ins>+        encoder << pair.second;
</ins><span class="cx">     }
</span><span class="cx">     encoder << m_httpStatusCode;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> template <class Decoder>
</span><del>-bool ContentSecurityPolicyResponseHeaders::decode(Decoder& decoder, ContentSecurityPolicyResponseHeaders& headers)
</del><ins>+Optional<ContentSecurityPolicyResponseHeaders> ContentSecurityPolicyResponseHeaders::decode(Decoder& decoder)
</ins><span class="cx"> {
</span><del>-    uint64_t headersSize;
-    if (!decoder.decode(headersSize))
-        return false;
-    for (size_t i = 0; i < headersSize; ++i) {
-        String header;
-        if (!decoder.decode(header))
-            return false;
-        ContentSecurityPolicyHeaderType headerType;
-        if (!decoder.decodeEnum(headerType))
-            return false;
-        headers.m_headers.append(std::make_pair(header, headerType));
</del><ins>+    ContentSecurityPolicyResponseHeaders headers;
+
+    Optional<uint64_t> headersSize;
+    decoder >> headersSize;
+    if (!headersSize)
+        return WTF::nullopt;
+    for (size_t i = 0; i < *headersSize; ++i) {
+        Optional<String> header;
+        decoder >> header;
+        if (!header)
+            return WTF::nullopt;
+        Optional<ContentSecurityPolicyHeaderType> headerType;
+        decoder >> headerType;
+        if (!headerType)
+            return WTF::nullopt;
+        headers.m_headers.append(std::make_pair(WTFMove(*header), WTFMove(*headerType)));
</ins><span class="cx">     }
</span><span class="cx">     headers.m_headers.shrinkToFit();
</span><span class="cx"> 
</span><del>-    if (!decoder.decode(headers.m_httpStatusCode))
-        return false;
</del><ins>+    Optional<int> httpStatusCode;
+    decoder >> httpStatusCode;
+    if (!httpStatusCode)
+        return WTF::nullopt;
+    headers.m_httpStatusCode = *httpStatusCode;
</ins><span class="cx"> 
</span><del>-    return true;
</del><ins>+    return WTFMove(headers);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformPasteboardCustomDatacpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/PasteboardCustomData.cpp (259921 => 259922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/PasteboardCustomData.cpp   2020-04-11 05:17:24 UTC (rev 259921)
+++ trunk/Source/WebCore/platform/PasteboardCustomData.cpp      2020-04-11 06:39:36 UTC (rev 259922)
</span><span class="lines">@@ -98,23 +98,29 @@
</span><span class="cx"> 
</span><span class="cx">     PasteboardCustomData result;
</span><span class="cx">     auto decoder = buffer.decoder();
</span><del>-    unsigned version;
-    if (!decoder.decode(version) || version > maxSupportedDataSerializationVersionNumber)
</del><ins>+    Optional<unsigned> version;
+    decoder >> version;
+    if (!version || *version > maxSupportedDataSerializationVersionNumber)
</ins><span class="cx">         return { };
</span><span class="cx"> 
</span><del>-    if (!decoder.decode(result.m_origin))
</del><ins>+    Optional<String> origin;
+    decoder >> origin;
+    if (!origin)
</ins><span class="cx">         return { };
</span><ins>+    result.m_origin = WTFMove(*origin);
</ins><span class="cx"> 
</span><del>-    HashMap<String, String> sameOriginCustomStringData;
-    if (!decoder.decode(sameOriginCustomStringData))
</del><ins>+    Optional<HashMap<String, String>> sameOriginCustomStringData;
+    decoder >> sameOriginCustomStringData;
+    if (!sameOriginCustomStringData)
</ins><span class="cx">         return { };
</span><span class="cx"> 
</span><del>-    Vector<String> orderedTypes;
-    if (!decoder.decode(orderedTypes))
</del><ins>+    Optional<Vector<String>> orderedTypes;
+    decoder >> orderedTypes;
+    if (!orderedTypes)
</ins><span class="cx">         return { };
</span><span class="cx"> 
</span><del>-    for (auto& type : orderedTypes)
-        result.writeStringInCustomData(type, sameOriginCustomStringData.get(type));
</del><ins>+    for (auto& type : *orderedTypes)
+        result.writeStringInCustomData(type, sameOriginCustomStringData->get(type));
</ins><span class="cx"> 
</span><span class="cx">     return result;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgenericKeyedDecoderGenericcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/generic/KeyedDecoderGeneric.cpp (259921 => 259922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/generic/KeyedDecoderGeneric.cpp    2020-04-11 05:17:24 UTC (rev 259921)
+++ trunk/Source/WebCore/platform/generic/KeyedDecoderGeneric.cpp       2020-04-11 06:39:36 UTC (rev 259922)
</span><span class="lines">@@ -48,40 +48,36 @@
</span><span class="cx">     HashMap<String, std::unique_ptr<Node>> m_map;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-static bool readString(WTF::Persistence::Decoder& decoder, String& result)
</del><ins>+static Optional<String> readString(WTF::Persistence::Decoder& decoder)
</ins><span class="cx"> {
</span><del>-    size_t size;
-    if (!decoder.decode(size))
-        return false;
-    if (!size) {
-        result = emptyString();
-        return true;
-    }
</del><ins>+    Optional<size_t> size;
+    decoder >> size;
+    if (!size)
+        return WTF::nullopt;
+    if (!size.value())
+        return emptyString();
</ins><span class="cx"> 
</span><del>-    if (!decoder.bufferIsLargeEnoughToContain<uint8_t>(size))
-        return false;
-    Vector<uint8_t> buffer(size);
-    if (!decoder.decodeFixedLengthData(buffer.data(), size))
-        return false;
-    result = String::fromUTF8(buffer.data(), size);
</del><ins>+    Vector<uint8_t> buffer(size.value());
+    if (!decoder.decodeFixedLengthData(buffer.data(), size.value()))
+        return WTF::nullopt;
+    auto result = String::fromUTF8(buffer.data(), size.value());
</ins><span class="cx">     if (result.isNull())
</span><del>-        return false;
</del><ins>+        return WTF::nullopt;
</ins><span class="cx"> 
</span><del>-    return true;
</del><ins>+    return result;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> template<typename T>
</span><span class="cx"> static bool readSimpleValue(WTF::Persistence::Decoder& decoder, KeyedDecoderGeneric::Dictionary& dictionary)
</span><span class="cx"> {
</span><del>-    String key;
-    bool ok = readString(decoder, key);
-    if (!ok)
</del><ins>+    auto key = readString(decoder);
+    if (!key)
</ins><span class="cx">         return false;
</span><del>-    T value;
-    ok = decoder.decode(value);
-    if (!ok)
</del><ins>+    Optional<T> value;
+    decoder >> value;
+    if (!value)
</ins><span class="cx">         return false;
</span><del>-    dictionary.add(key, WTFMove(value));
</del><ins>+    dictionary.add(key.value(), WTFMove(value.value()));
</ins><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -93,31 +89,38 @@
</span><span class="cx"> KeyedDecoderGeneric::KeyedDecoderGeneric(const uint8_t* data, size_t size)
</span><span class="cx"> {
</span><span class="cx">     WTF::Persistence::Decoder decoder(data, size);
</span><del>-    KeyedEncoderGeneric::Type type;
-    String key;
</del><span class="cx"> 
</span><span class="cx">     m_rootDictionary = makeUnique<Dictionary>();
</span><span class="cx">     m_dictionaryStack.append(m_rootDictionary.get());
</span><span class="cx"> 
</span><span class="cx">     bool ok = true;
</span><del>-    while (ok && decoder.decodeEnum(type)) {
-        switch (type) {
</del><ins>+    while (ok) {
+        Optional<KeyedEncoderGeneric::Type> type;
+        decoder >> type;
+        if (!type)
+            break;
+
+        switch (*type) {
</ins><span class="cx">         case KeyedEncoderGeneric::Type::Bytes: {
</span><del>-            ok = readString(decoder, key);
</del><ins>+            auto key = readString(decoder);
+            if (!key)
+                ok = false;
</ins><span class="cx">             if (!ok)
</span><span class="cx">                 break;
</span><del>-            size_t size;
-            ok = decoder.decode(size);
</del><ins>+            Optional<size_t> size;
+            decoder >> size;
+            if (!size)
+                ok = false;
</ins><span class="cx">             if (!ok)
</span><span class="cx">                 break;
</span><del>-            ok = decoder.bufferIsLargeEnoughToContain<uint8_t>(size);
</del><ins>+            ok = decoder.bufferIsLargeEnoughToContain<uint8_t>(*size);
</ins><span class="cx">             if (!ok)
</span><span class="cx">                 break;
</span><del>-            Vector<uint8_t> buffer(size);
-            ok = decoder.decodeFixedLengthData(buffer.data(), size);
</del><ins>+            Vector<uint8_t> buffer(*size);
+            ok = decoder.decodeFixedLengthData(buffer.data(), *size);
</ins><span class="cx">             if (!ok)
</span><span class="cx">                 break;
</span><del>-            m_dictionaryStack.last()->add(key, WTFMove(buffer));
</del><ins>+            m_dictionaryStack.last()->add(*key, WTFMove(buffer));
</ins><span class="cx">             break;
</span><span class="cx">         }
</span><span class="cx">         case KeyedEncoderGeneric::Type::Bool:
</span><span class="lines">@@ -142,24 +145,29 @@
</span><span class="cx">             ok = readSimpleValue<double>(decoder, *m_dictionaryStack.last());
</span><span class="cx">             break;
</span><span class="cx">         case KeyedEncoderGeneric::Type::String: {
</span><del>-            ok = readString(decoder, key);
</del><ins>+            auto key = readString(decoder);
+            if (!key)
+                ok = false;
</ins><span class="cx">             if (!ok)
</span><span class="cx">                 break;
</span><del>-            String value;
-            ok = readString(decoder, value);
</del><ins>+            auto value = readString(decoder);
+            if (!value)
+                ok = false;
</ins><span class="cx">             if (!ok)
</span><span class="cx">                 break;
</span><del>-            m_dictionaryStack.last()->add(key, WTFMove(value));
</del><ins>+            m_dictionaryStack.last()->add(*key, WTFMove(*value));
</ins><span class="cx">             break;
</span><span class="cx">         }
</span><span class="cx">         case KeyedEncoderGeneric::Type::BeginObject: {
</span><del>-            ok = readString(decoder, key);
</del><ins>+            auto key = readString(decoder);
+            if (!key)
+                ok = false;
</ins><span class="cx">             if (!ok)
</span><span class="cx">                 break;
</span><span class="cx">             auto* currentDictinary = m_dictionaryStack.last();
</span><span class="cx">             auto newDictionary = makeUnique<Dictionary>();
</span><span class="cx">             m_dictionaryStack.append(newDictionary.get());
</span><del>-            currentDictinary->add(key, WTFMove(newDictionary));
</del><ins>+            currentDictinary->add(*key, WTFMove(newDictionary));
</ins><span class="cx">             break;
</span><span class="cx">         }
</span><span class="cx">         case KeyedEncoderGeneric::Type::EndObject:
</span><span class="lines">@@ -168,12 +176,14 @@
</span><span class="cx">                 ok = false;
</span><span class="cx">             break;
</span><span class="cx">         case KeyedEncoderGeneric::Type::BeginArray: {
</span><del>-            ok = readString(decoder, key);
</del><ins>+            auto key = readString(decoder);
+            if (!key)
+                ok = false;
</ins><span class="cx">             if (!ok)
</span><span class="cx">                 break;
</span><span class="cx">             auto newArray = makeUnique<Array>();
</span><span class="cx">             m_arrayStack.append(newArray.get());
</span><del>-            m_dictionaryStack.last()->add(key, WTFMove(newArray));
</del><ins>+            m_dictionaryStack.last()->add(*key, WTFMove(newArray));
</ins><span class="cx">             break;
</span><span class="cx">         }
</span><span class="cx">         case KeyedEncoderGeneric::Type::BeginArrayElement: {
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkNetworkLoadMetricsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/NetworkLoadMetrics.h (259921 => 259922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/NetworkLoadMetrics.h       2020-04-11 05:17:24 UTC (rev 259921)
+++ trunk/Source/WebCore/platform/network/NetworkLoadMetrics.h  2020-04-11 06:39:36 UTC (rev 259922)
</span><span class="lines">@@ -30,8 +30,7 @@
</span><span class="cx"> #include <wtf/Box.h>
</span><span class="cx"> #include <wtf/Optional.h>
</span><span class="cx"> #include <wtf/Seconds.h>
</span><del>-#include <wtf/persistence/PersistentDecoder.h>
-#include <wtf/persistence/PersistentEncoder.h>
</del><ins>+#include <wtf/persistence/PersistentCoder.h>
</ins><span class="cx"> #include <wtf/text/WTFString.h>
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(COCOA)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkResourceLoadPriorityh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/ResourceLoadPriority.h (259921 => 259922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/ResourceLoadPriority.h     2020-04-11 05:17:24 UTC (rev 259921)
+++ trunk/Source/WebCore/platform/network/ResourceLoadPriority.h        2020-04-11 06:39:36 UTC (rev 259922)
</span><span class="lines">@@ -23,9 +23,10 @@
</span><span class="cx">  * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx">  */
</span><span class="cx"> 
</span><del>-#ifndef ResourceLoadPriority_h
-#define ResourceLoadPriority_h
</del><ins>+#pragma once
</ins><span class="cx"> 
</span><ins>+#include <wtf/EnumTraits.h>
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> enum class ResourceLoadPriority : uint8_t {
</span><span class="lines">@@ -54,7 +55,19 @@
</span><span class="cx">     return priority = static_cast<ResourceLoadPriority>(static_cast<int>(priority) - 1);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-}
</del><ins>+} // namespace WebCore
</ins><span class="cx"> 
</span><del>-#endif
</del><ins>+namespace WTF {
</ins><span class="cx"> 
</span><ins>+template<> struct EnumTraits<WebCore::ResourceLoadPriority> {
+    using values = EnumValues<
+        WebCore::ResourceLoadPriority,
+        WebCore::ResourceLoadPriority::VeryLow,
+        WebCore::ResourceLoadPriority::Low,
+        WebCore::ResourceLoadPriority::Medium,
+        WebCore::ResourceLoadPriority::High,
+        WebCore::ResourceLoadPriority::VeryHigh
+    >;
+};
+
+} // namespace WTF
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkResourceRequestBaseh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/ResourceRequestBase.h (259921 => 259922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/ResourceRequestBase.h      2020-04-11 05:17:24 UTC (rev 259921)
+++ trunk/Source/WebCore/platform/network/ResourceRequestBase.h 2020-04-11 06:39:36 UTC (rev 259922)
</span><span class="lines">@@ -25,8 +25,7 @@
</span><span class="cx">  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx">  */
</span><span class="cx"> 
</span><del>-#ifndef ResourceRequestBase_h
-#define ResourceRequestBase_h
</del><ins>+#pragma once
</ins><span class="cx"> 
</span><span class="cx"> #include "FormData.h"
</span><span class="cx"> #include "FrameLoaderTypes.h"
</span><span class="lines">@@ -33,6 +32,7 @@
</span><span class="cx"> #include "HTTPHeaderMap.h"
</span><span class="cx"> #include "IntRect.h"
</span><span class="cx"> #include "ResourceLoadPriority.h"
</span><ins>+#include <wtf/EnumTraits.h>
</ins><span class="cx"> #include <wtf/URL.h>
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -283,64 +283,88 @@
</span><span class="cx">     encoder << m_httpMethod;
</span><span class="cx">     encoder << m_httpHeaderFields;
</span><span class="cx">     encoder << m_responseContentDispositionEncodingFallbackArray;
</span><del>-    encoder.encodeEnum(m_cachePolicy);
</del><ins>+    encoder << m_cachePolicy;
</ins><span class="cx">     encoder << m_allowCookies;
</span><del>-    encoder.encodeEnum(m_sameSiteDisposition);
</del><ins>+    encoder << m_sameSiteDisposition;
</ins><span class="cx">     encoder << m_isTopSite;
</span><del>-    encoder.encodeEnum(m_priority);
-    encoder.encodeEnum(m_requester);
</del><ins>+    encoder << m_priority;
+    encoder << m_requester;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> template<class Decoder>
</span><span class="cx"> ALWAYS_INLINE bool ResourceRequestBase::decodeBase(Decoder& decoder)
</span><span class="cx"> {
</span><del>-    if (!decoder.decode(m_url))
</del><ins>+    Optional<URL> url;
+    decoder >> url;
+    if (!url)
</ins><span class="cx">         return false;
</span><ins>+    m_url = WTFMove(*url);
</ins><span class="cx"> 
</span><del>-    if (!decoder.decode(m_timeoutInterval))
</del><ins>+    Optional<double> timeoutInterval;
+    decoder >> timeoutInterval;
+    if (!timeoutInterval)
</ins><span class="cx">         return false;
</span><ins>+    m_timeoutInterval = WTFMove(*timeoutInterval);
</ins><span class="cx"> 
</span><del>-    String firstPartyForCookies;
-    if (!decoder.decode(firstPartyForCookies))
</del><ins>+    Optional<String> firstPartyForCookies;
+    decoder >> firstPartyForCookies;
+    if (!firstPartyForCookies)
</ins><span class="cx">         return false;
</span><del>-    m_firstPartyForCookies = URL({ }, firstPartyForCookies);
</del><ins>+    m_firstPartyForCookies = URL({ }, *firstPartyForCookies);
</ins><span class="cx"> 
</span><del>-    if (!decoder.decode(m_httpMethod))
</del><ins>+    Optional<String> httpMethod;
+    decoder >> httpMethod;
+    if (!httpMethod)
</ins><span class="cx">         return false;
</span><ins>+    m_httpMethod = WTFMove(*httpMethod);
</ins><span class="cx"> 
</span><del>-    if (!decoder.decode(m_httpHeaderFields))
</del><ins>+    Optional<HTTPHeaderMap> fields;
+    decoder >> fields;
+    if (!fields)
</ins><span class="cx">         return false;
</span><ins>+    m_httpHeaderFields = WTFMove(*fields);
</ins><span class="cx"> 
</span><del>-    if (!decoder.decode(m_responseContentDispositionEncodingFallbackArray))
</del><ins>+    Optional<Vector<String>> array;
+    decoder >> array;
+    if (!array)
</ins><span class="cx">         return false;
</span><ins>+    m_responseContentDispositionEncodingFallbackArray = WTFMove(*array);
</ins><span class="cx"> 
</span><del>-    ResourceRequestCachePolicy cachePolicy;
-    if (!decoder.decodeEnum(cachePolicy))
</del><ins>+    Optional<ResourceRequestCachePolicy> cachePolicy;
+    decoder >> cachePolicy;
+    if (!cachePolicy)
</ins><span class="cx">         return false;
</span><del>-    m_cachePolicy = cachePolicy;
</del><ins>+    m_cachePolicy = *cachePolicy;
</ins><span class="cx"> 
</span><del>-    bool allowCookies;
-    if (!decoder.decode(allowCookies))
</del><ins>+    Optional<bool> allowCookies;
+    decoder >> allowCookies;
+    if (!allowCookies)
</ins><span class="cx">         return false;
</span><del>-    m_allowCookies = allowCookies;
</del><ins>+    m_allowCookies = *allowCookies;
</ins><span class="cx"> 
</span><del>-    SameSiteDisposition sameSiteDisposition;
-    if (!decoder.decodeEnum(sameSiteDisposition))
</del><ins>+    Optional<SameSiteDisposition> sameSiteDisposition;
+    decoder >> sameSiteDisposition;
+    if (!sameSiteDisposition)
</ins><span class="cx">         return false;
</span><del>-    m_sameSiteDisposition = sameSiteDisposition;
</del><ins>+    m_sameSiteDisposition = *sameSiteDisposition;
</ins><span class="cx"> 
</span><del>-    bool isTopSite;
-    if (!decoder.decode(isTopSite))
</del><ins>+    Optional<bool> isTopSite;
+    decoder >> isTopSite;
+    if (!isTopSite)
</ins><span class="cx">         return false;
</span><del>-    m_isTopSite = isTopSite;
</del><ins>+    m_isTopSite = *isTopSite;
</ins><span class="cx"> 
</span><del>-    ResourceLoadPriority priority;
-    if (!decoder.decodeEnum(priority))
</del><ins>+    Optional<ResourceLoadPriority> priority;
+    decoder >> priority;
+    if (!priority)
</ins><span class="cx">         return false;
</span><del>-    m_priority = priority;
</del><ins>+    m_priority = *priority;
</ins><span class="cx"> 
</span><del>-    if (!decoder.decodeEnum(m_requester))
</del><ins>+    Optional<Requester> requester;
+    decoder >> requester;
+    if (!requester)
</ins><span class="cx">         return false;
</span><ins>+    m_requester = *requester;
</ins><span class="cx"> 
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="lines">@@ -361,4 +385,41 @@
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><del>-#endif // ResourceRequestBase_h
</del><ins>+namespace WTF {
+
+template<> struct EnumTraits<WebCore::ResourceRequestCachePolicy> {
+    using values = EnumValues<
+        WebCore::ResourceRequestCachePolicy,
+        WebCore::ResourceRequestCachePolicy::UseProtocolCachePolicy,
+        WebCore::ResourceRequestCachePolicy::ReloadIgnoringCacheData,
+        WebCore::ResourceRequestCachePolicy::ReturnCacheDataElseLoad,
+        WebCore::ResourceRequestCachePolicy::ReturnCacheDataDontLoad,
+        WebCore::ResourceRequestCachePolicy::DoNotUseAnyCache,
+        WebCore::ResourceRequestCachePolicy::RefreshAnyCacheData
+    >;
+};
+
+template<> struct EnumTraits<WebCore::ResourceRequestBase::SameSiteDisposition> {
+    using values = EnumValues<
+        WebCore::ResourceRequestBase::SameSiteDisposition,
+        WebCore::ResourceRequestBase::SameSiteDisposition::Unspecified,
+        WebCore::ResourceRequestBase::SameSiteDisposition::SameSite,
+        WebCore::ResourceRequestBase::SameSiteDisposition::CrossSite
+    >;
+};
+
+template<> struct EnumTraits<WebCore::ResourceRequestBase::Requester> {
+    using values = EnumValues<
+        WebCore::ResourceRequestBase::Requester,
+        WebCore::ResourceRequestBase::Requester::Unspecified,
+        WebCore::ResourceRequestBase::Requester::Main,
+        WebCore::ResourceRequestBase::Requester::XHR,
+        WebCore::ResourceRequestBase::Requester::Fetch,
+        WebCore::ResourceRequestBase::Requester::Media,
+        WebCore::ResourceRequestBase::Requester::ImportScripts,
+        WebCore::ResourceRequestBase::Requester::Ping,
+        WebCore::ResourceRequestBase::Requester::Beacon
+    >;
+};
+
+} // namespace WTF
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkResourceResponseBaseh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/ResourceResponseBase.h (259921 => 259922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/ResourceResponseBase.h     2020-04-11 05:17:24 UTC (rev 259921)
+++ trunk/Source/WebCore/platform/network/ResourceResponseBase.h        2020-04-11 06:39:36 UTC (rev 259922)
</span><span class="lines">@@ -32,6 +32,7 @@
</span><span class="cx"> #include "NetworkLoadMetrics.h"
</span><span class="cx"> #include "ParsedContentRange.h"
</span><span class="cx"> #include <wtf/Box.h>
</span><ins>+#include <wtf/EnumTraits.h>
</ins><span class="cx"> #include <wtf/Markable.h>
</span><span class="cx"> #include <wtf/URL.h>
</span><span class="cx"> #include <wtf/WallTime.h>
</span><span class="lines">@@ -297,9 +298,9 @@
</span><span class="cx"> 
</span><span class="cx">     encoder << m_httpStatusCode;
</span><span class="cx">     encoder << m_certificateInfo;
</span><del>-    encoder.encodeEnum(m_source);
-    encoder.encodeEnum(m_type);
-    encoder.encodeEnum(m_tainting);
</del><ins>+    encoder << m_source;
+    encoder << m_type;
+    encoder << m_tainting;
</ins><span class="cx">     encoder << m_isRedirected;
</span><span class="cx">     UsedLegacyTLS usedLegacyTLS = m_usedLegacyTLS;
</span><span class="cx">     encoder << usedLegacyTLS;
</span><span class="lines">@@ -307,68 +308,161 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> template<class Decoder>
</span><del>-bool ResourceResponseBase::decode(Decoder& decoder, ResourceResponseBase& response)
</del><ins>+bool WARN_UNUSED_RETURN ResourceResponseBase::decode(Decoder& decoder, ResourceResponseBase& response)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(response.m_isNull);
</span><del>-    bool responseIsNull;
-    if (!decoder.decode(responseIsNull))
</del><ins>+    Optional<bool> responseIsNull;
+    decoder >> responseIsNull;
+    if (!responseIsNull)
</ins><span class="cx">         return false;
</span><del>-    if (responseIsNull)
</del><ins>+    if (*responseIsNull)
</ins><span class="cx">         return true;
</span><span class="cx"> 
</span><span class="cx">     response.m_isNull = false;
</span><span class="cx"> 
</span><del>-    if (!decoder.decode(response.m_url))
</del><ins>+    Optional<URL> url;
+    decoder >> url;
+    if (!url)
</ins><span class="cx">         return false;
</span><del>-    if (!decoder.decode(response.m_mimeType))
</del><ins>+    response.m_url = WTFMove(*url);
+
+    Optional<String> mimeType;
+    decoder >> mimeType;
+    if (!mimeType)
</ins><span class="cx">         return false;
</span><del>-    int64_t expectedContentLength;
-    if (!decoder.decode(expectedContentLength))
</del><ins>+    response.m_mimeType = WTFMove(*mimeType);
+
+    Optional<int64_t> expectedContentLength;
+    decoder >> expectedContentLength;
+    if (!expectedContentLength)
</ins><span class="cx">         return false;
</span><del>-    response.m_expectedContentLength = expectedContentLength;
-    if (!decoder.decode(response.m_textEncodingName))
</del><ins>+    response.m_expectedContentLength = *expectedContentLength;
+
+    Optional<AtomString> textEncodingName;
+    decoder >> textEncodingName;
+    if (!textEncodingName)
</ins><span class="cx">         return false;
</span><del>-    if (!decoder.decode(response.m_httpStatusText))
</del><ins>+    response.m_textEncodingName = WTFMove(*textEncodingName);
+
+    Optional<AtomString> httpStatusText;
+    decoder >> httpStatusText;
+    if (!httpStatusText)
</ins><span class="cx">         return false;
</span><del>-    if (!decoder.decode(response.m_httpVersion))
</del><ins>+    response.m_httpStatusText = WTFMove(*httpStatusText);
+
+    Optional<AtomString> httpVersion;
+    decoder >> httpVersion;
+    if (!httpVersion)
</ins><span class="cx">         return false;
</span><del>-    if (!decoder.decode(response.m_httpHeaderFields))
</del><ins>+    response.m_httpVersion = WTFMove(*httpVersion);
+
+    Optional<HTTPHeaderMap> httpHeaderFields;
+    decoder >> httpHeaderFields;
+    if (!httpHeaderFields)
</ins><span class="cx">         return false;
</span><ins>+    response.m_httpHeaderFields = WTFMove(*httpHeaderFields);
+
</ins><span class="cx">     // The networkLoadMetrics info is only send over IPC and not stored in disk cache.
</span><span class="cx">     if constexpr (Decoder::isIPCDecoder) {
</span><del>-        if (!decoder.decode(response.m_networkLoadMetrics))
</del><ins>+        Optional<Box<NetworkLoadMetrics>> networkLoadMetrics;
+        decoder >> networkLoadMetrics;
+        if (!networkLoadMetrics)
</ins><span class="cx">             return false;
</span><ins>+        response.m_networkLoadMetrics = WTFMove(*networkLoadMetrics);
</ins><span class="cx">     }
</span><del>-    if (!decoder.decode(response.m_httpStatusCode))
</del><ins>+
+    Optional<short> httpStatusCode;
+    decoder >> httpStatusCode;
+    if (!httpStatusCode)
</ins><span class="cx">         return false;
</span><del>-    if (!decoder.decode(response.m_certificateInfo))
</del><ins>+    response.m_httpStatusCode = WTFMove(*httpStatusCode);
+
+    Optional<Optional<CertificateInfo>> certificateInfo;
+    decoder >> certificateInfo;
+    if (!certificateInfo)
</ins><span class="cx">         return false;
</span><del>-    Source source = Source::Unknown;
-    if (!decoder.decodeEnum(source))
</del><ins>+    response.m_certificateInfo = WTFMove(*certificateInfo);
+
+    Optional<Source> source;
+    decoder >> source;
+    if (!source)
</ins><span class="cx">         return false;
</span><del>-    response.m_source = source;
-    Type type = Type::Default;
-    if (!decoder.decodeEnum(type))
</del><ins>+    response.m_source = WTFMove(*source);
+
+    Optional<Type> type;
+    decoder >> type;
+    if (!type)
</ins><span class="cx">         return false;
</span><del>-    response.m_type = type;
-    Tainting tainting = Tainting::Basic;
-    if (!decoder.decodeEnum(tainting))
</del><ins>+    response.m_type = WTFMove(*type);
+
+    Optional<Tainting> tainting;
+    decoder >> tainting;
+    if (!tainting)
</ins><span class="cx">         return false;
</span><del>-    response.m_tainting = tainting;
-    bool isRedirected = false;
-    if (!decoder.decode(isRedirected))
</del><ins>+    response.m_tainting = WTFMove(*tainting);
+
+    Optional<bool> isRedirected;
+    decoder >> isRedirected;
+    if (!isRedirected)
</ins><span class="cx">         return false;
</span><del>-    response.m_isRedirected = isRedirected;
-    UsedLegacyTLS usedLegacyTLS = UsedLegacyTLS::No;
-    if (!decoder.decode(usedLegacyTLS))
</del><ins>+    response.m_isRedirected = WTFMove(*isRedirected);
+
+    Optional<UsedLegacyTLS> usedLegacyTLS;
+    decoder >> usedLegacyTLS;
+    if (!usedLegacyTLS)
</ins><span class="cx">         return false;
</span><del>-    response.m_usedLegacyTLS = usedLegacyTLS;
-    bool isRangeRequested = false;
-    if (!decoder.decode(isRangeRequested))
</del><ins>+    response.m_usedLegacyTLS = WTFMove(*usedLegacyTLS);
+
+    Optional<bool> isRangeRequested;
+    decoder >> isRangeRequested;
+    if (!isRangeRequested)
</ins><span class="cx">         return false;
</span><del>-    response.m_isRangeRequested = isRangeRequested;
</del><ins>+    response.m_isRangeRequested = WTFMove(*isRangeRequested);
</ins><span class="cx"> 
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span><ins>+
+namespace WTF {
+
+template<> struct EnumTraits<WebCore::ResourceResponseBase::Type> {
+    using values = EnumValues<
+        WebCore::ResourceResponseBase::Type,
+        WebCore::ResourceResponseBase::Type::Basic,
+        WebCore::ResourceResponseBase::Type::Cors,
+        WebCore::ResourceResponseBase::Type::Default,
+        WebCore::ResourceResponseBase::Type::Error,
+        WebCore::ResourceResponseBase::Type::Opaque,
+        WebCore::ResourceResponseBase::Type::Opaqueredirect
+    >;
+};
+
+template<> struct EnumTraits<WebCore::ResourceResponseBase::Tainting> {
+    using values = EnumValues<
+        WebCore::ResourceResponseBase::Tainting,
+        WebCore::ResourceResponseBase::Tainting::Basic,
+        WebCore::ResourceResponseBase::Tainting::Cors,
+        WebCore::ResourceResponseBase::Tainting::Opaque,
+        WebCore::ResourceResponseBase::Tainting::Opaqueredirect
+    >;
+};
+
+
+template<> struct EnumTraits<WebCore::ResourceResponseBase::Source> {
+    using values = EnumValues<
+        WebCore::ResourceResponseBase::Source,
+        WebCore::ResourceResponseBase::Source::Unknown,
+        WebCore::ResourceResponseBase::Source::Network,
+        WebCore::ResourceResponseBase::Source::DiskCache,
+        WebCore::ResourceResponseBase::Source::DiskCacheAfterValidation,
+        WebCore::ResourceResponseBase::Source::MemoryCache,
+        WebCore::ResourceResponseBase::Source::MemoryCacheAfterValidation,
+        WebCore::ResourceResponseBase::Source::ServiceWorker,
+        WebCore::ResourceResponseBase::Source::ApplicationCache,
+        WebCore::ResourceResponseBase::Source::DOMCache,
+        WebCore::ResourceResponseBase::Source::InspectorOverride
+    >;
+};
+
+} // namespace WTF
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkcfCertificateInfoh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/cf/CertificateInfo.h (259921 => 259922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/cf/CertificateInfo.h       2020-04-11 05:17:24 UTC (rev 259921)
+++ trunk/Source/WebCore/platform/network/cf/CertificateInfo.h  2020-04-11 06:39:36 UTC (rev 259922)
</span><span class="lines">@@ -26,12 +26,11 @@
</span><span class="cx"> #pragma once
</span><span class="cx"> 
</span><span class="cx"> #include "CertificateInfoBase.h"
</span><ins>+#include <wtf/EnumTraits.h>
</ins><span class="cx"> #include <wtf/RetainPtr.h>
</span><span class="cx"> #include <wtf/Vector.h>
</span><span class="cx"> #include <wtf/cf/TypeCastsCF.h>
</span><del>-#include <wtf/persistence/PersistentCoders.h>
-#include <wtf/persistence/PersistentDecoder.h>
-#include <wtf/persistence/PersistentEncoder.h>
</del><ins>+#include <wtf/persistence/PersistentCoder.h>
</ins><span class="cx"> 
</span><span class="cx"> #if PLATFORM(COCOA)
</span><span class="cx"> #include <Security/SecCertificate.h>
</span><span class="lines">@@ -98,163 +97,25 @@
</span><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> namespace WTF {
</span><del>-namespace Persistence {
</del><span class="cx"> 
</span><del>-static void encodeCFData(Encoder& encoder, CFDataRef data)
-{
-    uint64_t length = CFDataGetLength(data);
-    const uint8_t* bytePtr = CFDataGetBytePtr(data);
-
-    encoder << length;
-    encoder.encodeFixedLengthData(bytePtr, static_cast<size_t>(length));
-}
-
-static bool decodeCFData(Decoder& decoder, RetainPtr<CFDataRef>& data)
-{
-    uint64_t size = 0;
-    if (!decoder.decode(size))
-        return false;
-
-    Vector<uint8_t> vector(static_cast<size_t>(size));
-    if (!decoder.decodeFixedLengthData(vector.data(), vector.size()))
-        return false;
-
-    data = adoptCF(CFDataCreate(nullptr, vector.data(), vector.size()));
-    return true;
-}
-
</del><ins>+template<> struct EnumTraits<WebCore::CertificateInfo::Type> {
+    using values = EnumValues<
+        WebCore::CertificateInfo::Type,
+        WebCore::CertificateInfo::Type::None,
+        WebCore::CertificateInfo::Type::CertificateChain
</ins><span class="cx"> #if HAVE(SEC_TRUST_SERIALIZATION)
</span><del>-static void encodeSecTrustRef(Encoder& encoder, SecTrustRef trust)
-{
-    auto data = adoptCF(SecTrustSerialize(trust, nullptr));
-    if (!data) {
-        encoder << false;
-        return;
-    }
-
-    encoder << true;
-    encodeCFData(encoder, data.get());
-}
-
-static bool decodeSecTrustRef(Decoder& decoder, RetainPtr<SecTrustRef>& result)
-{
-    bool hasTrust;
-    if (!decoder.decode(hasTrust))
-        return false;
-
-    if (!hasTrust)
-        return true;
-
-    RetainPtr<CFDataRef> trustData;
-    if (!decodeCFData(decoder, trustData))
-        return false;
-
-    auto trust = adoptCF(SecTrustDeserialize(trustData.get(), nullptr));
-    if (!trust)
-        return false;
-
-    result = WTFMove(trust);
-    return true;
-}
</del><ins>+        , WebCore::CertificateInfo::Type::Trust
</ins><span class="cx"> #endif
</span><ins>+    >;
+};
</ins><span class="cx"> 
</span><del>-#if PLATFORM(COCOA)
-static void encodeCertificateChain(Encoder& encoder, CFArrayRef certificateChain)
-{
-    CFIndex size = CFArrayGetCount(certificateChain);
-    Vector<CFTypeRef, 32> values(size);
</del><ins>+namespace Persistence {
</ins><span class="cx"> 
</span><del>-    CFArrayGetValues(certificateChain, CFRangeMake(0, size), values.data());
-
-    encoder << static_cast<uint64_t>(size);
-
-    for (CFIndex i = 0; i < size; ++i) {
-        ASSERT(values[i]);
-        auto data = adoptCF(SecCertificateCopyData(checked_cf_cast<SecCertificateRef>(values[i])));
-        encodeCFData(encoder, data.get());
-    }
-}
-
-static bool decodeCertificateChain(Decoder& decoder, RetainPtr<CFArrayRef>& certificateChain)
-{
-    uint64_t size;
-    if (!decoder.decode(size))
-        return false;
-
-    auto array = adoptCF(CFArrayCreateMutable(0, 0, &kCFTypeArrayCallBacks));
-
-    for (size_t i = 0; i < size; ++i) {
-        RetainPtr<CFDataRef> data;
-        if (!decodeCFData(decoder, data))
-            return false;
-
-        auto certificate = adoptCF(SecCertificateCreateWithData(0, data.get()));
-        CFArrayAppendValue(array.get(), certificate.get());
-    }
-
-    certificateChain = WTFMove(array);
-    return true;
-}
-#endif
-
</del><span class="cx"> template<> struct Coder<WebCore::CertificateInfo> {
</span><del>-    static void encode(Encoder& encoder, const WebCore::CertificateInfo& certificateInfo)
-    {
-        encoder.encodeEnum(certificateInfo.type());
-
-        switch (certificateInfo.type()) {
-#if HAVE(SEC_TRUST_SERIALIZATION)
-        case WebCore::CertificateInfo::Type::Trust:
-            encodeSecTrustRef(encoder, certificateInfo.trust());
-            break;
-#endif
-#if PLATFORM(COCOA)
-        case WebCore::CertificateInfo::Type::CertificateChain: {
-            encodeCertificateChain(encoder, certificateInfo.certificateChain());
-            break;
-        }
-#endif
-        case WebCore::CertificateInfo::Type::None:
-            // Do nothing.
-            break;
-        }
-    }
-
-    static bool decode(Decoder& decoder, WebCore::CertificateInfo& certificateInfo)
-    {
-        WebCore::CertificateInfo::Type certificateInfoType;
-        if (!decoder.decodeEnum(certificateInfoType))
-            return false;
-
-        switch (certificateInfoType) {
-#if HAVE(SEC_TRUST_SERIALIZATION)
-        case WebCore::CertificateInfo::Type::Trust: {
-            RetainPtr<SecTrustRef> trust;
-            if (!decodeSecTrustRef(decoder, trust))
-                return false;
-
-            certificateInfo = WebCore::CertificateInfo(WTFMove(trust));
-            return true;
-        }
-#endif
-#if PLATFORM(COCOA)
-        case WebCore::CertificateInfo::Type::CertificateChain: {
-            RetainPtr<CFArrayRef> certificateChain;
-            if (!decodeCertificateChain(decoder, certificateChain))
-                return false;
-
-            certificateInfo = WebCore::CertificateInfo(WTFMove(certificateChain));
-            return true;
-        }
-#endif
-        case WebCore::CertificateInfo::Type::None:
-            // Do nothing.
-            break;
-        }
-
-        return true;
-    }
</del><ins>+    static WEBCORE_EXPORT void encode(Encoder&, const WebCore::CertificateInfo&);
+    static WEBCORE_EXPORT Optional<WebCore::CertificateInfo> decode(Decoder&);
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WTF::Persistence
</span><ins>+
</ins><span class="cx"> } // namespace WTF
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkcfCertificateInfoCFNetcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/cf/CertificateInfoCFNet.cpp (259921 => 259922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/cf/CertificateInfoCFNet.cpp        2020-04-11 05:17:24 UTC (rev 259921)
+++ trunk/Source/WebCore/platform/network/cf/CertificateInfoCFNet.cpp   2020-04-11 06:39:36 UTC (rev 259922)
</span><span class="lines">@@ -26,6 +26,9 @@
</span><span class="cx"> #include "config.h"
</span><span class="cx"> #include "CertificateInfo.h"
</span><span class="cx"> 
</span><ins>+#include <wtf/persistence/PersistentDecoder.h>
+#include <wtf/persistence/PersistentEncoder.h>
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(COCOA)
</span><span class="lines">@@ -153,3 +156,165 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span><ins>+
+namespace WTF {
+namespace Persistence {
+
+static void encodeCFData(Encoder& encoder, CFDataRef data)
+{
+    uint64_t length = CFDataGetLength(data);
+    const uint8_t* bytePtr = CFDataGetBytePtr(data);
+
+    encoder << length;
+    encoder.encodeFixedLengthData(bytePtr, static_cast<size_t>(length));
+}
+
+static Optional<RetainPtr<CFDataRef>> decodeCFData(Decoder& decoder)
+{
+    Optional<uint64_t> size;
+    decoder >> size;
+    if (!size)
+        return WTF::nullopt;
+
+    if (UNLIKELY(!isInBounds<size_t>(*size)))
+        return WTF::nullopt;
+    
+    Vector<uint8_t> vector(static_cast<size_t>(*size));
+    if (!decoder.decodeFixedLengthData(vector.data(), vector.size()))
+        return WTF::nullopt;
+
+    return adoptCF(CFDataCreate(nullptr, vector.data(), vector.size()));
+}
+
+#if HAVE(SEC_TRUST_SERIALIZATION)
+static void encodeSecTrustRef(Encoder& encoder, SecTrustRef trust)
+{
+    auto data = adoptCF(SecTrustSerialize(trust, nullptr));
+    if (!data) {
+        encoder << false;
+        return;
+    }
+
+    encoder << true;
+    encodeCFData(encoder, data.get());
+}
+
+static Optional<RetainPtr<SecTrustRef>> decodeSecTrustRef(Decoder& decoder)
+{
+    Optional<bool> hasTrust;
+    decoder >> hasTrust;
+    if (!hasTrust)
+        return WTF::nullopt;
+
+    if (!*hasTrust)
+        return { nullptr };
+
+    auto trustData = decodeCFData(decoder);
+    if (!trustData)
+        return WTF::nullopt;
+
+    auto trust = adoptCF(SecTrustDeserialize(trustData->get(), nullptr));
+    if (!trust)
+        return WTF::nullopt;
+
+    return WTFMove(trust);
+}
+#endif
+
+#if PLATFORM(COCOA)
+static void encodeCertificateChain(Encoder& encoder, CFArrayRef certificateChain)
+{
+    CFIndex size = CFArrayGetCount(certificateChain);
+    Vector<CFTypeRef, 32> values(size);
+
+    CFArrayGetValues(certificateChain, CFRangeMake(0, size), values.data());
+
+    encoder << static_cast<uint64_t>(size);
+
+    for (CFIndex i = 0; i < size; ++i) {
+        ASSERT(values[i]);
+        auto data = adoptCF(SecCertificateCopyData(checked_cf_cast<SecCertificateRef>(values[i])));
+        encodeCFData(encoder, data.get());
+    }
+}
+
+static Optional<RetainPtr<CFArrayRef>> decodeCertificateChain(Decoder& decoder)
+{
+    Optional<uint64_t> size;
+    decoder >> size;
+    if (!size)
+        return WTF::nullopt;
+
+    auto array = adoptCF(CFArrayCreateMutable(0, 0, &kCFTypeArrayCallBacks));
+
+    for (size_t i = 0; i < *size; ++i) {
+        auto data = decodeCFData(decoder);
+        if (!data)
+            return WTF::nullopt;
+
+        auto certificate = adoptCF(SecCertificateCreateWithData(0, data->get()));
+        CFArrayAppendValue(array.get(), certificate.get());
+    }
+
+    return { WTFMove(array) };
+}
+#endif
+
+void Coder<WebCore::CertificateInfo>::encode(Encoder& encoder, const WebCore::CertificateInfo& certificateInfo)
+{
+    encoder << certificateInfo.type();
+
+    switch (certificateInfo.type()) {
+#if HAVE(SEC_TRUST_SERIALIZATION)
+    case WebCore::CertificateInfo::Type::Trust:
+        encodeSecTrustRef(encoder, certificateInfo.trust());
+        break;
+#endif
+#if PLATFORM(COCOA)
+    case WebCore::CertificateInfo::Type::CertificateChain: {
+        encodeCertificateChain(encoder, certificateInfo.certificateChain());
+        break;
+    }
+#endif
+    case WebCore::CertificateInfo::Type::None:
+        // Do nothing.
+        break;
+    }
+}
+
+Optional<WebCore::CertificateInfo> Coder<WebCore::CertificateInfo>::decode(Decoder& decoder)
+{
+    Optional<WebCore::CertificateInfo::Type> certificateInfoType;
+    decoder >> certificateInfoType;
+    if (!certificateInfoType)
+        return WTF::nullopt;
+
+    switch (*certificateInfoType) {
+#if HAVE(SEC_TRUST_SERIALIZATION)
+    case WebCore::CertificateInfo::Type::Trust: {
+        auto trust = decodeSecTrustRef(decoder);
+        if (!trust)
+            return WTF::nullopt;
+
+        return WebCore::CertificateInfo(WTFMove(*trust));
+    }
+#endif
+#if PLATFORM(COCOA)
+    case WebCore::CertificateInfo::Type::CertificateChain: {
+        auto certificateChain = decodeCertificateChain(decoder);
+        if (!certificateChain)
+            return WTF::nullopt;
+
+        return WebCore::CertificateInfo(WTFMove(*certificateChain));
+    }
+#endif
+    case WebCore::CertificateInfo::Type::None:
+        // Do nothing.
+        return WebCore::CertificateInfo();
+    }
+
+    return WTF::nullopt;
+}
+
+} // namespace Persistence
+} // namespace WTF
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkcurlCertificateInfoh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/curl/CertificateInfo.h (259921 => 259922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/curl/CertificateInfo.h     2020-04-11 05:17:24 UTC (rev 259921)
+++ trunk/Source/WebCore/platform/network/curl/CertificateInfo.h        2020-04-11 06:39:36 UTC (rev 259922)
</span><span class="lines">@@ -82,27 +82,29 @@
</span><span class="cx">             encoder << certificate;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    static bool decode(Decoder& decoder, WebCore::CertificateInfo& certificateInfo)
</del><ins>+    static Optional<WebCore::CertificateInfo> decode(Decoder& decoder)
</ins><span class="cx">     {
</span><del>-        int verificationError;
-        if (!decoder.decode(verificationError))
-            return false;
</del><ins>+        Optional<int> verificationError;
+        decoder >> verificationError;
+        if (!verificationError)
+            return WTF::nullopt;
</ins><span class="cx"> 
</span><del>-        size_t numOfCert = 0;
-        if (!decoder.decode(numOfCert))
-            return false;
</del><ins>+        Optional<size_t> numOfCerts;
+        decoder >> numOfCerts;
+        if (!numOfCerts)
+            return WTF::nullopt;
</ins><span class="cx"> 
</span><span class="cx">         WebCore::CertificateInfo::CertificateChain certificateChain;
</span><del>-        for (size_t i = 0; i < numOfCert; i++) {
-            WebCore::CertificateInfo::Certificate certificate;
-            if (!decoder.decode(certificate))
-                return false;
</del><ins>+        for (size_t i = 0; i < numOfCerts.value(); i++) {
+            Optional<WebCore::CertificateInfo::Certificate> certificate;
+            decoder >> certificate;
+            if (!certificate)
+                return WTF::nullopt;
</ins><span class="cx"> 
</span><del>-            certificateChain.append(WTFMove(certificate));
</del><ins>+            certificateChain.append(WTFMove(certificate.value()));
</ins><span class="cx">         }
</span><span class="cx"> 
</span><del>-        certificateInfo = WebCore::CertificateInfo(verificationError, WTFMove(certificateChain));
-        return true;
</del><ins>+        return WebCore::CertificateInfo(verificationError.value(), WTFMove(certificateChain));
</ins><span class="cx">     }
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworksoupCertificateInfoh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/soup/CertificateInfo.h (259921 => 259922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/soup/CertificateInfo.h     2020-04-11 05:17:24 UTC (rev 259921)
+++ trunk/Source/WebCore/platform/network/soup/CertificateInfo.h        2020-04-11 06:39:36 UTC (rev 259922)
</span><span class="lines">@@ -76,15 +76,18 @@
</span><span class="cx">         encoder.encodeFixedLengthData(byteArray->data, byteArray->len);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    static bool decode(Decoder &decoder, GRefPtr<GByteArray>& byteArray)
</del><ins>+    static Optional<GRefPtr<GByteArray>> decode(Decoder& decoder)
</ins><span class="cx">     {
</span><del>-        uint32_t size;
-        if (!decoder.decode(size))
-            return false;
</del><ins>+        Optional<uint32_t> size;
+        decoder >> size;
+        if (!size)
+            return WTF::nullopt;
</ins><span class="cx"> 
</span><del>-        byteArray = adoptGRef(g_byte_array_sized_new(size));
-        g_byte_array_set_size(byteArray.get(), size);
-        return decoder.decodeFixedLengthData(byteArray->data, size);
</del><ins>+        GRefPtr<GByteArray> byteArray = adoptGRef(g_byte_array_sized_new(*size));
+        g_byte_array_set_size(byteArray.get(), *size);
+        if (!decoder.decodeFixedLengthData(byteArray->data, *size))
+            return WTF::nullopt;
+        return byteArray;
</ins><span class="cx">     }
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="lines">@@ -139,25 +142,29 @@
</span><span class="cx">         encoder << static_cast<uint32_t>(certificateInfo.tlsErrors());
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    static bool decode(Decoder& decoder, WebCore::CertificateInfo& certificateInfo)
</del><ins>+    static Optional<WebCore::CertificateInfo> decode(Decoder& decoder)
</ins><span class="cx">     {
</span><del>-        Vector<GRefPtr<GByteArray>> certificatesDataList;
-        if (!decoder.decode(certificatesDataList))
-            return false;
</del><ins>+        Optional<Vector<GRefPtr<GByteArray>>> certificatesDataList;
+        decoder >> certificatesDataList;
+        if (!certificatesDataList)
+            return WTF::nullopt;
</ins><span class="cx"> 
</span><del>-        if (certificatesDataList.isEmpty())
-            return true;
-        auto certificate = certificateFromCertificatesDataList(certificatesDataList);
</del><ins>+        WebCore::CertificateInfo certificateInfo;
+        if (certificatesDataList->isEmpty())
+            return certificateInfo;
+
+        auto certificate = certificateFromCertificatesDataList(certificatesDataList.value());
</ins><span class="cx">         if (!certificate)
</span><del>-            return false;
</del><ins>+            return WTF::nullopt;
</ins><span class="cx">         certificateInfo.setCertificate(certificate.get());
</span><span class="cx"> 
</span><del>-        uint32_t tlsErrors;
-        if (!decoder.decode(tlsErrors))
-            return false;
-        certificateInfo.setTLSErrors(static_cast<GTlsCertificateFlags>(tlsErrors));
</del><ins>+        Optional<uint32_t> tlsErrors;
+        decoder >> tlsErrors;
+        if (!tlsErrors)
+            return WTF::nullopt;
+        certificateInfo.setTLSErrors(static_cast<GTlsCertificateFlags>(*tlsErrors));
</ins><span class="cx"> 
</span><del>-        return true;
</del><ins>+        return certificateInfo;
</ins><span class="cx">     }
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworksoupResourceResponseh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/soup/ResourceResponse.h (259921 => 259922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/soup/ResourceResponse.h    2020-04-11 05:17:24 UTC (rev 259921)
+++ trunk/Source/WebCore/platform/network/soup/ResourceResponse.h       2020-04-11 06:39:36 UTC (rev 259922)
</span><span class="lines">@@ -92,7 +92,7 @@
</span><span class="cx"> void ResourceResponse::encode(Encoder& encoder) const
</span><span class="cx"> {
</span><span class="cx">     ResourceResponseBase::encode(encoder);
</span><del>-    encoder.encodeEnum(m_soupFlags);
</del><ins>+    encoder << static_cast<uint64_t>(m_soupFlags);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> template<class Decoder>
</span><span class="lines">@@ -100,8 +100,12 @@
</span><span class="cx"> {
</span><span class="cx">     if (!ResourceResponseBase::decode(decoder, response))
</span><span class="cx">         return false;
</span><del>-    if (!decoder.decodeEnum(response.m_soupFlags))
</del><ins>+    Optional<uint64_t> soupFlags;
+    decoder >> soupFlags;
+    if (!soupFlags)
</ins><span class="cx">         return false;
</span><ins>+    // FIXME: Verify that this is a valid value for SoupMessageFlags.
+    response.m_soupFlags = static_cast<SoupMessageFlags>(*soupFlags);
</ins><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreworkersserviceServiceWorkerContextDatah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/workers/service/ServiceWorkerContextData.h (259921 => 259922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/workers/service/ServiceWorkerContextData.h  2020-04-11 05:17:24 UTC (rev 259921)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerContextData.h     2020-04-11 06:39:36 UTC (rev 259922)
</span><span class="lines">@@ -51,20 +51,28 @@
</span><span class="cx">             encoder << script << responseURL << mimeType;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        template<class Decoder> static bool decode(Decoder& decoder, ImportedScript& script)
</del><ins>+        template<class Decoder> static Optional<ImportedScript> decode(Decoder& decoder)
</ins><span class="cx">         {
</span><del>-            ImportedScript importedScript;
-            if (!decoder.decode(importedScript.script))
-                return false;
-
-            if (!decoder.decode(importedScript.responseURL))
-                return false;
-
-            if (!decoder.decode(importedScript.mimeType))
-                return false;
-
-            script = WTFMove(importedScript);
-            return true;
</del><ins>+            Optional<String> script;
+            decoder >> script;
+            if (!script)
+                return WTF::nullopt;
+            
+            Optional<URL> responseURL;
+            decoder >> responseURL;
+            if (!responseURL)
+                return WTF::nullopt;
+            
+            Optional<String> mimeType;
+            decoder >> mimeType;
+            if (!mimeType)
+                return WTF::nullopt;
+            
+            return {{
+                WTFMove(*script),
+                WTFMove(*responseURL),
+                WTFMove(*mimeType)
+            }};
</ins><span class="cx">         }
</span><span class="cx">     };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreworkersserviceserverRegistrationDatabasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/workers/service/server/RegistrationDatabase.cpp (259921 => 259922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/workers/service/server/RegistrationDatabase.cpp     2020-04-11 05:17:24 UTC (rev 259921)
+++ trunk/Source/WebCore/workers/service/server/RegistrationDatabase.cpp        2020-04-11 06:39:36 UTC (rev 259922)
</span><span class="lines">@@ -342,7 +342,7 @@
</span><span class="cx">         data.contentSecurityPolicy.encode(cspEncoder);
</span><span class="cx"> 
</span><span class="cx">         WTF::Persistence::Encoder scriptResourceMapEncoder;
</span><del>-        scriptResourceMapEncoder.encode(data.scriptResourceMap);
</del><ins>+        scriptResourceMapEncoder << data.scriptResourceMap;
</ins><span class="cx"> 
</span><span class="cx">         if (sql.bindText(1, data.registration.key.toDatabaseKey()) != SQLITE_OK
</span><span class="cx">             || sql.bindText(2, data.registration.scopeURL.protocolHostAndPort()) != SQLITE_OK
</span><span class="lines">@@ -392,19 +392,23 @@
</span><span class="cx">         Vector<uint8_t> contentSecurityPolicyData;
</span><span class="cx">         sql.getColumnBlobAsVector(9, contentSecurityPolicyData);
</span><span class="cx">         WTF::Persistence::Decoder cspDecoder(contentSecurityPolicyData.data(), contentSecurityPolicyData.size());
</span><del>-        ContentSecurityPolicyResponseHeaders contentSecurityPolicy;
-        if (contentSecurityPolicyData.size() && !ContentSecurityPolicyResponseHeaders::decode(cspDecoder, contentSecurityPolicy))
-            continue;
</del><ins>+        Optional<ContentSecurityPolicyResponseHeaders> contentSecurityPolicy;
+        if (contentSecurityPolicyData.size()) {
+            cspDecoder >> contentSecurityPolicy;
+            if (!contentSecurityPolicy)
+                continue;
+        }
</ins><span class="cx"> 
</span><span class="cx">         auto referrerPolicy = sql.getColumnText(10);
</span><span class="cx"> 
</span><span class="cx">         Vector<uint8_t> scriptResourceMapData;
</span><span class="cx">         sql.getColumnBlobAsVector(11, scriptResourceMapData);
</span><del>-        HashMap<URL, ServiceWorkerContextData::ImportedScript> scriptResourceMap;
</del><ins>+        Optional<HashMap<URL, ServiceWorkerContextData::ImportedScript>> scriptResourceMap;
</ins><span class="cx"> 
</span><span class="cx">         WTF::Persistence::Decoder scriptResourceMapDecoder(scriptResourceMapData.data(), scriptResourceMapData.size());
</span><span class="cx">         if (scriptResourceMapData.size()) {
</span><del>-            if (!scriptResourceMapDecoder.decode(scriptResourceMap))
</del><ins>+            scriptResourceMapDecoder >> scriptResourceMap;
+            if (!scriptResourceMap)
</ins><span class="cx">                 continue;
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="lines">@@ -418,7 +422,7 @@
</span><span class="cx">         auto registrationIdentifier = ServiceWorkerRegistrationIdentifier::generate();
</span><span class="cx">         auto serviceWorkerData = ServiceWorkerData { workerIdentifier, scriptURL, ServiceWorkerState::Activated, *workerType, registrationIdentifier };
</span><span class="cx">         auto registration = ServiceWorkerRegistrationData { WTFMove(*key), registrationIdentifier, WTFMove(scopeURL), *updateViaCache, lastUpdateCheckTime, WTF::nullopt, WTF::nullopt, WTFMove(serviceWorkerData) };
</span><del>-        auto contextData = ServiceWorkerContextData { WTF::nullopt, WTFMove(registration), workerIdentifier, WTFMove(script), WTFMove(contentSecurityPolicy), WTFMove(referrerPolicy), WTFMove(scriptURL), *workerType, true, WTFMove(scriptResourceMap) };
</del><ins>+        auto contextData = ServiceWorkerContextData { WTF::nullopt, WTFMove(registration), workerIdentifier, WTFMove(script), WTFMove(*contentSecurityPolicy), WTFMove(referrerPolicy), WTFMove(scriptURL), *workerType, true, WTFMove(*scriptResourceMap) };
</ins><span class="cx"> 
</span><span class="cx">         callOnMainThread([protectedThis = makeRef(*this), contextData = contextData.isolatedCopy()]() mutable {
</span><span class="cx">             protectedThis->addRegistrationToStore(WTFMove(contextData));
</span></span></pre></div>
<a id="trunkSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ChangeLog (259921 => 259922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ChangeLog    2020-04-11 05:17:24 UTC (rev 259921)
+++ trunk/Source/WebKit/ChangeLog       2020-04-11 06:39:36 UTC (rev 259922)
</span><span class="lines">@@ -1,3 +1,35 @@
</span><ins>+2020-04-10  Alex Christensen  <achristensen@webkit.org>
+
+        PersistentCoders should use modern decoding syntax
+        https://bugs.webkit.org/show_bug.cgi?id=207497
+
+        Reviewed by Darin Adler.
+
+        * NetworkProcess/cache/CacheStorageEngineCache.cpp:
+        (WebKit::CacheStorage::decodeDOMCacheRecord):
+        (WebKit::CacheStorage::Cache::decodeRecordHeader):
+        * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
+        (WebKit::CacheStorage::Caches::readOrigin):
+        (WebKit::CacheStorage::decodeCachesNames):
+        * NetworkProcess/cache/NetworkCacheCoders.cpp:
+        (WTF::Persistence::Coder<WebCore::HTTPHeaderMap>::decode):
+        * NetworkProcess/cache/NetworkCacheEntry.cpp:
+        (WebKit::NetworkCache::Entry::decodeStorageRecord):
+        * NetworkProcess/cache/NetworkCacheKey.cpp:
+        (WebKit::NetworkCache::Key::decode):
+        * NetworkProcess/cache/NetworkCacheKey.h:
+        * NetworkProcess/cache/NetworkCacheStorage.cpp:
+        (WebKit::NetworkCache::decodeRecordMetaData):
+        * NetworkProcess/cache/NetworkCacheSubresourcesEntry.cpp:
+        (WebKit::NetworkCache::SubresourceInfo::encode const):
+        (WebKit::NetworkCache::SubresourceInfo::decode):
+        (WebKit::NetworkCache::SubresourcesEntry::decodeStorageRecord):
+        * NetworkProcess/cache/NetworkCacheSubresourcesEntry.h:
+        * Shared/UserData.cpp:
+        (WebKit::UserData::decode):
+        * UIProcess/API/APIContentRuleListStore.cpp:
+        (API::decodeContentRuleListMetaData):
+
</ins><span class="cx"> 2020-04-10  Devin Rousso  <drousso@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Web Inspector: add `broadcastConsoleMessage` calls for new ITPDebug logs after r259275
</span></span></pre></div>
<a id="trunkSourceWebKitNetworkProcesscacheCacheStorageEngineCachecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngineCache.cpp (259921 => 259922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngineCache.cpp     2020-04-11 05:17:24 UTC (rev 259921)
+++ trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngineCache.cpp        2020-04-11 06:39:36 UTC (rev 259922)
</span><span class="lines">@@ -572,45 +572,80 @@
</span><span class="cx">     return { recordInformation.key, { }, header, body, { } };
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-Optional<Cache::DecodedRecord> Cache::decodeRecordHeader(const Storage::Record& storage)
</del><ins>+static Optional<WebCore::DOMCacheEngine::Record> decodeDOMCacheRecord(WTF::Persistence::Decoder& decoder)
</ins><span class="cx"> {
</span><del>-    WTF::Persistence::Decoder decoder(storage.header.data(), storage.header.size());
-
-    Record record;
-
-    double insertionTime;
-    if (!decoder.decode(insertionTime))
</del><ins>+    Optional<FetchHeaders::Guard> requestHeadersGuard;
+    decoder >> requestHeadersGuard;
+    if (!requestHeadersGuard)
</ins><span class="cx">         return WTF::nullopt;
</span><del>-
-    uint64_t size;
-    if (!decoder.decode(size))
</del><ins>+    
+    ResourceRequest request;
+    if (!request.decodeWithoutPlatformData(decoder))
</ins><span class="cx">         return WTF::nullopt;
</span><del>-
-    if (!decoder.decode(record.requestHeadersGuard))
</del><ins>+    
+    FetchOptions options;
+    if (!FetchOptions::decodePersistent(decoder, options))
</ins><span class="cx">         return WTF::nullopt;
</span><del>-
-    if (!record.request.decodeWithoutPlatformData(decoder))
</del><ins>+    
+    Optional<String> referrer;
+    decoder >> referrer;
+    if (!referrer)
</ins><span class="cx">         return WTF::nullopt;
</span><del>-
-    if (!FetchOptions::decodePersistent(decoder, record.options))
</del><ins>+    
+    Optional<FetchHeaders::Guard> responseHeadersGuard;
+    decoder >> responseHeadersGuard;
+    if (!responseHeadersGuard)
</ins><span class="cx">         return WTF::nullopt;
</span><span class="cx"> 
</span><del>-    if (!decoder.decode(record.referrer))
</del><ins>+    ResourceResponse response;
+    if (!ResourceResponse::decode(decoder, response))
</ins><span class="cx">         return WTF::nullopt;
</span><ins>+    
+    Optional<uint64_t> responseBodySize;
+    decoder >> responseBodySize;
+    if (!responseBodySize)
+        return WTF::nullopt;
</ins><span class="cx"> 
</span><del>-    if (!decoder.decode(record.responseHeadersGuard))
</del><ins>+    if (!decoder.verifyChecksum())
</ins><span class="cx">         return WTF::nullopt;
</span><span class="cx"> 
</span><del>-    if (!decoder.decode(record.response))
</del><ins>+    return {{
+        0,
+        0,
+        WTFMove(*requestHeadersGuard),
+        WTFMove(request),
+        WTFMove(options),
+        WTFMove(*referrer),
+        WTFMove(*responseHeadersGuard),
+        WTFMove(response),
+        { },
+        WTFMove(*responseBodySize)
+    }};
+}
+
+Optional<Cache::DecodedRecord> Cache::decodeRecordHeader(const Storage::Record& storage)
+{
+    WTF::Persistence::Decoder decoder(storage.header.data(), storage.header.size());
+
+    Optional<double> insertionTime;
+    decoder >> insertionTime;
+    if (!insertionTime)
</ins><span class="cx">         return WTF::nullopt;
</span><span class="cx"> 
</span><del>-    if (!decoder.decode(record.responseBodySize))
</del><ins>+    Optional<uint64_t> size;
+    decoder >> size;
+    if (!size)
</ins><span class="cx">         return WTF::nullopt;
</span><span class="cx"> 
</span><del>-    if (!decoder.verifyChecksum())
</del><ins>+    Optional<WebCore::DOMCacheEngine::Record> record = decodeDOMCacheRecord(decoder);
+    if (!record)
</ins><span class="cx">         return WTF::nullopt;
</span><span class="cx"> 
</span><del>-    return DecodedRecord { insertionTime, size, WTFMove(record) };
</del><ins>+    return {{
+        WTFMove(*insertionTime),
+        WTFMove(*size),
+        WTFMove(*record)
+    }};
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Optional<Record> Cache::decode(const Storage::Record& storage)
</span></span></pre></div>
<a id="trunkSourceWebKitNetworkProcesscacheCacheStorageEngineCachescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp (259921 => 259922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp    2020-04-11 05:17:24 UTC (rev 259921)
+++ trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp       2020-04-11 06:39:36 UTC (rev 259922)
</span><span class="lines">@@ -112,23 +112,22 @@
</span><span class="cx"> 
</span><span class="cx"> Optional<WebCore::ClientOrigin> Caches::readOrigin(const Data& data)
</span><span class="cx"> {
</span><del>-    // FIXME: We should be able to use modern decoders for persistent data.
-    WebCore::SecurityOriginData topOrigin, clientOrigin;
</del><span class="cx">     WTF::Persistence::Decoder decoder(data.data(), data.size());
</span><span class="cx"> 
</span><del>-    if (!decoder.decode(topOrigin.protocol))
</del><ins>+    Optional<WebCore::SecurityOriginData> topOrigin;
+    decoder >> topOrigin;
+    if (!topOrigin)
</ins><span class="cx">         return WTF::nullopt;
</span><del>-    if (!decoder.decode(topOrigin.host))
</del><ins>+
+    Optional<WebCore::SecurityOriginData> clientOrigin;
+    decoder >> clientOrigin;
+    if (!clientOrigin)
</ins><span class="cx">         return WTF::nullopt;
</span><del>-    if (!decoder.decode(topOrigin.port))
-        return WTF::nullopt;
-    if (!decoder.decode(clientOrigin.protocol))
-        return WTF::nullopt;
-    if (!decoder.decode(clientOrigin.host))
-        return WTF::nullopt;
-    if (!decoder.decode(clientOrigin.port))
-        return WTF::nullopt;
-    return WebCore::ClientOrigin { WTFMove(topOrigin), WTFMove(clientOrigin) };
</del><ins>+
+    return {{
+        WTFMove(*topOrigin),
+        WTFMove(*clientOrigin)
+    }};
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void Caches::initialize(WebCore::DOMCacheEngine::CompletionCallback&& callback)
</span><span class="lines">@@ -411,23 +410,26 @@
</span><span class="cx"> static inline Expected<Vector<std::pair<String, String>>, Error> decodeCachesNames(const Data& data)
</span><span class="cx"> {
</span><span class="cx">     WTF::Persistence::Decoder decoder(data.data(), data.size());
</span><del>-    uint64_t count;
-    if (!decoder.decode(count))
</del><ins>+    Optional<uint64_t> count;
+    decoder >> count;
+    if (!count)
</ins><span class="cx">         return makeUnexpected(Error::ReadDisk);
</span><span class="cx"> 
</span><span class="cx">     Vector<std::pair<String, String>> names;
</span><del>-    if (!names.tryReserveCapacity(count))
</del><ins>+    if (!names.tryReserveCapacity(*count))
</ins><span class="cx">         return makeUnexpected(Error::ReadDisk);
</span><span class="cx"> 
</span><del>-    for (size_t index = 0; index < count; ++index) {
-        String name;
-        if (!decoder.decode(name))
</del><ins>+    for (size_t index = 0; index < *count; ++index) {
+        Optional<String> name;
+        decoder >> name;
+        if (!name)
</ins><span class="cx">             return makeUnexpected(Error::ReadDisk);
</span><del>-        String uniqueName;
-        if (!decoder.decode(uniqueName))
</del><ins>+        Optional<String> uniqueName;
+        decoder >> uniqueName;
+        if (!uniqueName)
</ins><span class="cx">             return makeUnexpected(Error::ReadDisk);
</span><span class="cx"> 
</span><del>-        names.uncheckedAppend(std::pair<String, String> { WTFMove(name), WTFMove(uniqueName) });
</del><ins>+        names.uncheckedAppend({ WTFMove(*name), WTFMove(*uniqueName) });
</ins><span class="cx">     }
</span><span class="cx">     return names;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKitNetworkProcesscacheNetworkCacheCoderscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheCoders.cpp (259921 => 259922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheCoders.cpp  2020-04-11 05:17:24 UTC (rev 259921)
+++ trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheCoders.cpp     2020-04-11 06:39:36 UTC (rev 259922)
</span><span class="lines">@@ -40,21 +40,26 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool Coder<WebCore::HTTPHeaderMap>::decode(Decoder& decoder, WebCore::HTTPHeaderMap& headers)
</del><ins>+Optional<WebCore::HTTPHeaderMap> Coder<WebCore::HTTPHeaderMap>::decode(Decoder& decoder)
</ins><span class="cx"> {
</span><del>-    uint64_t headersSize;
-    if (!decoder.decode(headersSize))
-        return false;
-    for (uint64_t i = 0; i < headersSize; ++i) {
-        String name;
-        if (!decoder.decode(name))
-            return false;
-        String value;
-        if (!decoder.decode(value))
-            return false;
-        headers.append(name, value);
</del><ins>+    Optional<uint64_t> headersSize;
+    decoder >> headersSize;
+    if (!headersSize)
+        return WTF::nullopt;
+
+    WebCore::HTTPHeaderMap headers;
+    for (uint64_t i = 0; i < *headersSize; ++i) {
+        Optional<String> name;
+        decoder >> name;
+        if (!name)
+            return WTF::nullopt;
+        Optional<String> value;
+        decoder >> value;
+        if (!value)
+            return WTF::nullopt;
+        headers.append(WTFMove(*name), WTFMove(*value));
</ins><span class="cx">     }
</span><del>-    return true;
</del><ins>+    return WTFMove(headers);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKitNetworkProcesscacheNetworkCacheCodersh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheCoders.h (259921 => 259922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheCoders.h    2020-04-11 05:17:24 UTC (rev 259921)
+++ trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheCoders.h       2020-04-11 06:39:36 UTC (rev 259922)
</span><span class="lines">@@ -36,7 +36,7 @@
</span><span class="cx"> 
</span><span class="cx"> template<> struct Coder<WebCore::HTTPHeaderMap> {
</span><span class="cx">     static void encode(Encoder&, const WebCore::HTTPHeaderMap&);
</span><del>-    static bool decode(Decoder&, WebCore::HTTPHeaderMap&);
</del><ins>+    static Optional<WebCore::HTTPHeaderMap> decode(Decoder&);
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKitNetworkProcesscacheNetworkCacheEntrycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheEntry.cpp (259921 => 259922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheEntry.cpp   2020-04-11 05:17:24 UTC (rev 259921)
+++ trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheEntry.cpp      2020-04-11 06:39:36 UTC (rev 259922)
</span><span class="lines">@@ -112,31 +112,41 @@
</span><span class="cx">     auto entry = makeUnique<Entry>(storageEntry);
</span><span class="cx"> 
</span><span class="cx">     WTF::Persistence::Decoder decoder(storageEntry.header.data(), storageEntry.header.size());
</span><del>-    if (!decoder.decode(entry->m_response))
</del><ins>+    WebCore::ResourceResponse response;
+    if (!WebCore::ResourceResponse::decode(decoder, response))
</ins><span class="cx">         return nullptr;
</span><ins>+    entry->m_response = WTFMove(response);
</ins><span class="cx">     entry->m_response.setSource(WebCore::ResourceResponse::Source::DiskCache);
</span><span class="cx"> 
</span><del>-    bool hasVaryingRequestHeaders;
-    if (!decoder.decode(hasVaryingRequestHeaders))
</del><ins>+    Optional<bool> hasVaryingRequestHeaders;
+    decoder >> hasVaryingRequestHeaders;
+    if (!hasVaryingRequestHeaders)
</ins><span class="cx">         return nullptr;
</span><span class="cx"> 
</span><del>-    if (hasVaryingRequestHeaders) {
-        if (!decoder.decode(entry->m_varyingRequestHeaders))
</del><ins>+    if (*hasVaryingRequestHeaders) {
+        Optional<Vector<std::pair<String, String>>> varyingRequestHeaders;
+        decoder >> varyingRequestHeaders;
+        if (!varyingRequestHeaders)
</ins><span class="cx">             return nullptr;
</span><ins>+        entry->m_varyingRequestHeaders = WTFMove(*varyingRequestHeaders);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    bool isRedirect;
-    if (!decoder.decode(isRedirect))
</del><ins>+    Optional<bool> isRedirect;
+    decoder >> isRedirect;
+    if (!isRedirect)
</ins><span class="cx">         return nullptr;
</span><span class="cx"> 
</span><del>-    if (isRedirect) {
</del><ins>+    if (*isRedirect) {
</ins><span class="cx">         entry->m_redirectRequest.emplace();
</span><span class="cx">         if (!entry->m_redirectRequest->decodeWithoutPlatformData(decoder))
</span><span class="cx">             return nullptr;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (!decoder.decode(entry->m_maxAgeCap))
</del><ins>+    Optional<Optional<Seconds>> maxAgeCap;
+    decoder >> maxAgeCap;
+    if (!maxAgeCap)
</ins><span class="cx">         return nullptr;
</span><ins>+    entry->m_maxAgeCap = WTFMove(*maxAgeCap);
</ins><span class="cx"> 
</span><span class="cx">     if (!decoder.verifyChecksum()) {
</span><span class="cx">         LOG(NetworkCache, "(NetworkProcess) checksum verification failure\n");
</span></span></pre></div>
<a id="trunkSourceWebKitNetworkProcesscacheNetworkCacheKeycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheKey.cpp (259921 => 259922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheKey.cpp     2020-04-11 05:17:24 UTC (rev 259921)
+++ trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheKey.cpp        2020-04-11 06:39:36 UTC (rev 259922)
</span><span class="lines">@@ -173,9 +173,47 @@
</span><span class="cx">     encoder << m_partitionHash;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool Key::decode(WTF::Persistence::Decoder& decoder, Key& key)
</del><ins>+Optional<Key> Key::decode(WTF::Persistence::Decoder& decoder)
</ins><span class="cx"> {
</span><del>-    return decoder.decode(key.m_partition) && decoder.decode(key.m_type) && decoder.decode(key.m_identifier) && decoder.decode(key.m_range) && decoder.decode(key.m_hash) && decoder.decode(key.m_partitionHash);
</del><ins>+    Key key;
+    
+    Optional<String> partition;
+    decoder >> partition;
+    if (!partition)
+        return WTF::nullopt;
+    key.m_partition = WTFMove(*partition);
+
+    Optional<String> type;
+    decoder >> type;
+    if (!type)
+        return WTF::nullopt;
+    key.m_type = WTFMove(*type);
+
+    Optional<String> identifier;
+    decoder >> identifier;
+    if (!identifier)
+        return WTF::nullopt;
+    key.m_identifier = WTFMove(*identifier);
+
+    Optional<String> range;
+    decoder >> range;
+    if (!range)
+        return WTF::nullopt;
+    key.m_range = WTFMove(*range);
+
+    Optional<HashType> hash;
+    decoder >> hash;
+    if (!hash)
+        return WTF::nullopt;
+    key.m_hash = WTFMove(*hash);
+
+    Optional<HashType> partitionHash;
+    decoder >> partitionHash;
+    if (!partitionHash)
+        return WTF::nullopt;
+    key.m_partitionHash = WTFMove(*partitionHash);
+
+    return { WTFMove(key) };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKitNetworkProcesscacheNetworkCacheKeyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheKey.h (259921 => 259922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheKey.h       2020-04-11 05:17:24 UTC (rev 259921)
+++ trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheKey.h  2020-04-11 06:39:36 UTC (rev 259922)
</span><span class="lines">@@ -83,7 +83,7 @@
</span><span class="cx">     String partitionHashAsString() const { return hashAsString(m_partitionHash); }
</span><span class="cx"> 
</span><span class="cx">     void encode(WTF::Persistence::Encoder&) const;
</span><del>-    static bool decode(WTF::Persistence::Decoder&, Key&);
</del><ins>+    static Optional<Key> decode(WTF::Persistence::Decoder&);
</ins><span class="cx"> 
</span><span class="cx">     bool operator==(const Key&) const;
</span><span class="cx">     bool operator!=(const Key& other) const { return !(*this == other); }
</span></span></pre></div>
<a id="trunkSourceWebKitNetworkProcesscacheNetworkCacheStoragecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheStorage.cpp (259921 => 259922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheStorage.cpp 2020-04-11 05:17:24 UTC (rev 259921)
+++ trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheStorage.cpp    2020-04-11 06:39:36 UTC (rev 259922)
</span><span class="lines">@@ -438,24 +438,58 @@
</span><span class="cx">     bool success = false;
</span><span class="cx">     fileData.apply([&metaData, &success](const uint8_t* data, size_t size) {
</span><span class="cx">         WTF::Persistence::Decoder decoder(data, size);
</span><del>-        if (!decoder.decode(metaData.cacheStorageVersion))
</del><ins>+        
+        Optional<unsigned> cacheStorageVersion;
+        decoder >> cacheStorageVersion;
+        if (!cacheStorageVersion)
</ins><span class="cx">             return false;
</span><del>-        if (!decoder.decode(metaData.key))
</del><ins>+        metaData.cacheStorageVersion = WTFMove(*cacheStorageVersion);
+
+        Optional<Key> key;
+        decoder >> key;
+        if (!key)
</ins><span class="cx">             return false;
</span><del>-        if (!decoder.decode(metaData.timeStamp))
</del><ins>+        metaData.key = WTFMove(*key);
+
+        Optional<WallTime> timeStamp;
+        decoder >> timeStamp;
+        if (!timeStamp)
</ins><span class="cx">             return false;
</span><del>-        if (!decoder.decode(metaData.headerHash))
</del><ins>+        metaData.timeStamp = WTFMove(*timeStamp);
+
+        Optional<SHA1::Digest> headerHash;
+        decoder >> headerHash;
+        if (!headerHash)
</ins><span class="cx">             return false;
</span><del>-        if (!decoder.decode(metaData.headerSize))
</del><ins>+        metaData.headerHash = WTFMove(*headerHash);
+
+        Optional<uint64_t> headerSize;
+        decoder >> headerSize;
+        if (!headerSize)
</ins><span class="cx">             return false;
</span><del>-        if (!decoder.decode(metaData.bodyHash))
</del><ins>+        metaData.headerSize = WTFMove(*headerSize);
+
+        Optional<SHA1::Digest> bodyHash;
+        decoder >> bodyHash;
+        if (!bodyHash)
</ins><span class="cx">             return false;
</span><del>-        if (!decoder.decode(metaData.bodySize))
</del><ins>+        metaData.bodyHash = WTFMove(*bodyHash);
+
+        Optional<uint64_t> bodySize;
+        decoder >> bodySize;
+        if (!bodySize)
</ins><span class="cx">             return false;
</span><del>-        if (!decoder.decode(metaData.isBodyInline))
</del><ins>+        metaData.bodySize = WTFMove(*bodySize);
+
+        Optional<bool> isBodyInline;
+        decoder >> isBodyInline;
+        if (!isBodyInline)
</ins><span class="cx">             return false;
</span><ins>+        metaData.isBodyInline = WTFMove(*isBodyInline);
+
</ins><span class="cx">         if (!decoder.verifyChecksum())
</span><span class="cx">             return false;
</span><ins>+
</ins><span class="cx">         metaData.headerOffset = decoder.currentOffset();
</span><span class="cx">         success = true;
</span><span class="cx">         return false;
</span></span></pre></div>
<a id="trunkSourceWebKitNetworkProcesscacheNetworkCacheSubresourcesEntrycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheSubresourcesEntry.cpp (259921 => 259922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheSubresourcesEntry.cpp       2020-04-11 05:17:24 UTC (rev 259921)
+++ trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheSubresourcesEntry.cpp  2020-04-11 06:39:36 UTC (rev 259922)
</span><span class="lines">@@ -49,37 +49,65 @@
</span><span class="cx">     encoder << m_isSameSite;
</span><span class="cx">     encoder << m_firstPartyForCookies;
</span><span class="cx">     encoder << m_requestHeaders;
</span><del>-    encoder.encodeEnum(m_priority);
</del><ins>+    encoder << m_priority;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool SubresourceInfo::decode(WTF::Persistence::Decoder& decoder, SubresourceInfo& info)
</del><ins>+Optional<SubresourceInfo> SubresourceInfo::decode(WTF::Persistence::Decoder& decoder)
</ins><span class="cx"> {
</span><del>-    if (!decoder.decode(info.m_key))
-        return false;
-    if (!decoder.decode(info.m_lastSeen))
-        return false;
-    if (!decoder.decode(info.m_firstSeen))
-        return false;
-    
-    if (!decoder.decode(info.m_isTransient))
-        return false;
-    
</del><ins>+    SubresourceInfo info;
+
+    Optional<Key> key;
+    decoder >> key;
+    if (!key)
+        return WTF::nullopt;
+    info.m_key = WTFMove(*key);
+
+    Optional<WallTime> lastSeen;
+    decoder >> lastSeen;
+    if (!lastSeen)
+        return WTF::nullopt;
+    info.m_lastSeen = WTFMove(*lastSeen);
+
+    Optional<WallTime> firstSeen;
+    decoder >> firstSeen;
+    if (!firstSeen)
+        return WTF::nullopt;
+    info.m_firstSeen = WTFMove(*firstSeen);
+
+    Optional<bool> isTransient;
+    decoder >> isTransient;
+    if (!isTransient)
+        return WTF::nullopt;
+    info.m_isTransient = WTFMove(*isTransient);
+
</ins><span class="cx">     if (info.m_isTransient)
</span><del>-        return true;
</del><ins>+        return { WTFMove(info) };
</ins><span class="cx"> 
</span><del>-    if (!decoder.decode(info.m_isSameSite))
-        return false;
</del><ins>+    Optional<bool> isSameSite;
+    decoder >> isSameSite;
+    if (!isSameSite)
+        return WTF::nullopt;
+    info.m_isSameSite = WTFMove(*isSameSite);
</ins><span class="cx"> 
</span><del>-    if (!decoder.decode(info.m_firstPartyForCookies))
-        return false;
</del><ins>+    Optional<URL> firstPartyForCookies;
+    decoder >> firstPartyForCookies;
+    if (!firstPartyForCookies)
+        return WTF::nullopt;
+    info.m_firstPartyForCookies = WTFMove(*firstPartyForCookies);
</ins><span class="cx"> 
</span><del>-    if (!decoder.decode(info.m_requestHeaders))
-        return false;
</del><ins>+    Optional<WebCore::HTTPHeaderMap> requestHeaders;
+    decoder >> requestHeaders;
+    if (!requestHeaders)
+        return WTF::nullopt;
+    info.m_requestHeaders = WTFMove(*requestHeaders);
</ins><span class="cx"> 
</span><del>-    if (!decoder.decodeEnum(info.m_priority))
-        return false;
</del><ins>+    Optional<WebCore::ResourceLoadPriority> priority;
+    decoder >> priority;
+    if (!priority)
+        return WTF::nullopt;
+    info.m_priority = WTFMove(*priority);
</ins><span class="cx">     
</span><del>-    return true;
</del><ins>+    return { WTFMove(info) };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool SubresourceInfo::isFirstParty() const
</span><span class="lines">@@ -103,8 +131,11 @@
</span><span class="cx">     auto entry = makeUnique<SubresourcesEntry>(storageEntry);
</span><span class="cx"> 
</span><span class="cx">     WTF::Persistence::Decoder decoder(storageEntry.header.data(), storageEntry.header.size());
</span><del>-    if (!decoder.decode(entry->m_subresources))
</del><ins>+    Optional<Vector<SubresourceInfo>> subresources;
+    decoder >> subresources;
+    if (!subresources)
</ins><span class="cx">         return nullptr;
</span><ins>+    entry->m_subresources = WTFMove(*subresources);
</ins><span class="cx"> 
</span><span class="cx">     if (!decoder.verifyChecksum()) {
</span><span class="cx">         LOG(NetworkCache, "(NetworkProcess) checksum verification failure\n");
</span></span></pre></div>
<a id="trunkSourceWebKitNetworkProcesscacheNetworkCacheSubresourcesEntryh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheSubresourcesEntry.h (259921 => 259922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheSubresourcesEntry.h 2020-04-11 05:17:24 UTC (rev 259921)
+++ trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheSubresourcesEntry.h    2020-04-11 06:39:36 UTC (rev 259922)
</span><span class="lines">@@ -39,7 +39,7 @@
</span><span class="cx">     WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><span class="cx">     void encode(WTF::Persistence::Encoder&) const;
</span><del>-    static bool decode(WTF::Persistence::Decoder&, SubresourceInfo&);
</del><ins>+    static Optional<SubresourceInfo> decode(WTF::Persistence::Decoder&);
</ins><span class="cx"> 
</span><span class="cx">     SubresourceInfo() = default;
</span><span class="cx">     SubresourceInfo(const Key&, const WebCore::ResourceRequest&, const SubresourceInfo* previousInfo);
</span></span></pre></div>
<a id="trunkSourceWebKitSharedUserDatacpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/Shared/UserData.cpp (259921 => 259922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/Shared/UserData.cpp  2020-04-11 05:17:24 UTC (rev 259921)
+++ trunk/Source/WebKit/Shared/UserData.cpp     2020-04-11 06:39:36 UTC (rev 259922)
</span><span class="lines">@@ -369,10 +369,11 @@
</span><span class="cx">         break;
</span><span class="cx"> 
</span><span class="cx">     case API::Object::Type::CertificateInfo: {
</span><del>-        WebCore::CertificateInfo certificateInfo;
-        if (!decoder.decode(certificateInfo))
</del><ins>+        Optional<WebCore::CertificateInfo> certificateInfo;
+        decoder >> certificateInfo;
+        if (!certificateInfo)
</ins><span class="cx">             return false;
</span><del>-        result = WebCertificateInfo::create(certificateInfo);
</del><ins>+        result = WebCertificateInfo::create(*certificateInfo);
</ins><span class="cx">         break;
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessAPIAPIContentRuleListStorecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/API/APIContentRuleListStore.cpp (259921 => 259922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/API/APIContentRuleListStore.cpp    2020-04-11 05:17:24 UTC (rev 259921)
+++ trunk/Source/WebKit/UIProcess/API/APIContentRuleListStore.cpp       2020-04-11 06:39:36 UTC (rev 259922)
</span><span class="lines">@@ -179,20 +179,49 @@
</span><span class="cx">             return false;
</span><span class="cx"> 
</span><span class="cx">         WTF::Persistence::Decoder decoder(data, size);
</span><del>-        if (!decoder.decode(metaData.version))
</del><ins>+        
+        Optional<uint32_t> version;
+        decoder >> version;
+        if (!version)
</ins><span class="cx">             return false;
</span><del>-        if (!decoder.decode(metaData.sourceSize))
</del><ins>+        metaData.version = WTFMove(*version);
+
+        Optional<uint64_t> sourceSize;
+        decoder >> sourceSize;
+        if (!sourceSize)
</ins><span class="cx">             return false;
</span><del>-        if (!decoder.decode(metaData.actionsSize))
</del><ins>+        metaData.sourceSize = WTFMove(*sourceSize);
+
+        Optional<uint64_t> actionsSize;
+        decoder >> actionsSize;
+        if (!actionsSize)
</ins><span class="cx">             return false;
</span><del>-        if (!decoder.decode(metaData.filtersWithoutConditionsBytecodeSize))
</del><ins>+        metaData.actionsSize = WTFMove(*actionsSize);
+
+        Optional<uint64_t> filtersWithoutConditionsBytecodeSize;
+        decoder >> filtersWithoutConditionsBytecodeSize;
+        if (!filtersWithoutConditionsBytecodeSize)
</ins><span class="cx">             return false;
</span><del>-        if (!decoder.decode(metaData.filtersWithConditionsBytecodeSize))
</del><ins>+        metaData.filtersWithoutConditionsBytecodeSize = WTFMove(*filtersWithoutConditionsBytecodeSize);
+
+        Optional<uint64_t> filtersWithConditionsBytecodeSize;
+        decoder >> filtersWithConditionsBytecodeSize;
+        if (!filtersWithConditionsBytecodeSize)
</ins><span class="cx">             return false;
</span><del>-        if (!decoder.decode(metaData.conditionedFiltersBytecodeSize))
</del><ins>+        metaData.filtersWithConditionsBytecodeSize = WTFMove(*filtersWithConditionsBytecodeSize);
+
+        Optional<uint64_t> conditionedFiltersBytecodeSize;
+        decoder >> conditionedFiltersBytecodeSize;
+        if (!conditionedFiltersBytecodeSize)
</ins><span class="cx">             return false;
</span><del>-        if (!decoder.decode(metaData.conditionsApplyOnlyToDomain))
</del><ins>+        metaData.conditionedFiltersBytecodeSize = WTFMove(*conditionedFiltersBytecodeSize);
+
+        Optional<uint32_t> conditionsApplyOnlyToDomain;
+        decoder >> conditionsApplyOnlyToDomain;
+        if (!conditionsApplyOnlyToDomain)
</ins><span class="cx">             return false;
</span><ins>+        metaData.conditionsApplyOnlyToDomain = WTFMove(*conditionsApplyOnlyToDomain);
+
</ins><span class="cx">         success = true;
</span><span class="cx">         return false;
</span><span class="cx">     });
</span></span></pre>
</div>
</div>

</body>
</html>