<!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>[225826] trunk/Source/WebKit</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/225826">225826</a></dd>
<dt>Author</dt> <dd>achristensen@apple.com</dd>
<dt>Date</dt> <dd>2017-12-12 17:18:20 -0800 (Tue, 12 Dec 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>Modernize WebsiteDataStoreParameters and SandboxExtension::Handle decoding
https://bugs.webkit.org/show_bug.cgi?id=180621

Reviewed by Youenn Fablet.

* NetworkProcess/NetworkProcessCreationParameters.cpp:
(WebKit::NetworkProcessCreationParameters::decode):
* NetworkProcess/NetworkResourceLoadParameters.cpp:
(WebKit::NetworkResourceLoadParameters::decode):
* Shared/LoadParameters.cpp:
(WebKit::LoadParameters::decode):
* Shared/SandboxExtension.h:
(WebKit::decode):
(WebKit::SandboxExtension::Handle::decode): Deleted.
* Shared/Storage/StorageProcessCreationParameters.cpp:
(WebKit::StorageProcessCreationParameters::decode):
* Shared/WebProcessCreationParameters.cpp:
(WebKit::WebProcessCreationParameters::decode):
* Shared/WebsiteDataStoreParameters.cpp:
(WebKit::WebsiteDataStoreParameters::decode):
* Shared/WebsiteDataStoreParameters.h:
* Shared/mac/SandboxExtensionMac.mm:
(WebKit::SandboxExtension::Handle::decode):
(WebKit::SandboxExtension::HandleArray::HandleArray):
(WebKit::SandboxExtension::HandleArray::encode const):
(WebKit::SandboxExtension::HandleArray::decode):
(WebKit::SandboxExtension::SandboxExtension):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKitChangeLog">trunk/Source/WebKit/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitNetworkProcessNetworkProcessCreationParameterscpp">trunk/Source/WebKit/NetworkProcess/NetworkProcessCreationParameters.cpp</a></li>
<li><a href="#trunkSourceWebKitNetworkProcessNetworkResourceLoadParameterscpp">trunk/Source/WebKit/NetworkProcess/NetworkResourceLoadParameters.cpp</a></li>
<li><a href="#trunkSourceWebKitSharedLoadParameterscpp">trunk/Source/WebKit/Shared/LoadParameters.cpp</a></li>
<li><a href="#trunkSourceWebKitSharedSandboxExtensionh">trunk/Source/WebKit/Shared/SandboxExtension.h</a></li>
<li><a href="#trunkSourceWebKitSharedStorageStorageProcessCreationParameterscpp">trunk/Source/WebKit/Shared/Storage/StorageProcessCreationParameters.cpp</a></li>
<li><a href="#trunkSourceWebKitSharedWebProcessCreationParameterscpp">trunk/Source/WebKit/Shared/WebProcessCreationParameters.cpp</a></li>
<li><a href="#trunkSourceWebKitSharedWebsiteDataStoreParameterscpp">trunk/Source/WebKit/Shared/WebsiteDataStoreParameters.cpp</a></li>
<li><a href="#trunkSourceWebKitSharedWebsiteDataStoreParametersh">trunk/Source/WebKit/Shared/WebsiteDataStoreParameters.h</a></li>
<li><a href="#trunkSourceWebKitSharedmacSandboxExtensionMacmm">trunk/Source/WebKit/Shared/mac/SandboxExtensionMac.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ChangeLog (225825 => 225826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ChangeLog    2017-12-13 01:13:30 UTC (rev 225825)
+++ trunk/Source/WebKit/ChangeLog       2017-12-13 01:18:20 UTC (rev 225826)
</span><span class="lines">@@ -1,3 +1,33 @@
</span><ins>+2017-12-12  Alex Christensen  <achristensen@webkit.org>
+
+        Modernize WebsiteDataStoreParameters and SandboxExtension::Handle decoding
+        https://bugs.webkit.org/show_bug.cgi?id=180621
+
+        Reviewed by Youenn Fablet.
+
+        * NetworkProcess/NetworkProcessCreationParameters.cpp:
+        (WebKit::NetworkProcessCreationParameters::decode):
+        * NetworkProcess/NetworkResourceLoadParameters.cpp:
+        (WebKit::NetworkResourceLoadParameters::decode):
+        * Shared/LoadParameters.cpp:
+        (WebKit::LoadParameters::decode):
+        * Shared/SandboxExtension.h:
+        (WebKit::decode):
+        (WebKit::SandboxExtension::Handle::decode): Deleted.
+        * Shared/Storage/StorageProcessCreationParameters.cpp:
+        (WebKit::StorageProcessCreationParameters::decode):
+        * Shared/WebProcessCreationParameters.cpp:
+        (WebKit::WebProcessCreationParameters::decode):
+        * Shared/WebsiteDataStoreParameters.cpp:
+        (WebKit::WebsiteDataStoreParameters::decode):
+        * Shared/WebsiteDataStoreParameters.h:
+        * Shared/mac/SandboxExtensionMac.mm:
+        (WebKit::SandboxExtension::Handle::decode):
+        (WebKit::SandboxExtension::HandleArray::HandleArray):
+        (WebKit::SandboxExtension::HandleArray::encode const):
+        (WebKit::SandboxExtension::HandleArray::decode):
+        (WebKit::SandboxExtension::SandboxExtension):
+
</ins><span class="cx"> 2017-12-12  John Wilander  <wilander@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Dispatch resource load statistics telemetry on the main thread
</span></span></pre></div>
<a id="trunkSourceWebKitNetworkProcessNetworkProcessCreationParameterscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/NetworkProcess/NetworkProcessCreationParameters.cpp (225825 => 225826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/NetworkProcess/NetworkProcessCreationParameters.cpp  2017-12-13 01:13:30 UTC (rev 225825)
+++ trunk/Source/WebKit/NetworkProcess/NetworkProcessCreationParameters.cpp     2017-12-13 01:18:20 UTC (rev 225826)
</span><span class="lines">@@ -124,12 +124,22 @@
</span><span class="cx">         return false;
</span><span class="cx">     if (!decoder.decode(result.cacheStoragePerOriginQuota))
</span><span class="cx">         return false;
</span><del>-    if (!decoder.decode(result.cacheStorageDirectoryExtensionHandle))
</del><ins>+    
+    std::optional<SandboxExtension::Handle> cacheStorageDirectoryExtensionHandle;
+    decoder >> cacheStorageDirectoryExtensionHandle;
+    if (!cacheStorageDirectoryExtensionHandle)
</ins><span class="cx">         return false;
</span><ins>+    result.cacheStorageDirectoryExtensionHandle = WTFMove(*cacheStorageDirectoryExtensionHandle);
+
</ins><span class="cx">     if (!decoder.decode(result.diskCacheDirectory))
</span><span class="cx">         return false;
</span><del>-    if (!decoder.decode(result.diskCacheDirectoryExtensionHandle))
</del><ins>+    
+    std::optional<SandboxExtension::Handle> diskCacheDirectoryExtensionHandle;
+    decoder >> diskCacheDirectoryExtensionHandle;
+    if (!diskCacheDirectoryExtensionHandle)
</ins><span class="cx">         return false;
</span><ins>+    result.diskCacheDirectoryExtensionHandle = WTFMove(*diskCacheDirectoryExtensionHandle);
+
</ins><span class="cx">     if (!decoder.decode(result.shouldEnableNetworkCache))
</span><span class="cx">         return false;
</span><span class="cx">     if (!decoder.decode(result.shouldEnableNetworkCacheEfficacyLogging))
</span><span class="lines">@@ -143,12 +153,23 @@
</span><span class="cx">         return false;
</span><span class="cx"> #endif
</span><span class="cx"> #if PLATFORM(IOS)
</span><del>-    if (!decoder.decode(result.cookieStorageDirectoryExtensionHandle))
</del><ins>+    std::optional<SandboxExtension::Handle> cookieStorageDirectoryExtensionHandle;
+    decoder >> cookieStorageDirectoryExtensionHandle;
+    if (!cookieStorageDirectoryExtensionHandle)
</ins><span class="cx">         return false;
</span><del>-    if (!decoder.decode(result.containerCachesDirectoryExtensionHandle))
</del><ins>+    result.cookieStorageDirectoryExtensionHandle = WTFMove(*cookieStorageDirectoryExtensionHandle);
+
+    std::optional<SandboxExtension::Handle> containerCachesDirectoryExtensionHandle;
+    decoder >> containerCachesDirectoryExtensionHandle;
+    if (!containerCachesDirectoryExtensionHandle)
</ins><span class="cx">         return false;
</span><del>-    if (!decoder.decode(result.parentBundleDirectoryExtensionHandle))
</del><ins>+    result.containerCachesDirectoryExtensionHandle = WTFMove(*containerCachesDirectoryExtensionHandle);
+
+    std::optional<SandboxExtension::Handle> parentBundleDirectoryExtensionHandle;
+    decoder >> parentBundleDirectoryExtensionHandle;
+    if (!parentBundleDirectoryExtensionHandle)
</ins><span class="cx">         return false;
</span><ins>+    result.parentBundleDirectoryExtensionHandle = WTFMove(*parentBundleDirectoryExtensionHandle);
</ins><span class="cx"> #endif
</span><span class="cx">     if (!decoder.decode(result.shouldSuppressMemoryPressureHandler))
</span><span class="cx">         return false;
</span></span></pre></div>
<a id="trunkSourceWebKitNetworkProcessNetworkResourceLoadParameterscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/NetworkProcess/NetworkResourceLoadParameters.cpp (225825 => 225826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/NetworkProcess/NetworkResourceLoadParameters.cpp     2017-12-13 01:13:30 UTC (rev 225825)
+++ trunk/Source/WebKit/NetworkProcess/NetworkResourceLoadParameters.cpp        2017-12-13 01:18:20 UTC (rev 225826)
</span><span class="lines">@@ -134,10 +134,11 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (result.request.url().isLocalFile()) {
</span><del>-        SandboxExtension::Handle resourceSandboxExtensionHandle;
-        if (!decoder.decode(resourceSandboxExtensionHandle))
</del><ins>+        std::optional<SandboxExtension::Handle> resourceSandboxExtensionHandle;
+        decoder >> resourceSandboxExtensionHandle;
+        if (!resourceSandboxExtensionHandle)
</ins><span class="cx">             return false;
</span><del>-        result.resourceSandboxExtension = SandboxExtension::create(resourceSandboxExtensionHandle);
</del><ins>+        result.resourceSandboxExtension = SandboxExtension::create(WTFMove(*resourceSandboxExtensionHandle));
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (!decoder.decodeEnum(result.contentSniffingPolicy))
</span></span></pre></div>
<a id="trunkSourceWebKitSharedLoadParameterscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/Shared/LoadParameters.cpp (225825 => 225826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/Shared/LoadParameters.cpp    2017-12-13 01:13:30 UTC (rev 225825)
+++ trunk/Source/WebKit/Shared/LoadParameters.cpp       2017-12-13 01:18:20 UTC (rev 225826)
</span><span class="lines">@@ -72,8 +72,11 @@
</span><span class="cx">         data.request.setHTTPBody(WTFMove(formData));
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (!decoder.decode(data.sandboxExtensionHandle))
</del><ins>+    std::optional<SandboxExtension::Handle> sandboxExtensionHandle;
+    decoder >> sandboxExtensionHandle;
+    if (!sandboxExtensionHandle)
</ins><span class="cx">         return false;
</span><ins>+    data.sandboxExtensionHandle = WTFMove(*sandboxExtensionHandle);
</ins><span class="cx"> 
</span><span class="cx">     if (!decoder.decode(data.data))
</span><span class="cx">         return false;
</span></span></pre></div>
<a id="trunkSourceWebKitSharedSandboxExtensionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/Shared/SandboxExtension.h (225825 => 225826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/Shared/SandboxExtension.h    2017-12-13 01:13:30 UTC (rev 225825)
+++ trunk/Source/WebKit/Shared/SandboxExtension.h       2017-12-13 01:18:20 UTC (rev 225826)
</span><span class="lines">@@ -23,8 +23,7 @@
</span><span class="cx">  * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx">  */
</span><span class="cx"> 
</span><del>-#ifndef SandboxExtension_h
-#define SandboxExtension_h
</del><ins>+#pragma once
</ins><span class="cx"> 
</span><span class="cx"> #include <wtf/Forward.h>
</span><span class="cx"> #include <wtf/Noncopyable.h>
</span><span class="lines">@@ -55,13 +54,15 @@
</span><span class="cx">         Handle();
</span><span class="cx"> #if ENABLE(SANDBOX_EXTENSIONS)
</span><span class="cx">         Handle(Handle&&);
</span><ins>+        Handle& operator=(Handle&&);
</ins><span class="cx"> #else
</span><span class="cx">         Handle(Handle&&) = default;
</span><ins>+        Handle& operator=(Handle&&) = default;
</ins><span class="cx"> #endif
</span><span class="cx">         ~Handle();
</span><span class="cx"> 
</span><span class="cx">         void encode(IPC::Encoder&) const;
</span><del>-        static bool decode(IPC::Decoder&, Handle&);
</del><ins>+        static std::optional<Handle> decode(IPC::Decoder&);
</ins><span class="cx"> 
</span><span class="cx">     private:
</span><span class="cx">         friend class SandboxExtension;
</span><span class="lines">@@ -86,7 +87,7 @@
</span><span class="cx">     private:
</span><span class="cx"> #if ENABLE(SANDBOX_EXTENSIONS)
</span><span class="cx">         std::unique_ptr<Handle[]> m_data;
</span><del>-        size_t m_size;
</del><ins>+        size_t m_size { 0 };
</ins><span class="cx"> #else
</span><span class="cx">         Handle m_emptyHandle;
</span><span class="cx"> #endif
</span><span class="lines">@@ -111,7 +112,7 @@
</span><span class="cx">                      
</span><span class="cx"> #if ENABLE(SANDBOX_EXTENSIONS)
</span><span class="cx">     mutable std::unique_ptr<SandboxExtensionImpl> m_sandboxExtension;
</span><del>-    size_t m_useCount;
</del><ins>+    size_t m_useCount { 0 };
</ins><span class="cx"> #endif
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="lines">@@ -119,7 +120,7 @@
</span><span class="cx"> inline SandboxExtension::Handle::Handle() { }
</span><span class="cx"> inline SandboxExtension::Handle::~Handle() { }
</span><span class="cx"> inline void SandboxExtension::Handle::encode(IPC::Encoder&) const { }
</span><del>-inline bool SandboxExtension::Handle::decode(IPC::Decoder&, Handle&) { return true; }
</del><ins>+inline std::optional<SandboxExtension::Handle> SandboxExtension::Handle::decode(IPC::Decoder&) { return {{ }}; }
</ins><span class="cx"> inline SandboxExtension::HandleArray::HandleArray() { }
</span><span class="cx"> inline SandboxExtension::HandleArray::~HandleArray() { }
</span><span class="cx"> inline void SandboxExtension::HandleArray::allocate(size_t) { }
</span><span class="lines">@@ -149,6 +150,3 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span><del>-
-
-#endif // SandboxExtension_h
</del></span></pre></div>
<a id="trunkSourceWebKitSharedStorageStorageProcessCreationParameterscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/Shared/Storage/StorageProcessCreationParameters.cpp (225825 => 225826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/Shared/Storage/StorageProcessCreationParameters.cpp  2017-12-13 01:13:30 UTC (rev 225825)
+++ trunk/Source/WebKit/Shared/Storage/StorageProcessCreationParameters.cpp     2017-12-13 01:18:20 UTC (rev 225826)
</span><span class="lines">@@ -52,14 +52,22 @@
</span><span class="cx"> #if ENABLE(INDEXED_DATABASE)
</span><span class="cx">     if (!decoder.decode(result.indexedDatabaseDirectory))
</span><span class="cx">         return false;
</span><del>-    if (!decoder.decode(result.indexedDatabaseDirectoryExtensionHandle))
</del><ins>+
+    std::optional<SandboxExtension::Handle> indexedDatabaseDirectoryExtensionHandle;
+    decoder >> indexedDatabaseDirectoryExtensionHandle;
+    if (!indexedDatabaseDirectoryExtensionHandle)
</ins><span class="cx">         return false;
</span><ins>+    result.indexedDatabaseDirectoryExtensionHandle = WTFMove(*indexedDatabaseDirectoryExtensionHandle);
</ins><span class="cx"> #endif
</span><span class="cx"> #if ENABLE(SERVICE_WORKER)
</span><span class="cx">     if (!decoder.decode(result.serviceWorkerRegistrationDirectory))
</span><span class="cx">         return false;
</span><del>-    if (!decoder.decode(result.serviceWorkerRegistrationDirectoryExtensionHandle))
</del><ins>+    
+    std::optional<SandboxExtension::Handle> serviceWorkerRegistrationDirectoryExtensionHandle;
+    decoder >> serviceWorkerRegistrationDirectoryExtensionHandle;
+    if (!serviceWorkerRegistrationDirectoryExtensionHandle)
</ins><span class="cx">         return false;
</span><ins>+    result.serviceWorkerRegistrationDirectoryExtensionHandle = WTFMove(*serviceWorkerRegistrationDirectoryExtensionHandle);
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     return true;
</span></span></pre></div>
<a id="trunkSourceWebKitSharedWebProcessCreationParameterscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/Shared/WebProcessCreationParameters.cpp (225825 => 225826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/Shared/WebProcessCreationParameters.cpp      2017-12-13 01:13:30 UTC (rev 225825)
+++ trunk/Source/WebKit/Shared/WebProcessCreationParameters.cpp 2017-12-13 01:18:20 UTC (rev 225826)
</span><span class="lines">@@ -151,8 +151,13 @@
</span><span class="cx"> {
</span><span class="cx">     if (!decoder.decode(parameters.injectedBundlePath))
</span><span class="cx">         return false;
</span><del>-    if (!decoder.decode(parameters.injectedBundlePathExtensionHandle))
</del><ins>+    
+    std::optional<SandboxExtension::Handle> injectedBundlePathExtensionHandle;
+    decoder >> injectedBundlePathExtensionHandle;
+    if (!injectedBundlePathExtensionHandle)
</ins><span class="cx">         return false;
</span><ins>+    parameters.injectedBundlePathExtensionHandle = WTFMove(*injectedBundlePathExtensionHandle);
+
</ins><span class="cx">     if (!decoder.decode(parameters.additionalSandboxExtensionHandles))
</span><span class="cx">         return false;
</span><span class="cx">     if (!decoder.decode(parameters.initializationUserData))
</span><span class="lines">@@ -161,31 +166,64 @@
</span><span class="cx">         return false;
</span><span class="cx">     if (!decoder.decode(parameters.applicationCacheFlatFileSubdirectoryName))
</span><span class="cx">         return false;
</span><del>-    if (!decoder.decode(parameters.applicationCacheDirectoryExtensionHandle))
</del><ins>+    
+    std::optional<SandboxExtension::Handle> applicationCacheDirectoryExtensionHandle;
+    decoder >> applicationCacheDirectoryExtensionHandle;
+    if (!applicationCacheDirectoryExtensionHandle)
</ins><span class="cx">         return false;
</span><ins>+    parameters.applicationCacheDirectoryExtensionHandle = WTFMove(*applicationCacheDirectoryExtensionHandle);
+
</ins><span class="cx">     if (!decoder.decode(parameters.webSQLDatabaseDirectory))
</span><span class="cx">         return false;
</span><del>-    if (!decoder.decode(parameters.webSQLDatabaseDirectoryExtensionHandle))
</del><ins>+
+    std::optional<SandboxExtension::Handle> webSQLDatabaseDirectoryExtensionHandle;
+    decoder >> webSQLDatabaseDirectoryExtensionHandle;
+    if (!webSQLDatabaseDirectoryExtensionHandle)
</ins><span class="cx">         return false;
</span><ins>+    parameters.webSQLDatabaseDirectoryExtensionHandle = WTFMove(*webSQLDatabaseDirectoryExtensionHandle);
+
</ins><span class="cx">     if (!decoder.decode(parameters.mediaCacheDirectory))
</span><span class="cx">         return false;
</span><del>-    if (!decoder.decode(parameters.mediaCacheDirectoryExtensionHandle))
</del><ins>+    
+    std::optional<SandboxExtension::Handle> mediaCacheDirectoryExtensionHandle;
+    decoder >> mediaCacheDirectoryExtensionHandle;
+    if (!mediaCacheDirectoryExtensionHandle)
</ins><span class="cx">         return false;
</span><ins>+    parameters.mediaCacheDirectoryExtensionHandle = WTFMove(*mediaCacheDirectoryExtensionHandle);
+
</ins><span class="cx">     if (!decoder.decode(parameters.javaScriptConfigurationDirectory))
</span><span class="cx">         return false;
</span><del>-    if (!decoder.decode(parameters.javaScriptConfigurationDirectoryExtensionHandle))
</del><ins>+    
+    std::optional<SandboxExtension::Handle> javaScriptConfigurationDirectoryExtensionHandle;
+    decoder >> javaScriptConfigurationDirectoryExtensionHandle;
+    if (!javaScriptConfigurationDirectoryExtensionHandle)
</ins><span class="cx">         return false;
</span><ins>+    parameters.javaScriptConfigurationDirectoryExtensionHandle = WTFMove(*javaScriptConfigurationDirectoryExtensionHandle);
+
</ins><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx">     if (!decoder.decode(parameters.uiProcessCookieStorageIdentifier))
</span><span class="cx">         return false;
</span><span class="cx"> #endif
</span><span class="cx"> #if PLATFORM(IOS)
</span><del>-    if (!decoder.decode(parameters.cookieStorageDirectoryExtensionHandle))
</del><ins>+    
+    std::optional<SandboxExtension::Handle> cookieStorageDirectoryExtensionHandle;
+    decoder >> cookieStorageDirectoryExtensionHandle;
+    if (!cookieStorageDirectoryExtensionHandle)
</ins><span class="cx">         return false;
</span><del>-    if (!decoder.decode(parameters.containerCachesDirectoryExtensionHandle))
</del><ins>+    parameters.cookieStorageDirectoryExtensionHandle = WTFMove(*cookieStorageDirectoryExtensionHandle);
+
+    std::optional<SandboxExtension::Handle> containerCachesDirectoryExtensionHandle;
+    decoder >> containerCachesDirectoryExtensionHandle;
+    if (!containerCachesDirectoryExtensionHandle)
</ins><span class="cx">         return false;
</span><del>-    if (!decoder.decode(parameters.containerTemporaryDirectoryExtensionHandle))
</del><ins>+    parameters.containerCachesDirectoryExtensionHandle = WTFMove(*containerCachesDirectoryExtensionHandle);
+
+    std::optional<SandboxExtension::Handle> containerTemporaryDirectoryExtensionHandle;
+    decoder >> containerTemporaryDirectoryExtensionHandle;
+    if (!containerTemporaryDirectoryExtensionHandle)
</ins><span class="cx">         return false;
</span><ins>+    parameters.containerTemporaryDirectoryExtensionHandle = WTFMove(*containerTemporaryDirectoryExtensionHandle);
+
</ins><span class="cx"> #endif
</span><span class="cx">     if (!decoder.decode(parameters.mediaKeyStorageDirectory))
</span><span class="cx">         return false;
</span><span class="lines">@@ -193,11 +231,21 @@
</span><span class="cx">         return false;
</span><span class="cx">     if (!decoder.decode(parameters.webKitLoggingChannels))
</span><span class="cx">         return false;
</span><del>-    if (!decoder.decode(parameters.mediaKeyStorageDirectoryExtensionHandle))
</del><ins>+    
+    std::optional<SandboxExtension::Handle> mediaKeyStorageDirectoryExtensionHandle;
+    decoder >> mediaKeyStorageDirectoryExtensionHandle;
+    if (!mediaKeyStorageDirectoryExtensionHandle)
</ins><span class="cx">         return false;
</span><ins>+    parameters.mediaKeyStorageDirectoryExtensionHandle = WTFMove(*mediaKeyStorageDirectoryExtensionHandle);
+
</ins><span class="cx"> #if ENABLE(MEDIA_STREAM)
</span><del>-    if (!decoder.decode(parameters.audioCaptureExtensionHandle))
</del><ins>+
+    std::optional<SandboxExtension::Handle> audioCaptureExtensionHandle;
+    decoder >> audioCaptureExtensionHandle;
+    if (!audioCaptureExtensionHandle)
</ins><span class="cx">         return false;
</span><ins>+    parameters.audioCaptureExtensionHandle = WTFMove(*audioCaptureExtensionHandle);
+
</ins><span class="cx">     if (!decoder.decode(parameters.shouldCaptureAudioInUIProcess))
</span><span class="cx">         return false;
</span><span class="cx"> #endif
</span><span class="lines">@@ -260,8 +308,13 @@
</span><span class="cx">         return false;
</span><span class="cx">     if (!decoder.decode(parameters.uiProcessBundleResourcePath))
</span><span class="cx">         return false;
</span><del>-    if (!decoder.decode(parameters.uiProcessBundleResourcePathExtensionHandle))
</del><ins>+    
+    std::optional<SandboxExtension::Handle> uiProcessBundleResourcePathExtensionHandle;
+    decoder >> uiProcessBundleResourcePathExtensionHandle;
+    if (!uiProcessBundleResourcePathExtensionHandle)
</ins><span class="cx">         return false;
</span><ins>+    parameters.uiProcessBundleResourcePathExtensionHandle = WTFMove(*uiProcessBundleResourcePathExtensionHandle);
+
</ins><span class="cx">     if (!decoder.decode(parameters.shouldEnableJIT))
</span><span class="cx">         return false;
</span><span class="cx">     if (!decoder.decode(parameters.shouldEnableFTLJIT))
</span></span></pre></div>
<a id="trunkSourceWebKitSharedWebsiteDataStoreParameterscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/Shared/WebsiteDataStoreParameters.cpp (225825 => 225826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/Shared/WebsiteDataStoreParameters.cpp        2017-12-13 01:13:30 UTC (rev 225825)
+++ trunk/Source/WebKit/Shared/WebsiteDataStoreParameters.cpp   2017-12-13 01:18:20 UTC (rev 225826)
</span><span class="lines">@@ -46,36 +46,44 @@
</span><span class="cx">     encoder << cacheStorageDirectoryExtensionHandle;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool WebsiteDataStoreParameters::decode(IPC::Decoder& decoder, WebsiteDataStoreParameters& parameters)
</del><ins>+std::optional<WebsiteDataStoreParameters> WebsiteDataStoreParameters::decode(IPC::Decoder& decoder)
</ins><span class="cx"> {
</span><span class="cx">     std::optional<NetworkSessionCreationParameters> networkSessionParameters;
</span><span class="cx">     decoder >> networkSessionParameters;
</span><span class="cx">     if (!networkSessionParameters)
</span><del>-        return false;
-    parameters.networkSessionParameters = WTFMove(*networkSessionParameters);
</del><ins>+        return std::nullopt;
</ins><span class="cx"> 
</span><del>-    if (!decoder.decode(parameters.uiProcessCookieStorageIdentifier))
-        return false;
</del><ins>+    std::optional<Vector<uint8_t>> uiProcessCookieStorageIdentifier;
+    decoder >> uiProcessCookieStorageIdentifier;
+    if (!uiProcessCookieStorageIdentifier)
+        return std::nullopt;
</ins><span class="cx"> 
</span><del>-    if (!decoder.decode(parameters.cookieStoragePathExtensionHandle))
-        return false;
</del><ins>+    std::optional<SandboxExtension::Handle> cookieStoragePathExtensionHandle;
+    decoder >> cookieStoragePathExtensionHandle;
+    if (!cookieStoragePathExtensionHandle)
+        return std::nullopt;
</ins><span class="cx"> 
</span><span class="cx">     std::optional<Vector<WebCore::Cookie>> pendingCookies;
</span><span class="cx">     decoder >> pendingCookies;
</span><span class="cx">     if (!pendingCookies)
</span><del>-        return false;
-    parameters.pendingCookies = WTFMove(*pendingCookies);
</del><ins>+        return std::nullopt;
</ins><span class="cx"> 
</span><del>-    if (!decoder.decode(parameters.cacheStorageDirectory))
-        return false;
</del><ins>+    std::optional<String> cacheStorageDirectory;
+    decoder >> cacheStorageDirectory;
+    if (!cacheStorageDirectory)
+        return std::nullopt;
</ins><span class="cx"> 
</span><del>-    if (!decoder.decode(parameters.cacheStoragePerOriginQuota))
-        return false;
</del><ins>+    std::optional<uint64_t> cacheStoragePerOriginQuota;
+    decoder >> cacheStoragePerOriginQuota;
+    if (!cacheStoragePerOriginQuota)
+        return std::nullopt;
</ins><span class="cx"> 
</span><del>-    if (!decoder.decode(parameters.cacheStorageDirectoryExtensionHandle))
-        return false;
-
-    return true;
</del><ins>+    std::optional<SandboxExtension::Handle> cacheStorageDirectoryExtensionHandle;
+    decoder >> cacheStorageDirectoryExtensionHandle;
+    if (!cacheStorageDirectoryExtensionHandle)
+        return std::nullopt;
+    
+    return {{ WTFMove(*uiProcessCookieStorageIdentifier), WTFMove(*cookieStoragePathExtensionHandle), WTFMove(*pendingCookies), WTFMove(*cacheStorageDirectory), WTFMove(*cacheStoragePerOriginQuota), WTFMove(*cacheStorageDirectoryExtensionHandle), WTFMove(*networkSessionParameters)}};
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> WebsiteDataStoreParameters WebsiteDataStoreParameters::legacyPrivateSessionParameters()
</span></span></pre></div>
<a id="trunkSourceWebKitSharedWebsiteDataStoreParametersh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/Shared/WebsiteDataStoreParameters.h (225825 => 225826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/Shared/WebsiteDataStoreParameters.h  2017-12-13 01:13:30 UTC (rev 225825)
+++ trunk/Source/WebKit/Shared/WebsiteDataStoreParameters.h     2017-12-13 01:18:20 UTC (rev 225826)
</span><span class="lines">@@ -42,11 +42,12 @@
</span><span class="cx"> struct WebsiteDataStoreParameters {
</span><span class="cx">     WebsiteDataStoreParameters() = default;
</span><span class="cx">     WebsiteDataStoreParameters(WebsiteDataStoreParameters&&) = default;
</span><ins>+    WebsiteDataStoreParameters& operator=(WebsiteDataStoreParameters&&) = default;
</ins><span class="cx">     ~WebsiteDataStoreParameters();
</span><span class="cx">     static WebsiteDataStoreParameters legacyPrivateSessionParameters();
</span><span class="cx">     
</span><span class="cx">     void encode(IPC::Encoder&) const;
</span><del>-    static bool decode(IPC::Decoder&, WebsiteDataStoreParameters&);
</del><ins>+    static std::optional<WebsiteDataStoreParameters> decode(IPC::Decoder&);
</ins><span class="cx"> 
</span><span class="cx">     Vector<uint8_t> uiProcessCookieStorageIdentifier;
</span><span class="cx">     SandboxExtension::Handle cookieStoragePathExtensionHandle;
</span></span></pre></div>
<a id="trunkSourceWebKitSharedmacSandboxExtensionMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/Shared/mac/SandboxExtensionMac.mm (225825 => 225826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/Shared/mac/SandboxExtensionMac.mm    2017-12-13 01:13:30 UTC (rev 225825)
+++ trunk/Source/WebKit/Shared/mac/SandboxExtensionMac.mm       2017-12-13 01:18:20 UTC (rev 225826)
</span><span class="lines">@@ -111,6 +111,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> SandboxExtension::Handle::Handle(Handle&&) = default;
</span><ins>+SandboxExtension::Handle& SandboxExtension::Handle::operator=(Handle&&) = default;
</ins><span class="cx"> 
</span><span class="cx"> SandboxExtension::Handle::~Handle()
</span><span class="cx"> {
</span><span class="lines">@@ -135,23 +136,21 @@
</span><span class="cx">     m_sandboxExtension = 0;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool SandboxExtension::Handle::decode(IPC::Decoder& decoder, Handle& result)
</del><ins>+auto SandboxExtension::Handle::decode(IPC::Decoder& decoder) -> std::optional<Handle>
</ins><span class="cx"> {
</span><del>-    ASSERT(!result.m_sandboxExtension);
-
</del><span class="cx">     IPC::DataReference dataReference;
</span><span class="cx">     if (!decoder.decode(dataReference))
</span><del>-        return false;
</del><ins>+        return std::nullopt;
</ins><span class="cx"> 
</span><span class="cx">     if (dataReference.isEmpty())
</span><del>-        return true;
</del><ins>+        return {{ }};
</ins><span class="cx"> 
</span><del>-    result.m_sandboxExtension = std::make_unique<SandboxExtensionImpl>(reinterpret_cast<const char*>(dataReference.data()), dataReference.size());
-    return true;
</del><ins>+    Handle handle;
+    handle.m_sandboxExtension = std::make_unique<SandboxExtensionImpl>(reinterpret_cast<const char*>(dataReference.data()), dataReference.size());
+    return WTFMove(handle);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> SandboxExtension::HandleArray::HandleArray()
</span><del>-    : m_size(0)
</del><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -192,7 +191,6 @@
</span><span class="cx">     encoder << static_cast<uint64_t>(size());
</span><span class="cx">     for (size_t i = 0; i < m_size; ++i)
</span><span class="cx">         encoder << m_data[i];
</span><del>-    
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool SandboxExtension::HandleArray::decode(IPC::Decoder& decoder, SandboxExtension::HandleArray& handles)
</span><span class="lines">@@ -202,8 +200,11 @@
</span><span class="cx">         return false;
</span><span class="cx">     handles.allocate(size);
</span><span class="cx">     for (size_t i = 0; i < size; i++) {
</span><del>-        if (!decoder.decode(handles[i]))
</del><ins>+        std::optional<SandboxExtension::Handle> handle;
+        decoder >> handle;
+        if (!handle)
</ins><span class="cx">             return false;
</span><ins>+        handles[i] = WTFMove(*handle);
</ins><span class="cx">     }
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="lines">@@ -362,7 +363,6 @@
</span><span class="cx"> 
</span><span class="cx"> SandboxExtension::SandboxExtension(const Handle& handle)
</span><span class="cx">     : m_sandboxExtension(WTFMove(handle.m_sandboxExtension))
</span><del>-    , m_useCount(0)
</del><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>