Title: [258269] trunk/Source/WebKit
Revision
258269
Author
[email protected]
Date
2020-03-11 10:42:39 -0700 (Wed, 11 Mar 2020)

Log Message

Introduce ResourceLoadStatisticsParameters and move members from NetworkSessionCreationParameters
https://bugs.webkit.org/show_bug.cgi?id=208895

Patch by Alex Christensen <[email protected]> on 2020-03-11
Reviewed by Youenn Fablet.

No change in behavior yet, but this will help us organize things better.

* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::initializeNetworkProcess):
* NetworkProcess/NetworkSession.cpp:
(WebKit::NetworkSession::NetworkSession):
* NetworkProcess/NetworkSessionCreationParameters.cpp:
(WebKit::NetworkSessionCreationParameters::encode const):
(WebKit::NetworkSessionCreationParameters::decode):
* NetworkProcess/NetworkSessionCreationParameters.h:
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
* Shared/ResourceLoadStatisticsParameters.h: Added.
(WebKit::ResourceLoadStatisticsParameters::encode const):
(WebKit::ResourceLoadStatisticsParameters::decode):
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::ensureNetworkProcess):
* UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
(WebKit::WebsiteDataStore::parameters):
* WebKit.xcodeproj/project.pbxproj:

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (258268 => 258269)


--- trunk/Source/WebKit/ChangeLog	2020-03-11 17:30:48 UTC (rev 258268)
+++ trunk/Source/WebKit/ChangeLog	2020-03-11 17:42:39 UTC (rev 258269)
@@ -1,3 +1,31 @@
+2020-03-11  Alex Christensen  <[email protected]>
+
+        Introduce ResourceLoadStatisticsParameters and move members from NetworkSessionCreationParameters
+        https://bugs.webkit.org/show_bug.cgi?id=208895
+
+        Reviewed by Youenn Fablet.
+
+        No change in behavior yet, but this will help us organize things better.
+
+        * NetworkProcess/NetworkProcess.cpp:
+        (WebKit::NetworkProcess::initializeNetworkProcess):
+        * NetworkProcess/NetworkSession.cpp:
+        (WebKit::NetworkSession::NetworkSession):
+        * NetworkProcess/NetworkSessionCreationParameters.cpp:
+        (WebKit::NetworkSessionCreationParameters::encode const):
+        (WebKit::NetworkSessionCreationParameters::decode):
+        * NetworkProcess/NetworkSessionCreationParameters.h:
+        * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
+        (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
+        * Shared/ResourceLoadStatisticsParameters.h: Added.
+        (WebKit::ResourceLoadStatisticsParameters::encode const):
+        (WebKit::ResourceLoadStatisticsParameters::decode):
+        * UIProcess/WebProcessPool.cpp:
+        (WebKit::WebProcessPool::ensureNetworkProcess):
+        * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
+        (WebKit::WebsiteDataStore::parameters):
+        * WebKit.xcodeproj/project.pbxproj:
+
 2020-03-11  Chris Dumez  <[email protected]>
 
         Defer async scripts until DOMContentLoaded or first paint, whichever comes first

Modified: trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp (258268 => 258269)


--- trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp	2020-03-11 17:30:48 UTC (rev 258268)
+++ trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp	2020-03-11 17:42:39 UTC (rev 258269)
@@ -333,7 +333,7 @@
 
     WebCore::RuntimeEnabledFeatures::sharedFeatures().setAdClickAttributionDebugModeEnabled(parameters.enableAdClickAttributionDebugMode);
 
-    SandboxExtension::consumePermanently(parameters.defaultDataStoreParameters.networkSessionParameters.resourceLoadStatisticsDirectoryExtensionHandle);
+    SandboxExtension::consumePermanently(parameters.defaultDataStoreParameters.networkSessionParameters.resourceLoadStatisticsParameters.directoryExtensionHandle);
 
     auto sessionID = parameters.defaultDataStoreParameters.networkSessionParameters.sessionID;
     setSession(sessionID, NetworkSession::create(*this, WTFMove(parameters.defaultDataStoreParameters.networkSessionParameters)));

Modified: trunk/Source/WebKit/NetworkProcess/NetworkSession.cpp (258268 => 258269)


--- trunk/Source/WebKit/NetworkProcess/NetworkSession.cpp	2020-03-11 17:30:48 UTC (rev 258268)
+++ trunk/Source/WebKit/NetworkProcess/NetworkSession.cpp	2020-03-11 17:42:39 UTC (rev 258269)
@@ -80,7 +80,7 @@
     : m_sessionID(parameters.sessionID)
     , m_networkProcess(networkProcess)
 #if ENABLE(RESOURCE_LOAD_STATISTICS)
-    , m_enableResourceLoadStatisticsLogTestingEvent(parameters.enableResourceLoadStatisticsLogTestingEvent)
+    , m_enableResourceLoadStatisticsLogTestingEvent(parameters.resourceLoadStatisticsParameters.enableLogTestingEvent)
 #endif
     , m_adClickAttribution(makeUniqueRef<AdClickAttributionManager>(parameters.sessionID))
     , m_testSpeedMultiplier(parameters.testSpeedMultiplier)
@@ -105,8 +105,8 @@
                 RELEASE_LOG_ERROR(NetworkCache, "Failed to initialize the WebKit network disk cache");
         }
 
-        if (!parameters.resourceLoadStatisticsDirectory.isEmpty())
-            SandboxExtension::consumePermanently(parameters.resourceLoadStatisticsDirectoryExtensionHandle);
+        if (!parameters.resourceLoadStatisticsParameters.directory.isEmpty())
+            SandboxExtension::consumePermanently(parameters.resourceLoadStatisticsParameters.directoryExtensionHandle);
     }
 
     m_isStaleWhileRevalidateEnabled = parameters.staleWhileRevalidateEnabled;

Modified: trunk/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.cpp (258268 => 258269)


--- trunk/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.cpp	2020-03-11 17:30:48 UTC (rev 258268)
+++ trunk/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.cpp	2020-03-11 17:42:39 UTC (rev 258269)
@@ -64,19 +64,6 @@
     encoder << cookiePersistentStorageFile;
     encoder << proxySettings;
 #endif
-    encoder << resourceLoadStatisticsDirectory;
-    encoder << resourceLoadStatisticsDirectoryExtensionHandle;
-    encoder << enableResourceLoadStatistics;
-    encoder << isItpStateExplicitlySet;
-    encoder << enableResourceLoadStatisticsLogTestingEvent;
-    encoder << shouldIncludeLocalhostInResourceLoadStatistics;
-    encoder << enableResourceLoadStatisticsDebugMode;
-    encoder << resourceLoadStatisticsManualPrevalentResource;
-#if ENABLE(RESOURCE_LOAD_STATISTICS)
-    encoder << thirdPartyCookieBlockingMode;
-#endif
-    encoder << firstPartyWebsiteDataRemovalMode;
-
     encoder << networkCacheDirectory << networkCacheDirectoryExtensionHandle;
 
     encoder << deviceManagementRestrictionsEnabled;
@@ -90,6 +77,7 @@
     encoder << suppressesConnectionTerminationOnSystemChange;
     encoder << allowsServerPreconnect;
     encoder << isInAppBrowserPrivacyEnabled;
+    encoder << resourceLoadStatisticsParameters;
 }
 
 Optional<NetworkSessionCreationParameters> NetworkSessionCreationParameters::decode(IPC::Decoder& decoder)
@@ -181,58 +169,6 @@
         return WTF::nullopt;
 #endif
 
-    Optional<String> resourceLoadStatisticsDirectory;
-    decoder >> resourceLoadStatisticsDirectory;
-    if (!resourceLoadStatisticsDirectory)
-        return WTF::nullopt;
-
-    Optional<SandboxExtension::Handle> resourceLoadStatisticsDirectoryExtensionHandle;
-    decoder >> resourceLoadStatisticsDirectoryExtensionHandle;
-    if (!resourceLoadStatisticsDirectoryExtensionHandle)
-        return WTF::nullopt;
-
-    Optional<bool> enableResourceLoadStatistics;
-    decoder >> enableResourceLoadStatistics;
-    if (!enableResourceLoadStatistics)
-        return WTF::nullopt;
-
-    Optional<bool> isItpStateExplicitlySet;
-    decoder >> isItpStateExplicitlySet;
-    if (!isItpStateExplicitlySet)
-        return WTF::nullopt;
-
-    Optional<bool> enableResourceLoadStatisticsLogTestingEvent;
-    decoder >> enableResourceLoadStatisticsLogTestingEvent;
-    if (!enableResourceLoadStatisticsLogTestingEvent)
-        return WTF::nullopt;
-
-    Optional<bool> shouldIncludeLocalhostInResourceLoadStatistics;
-    decoder >> shouldIncludeLocalhostInResourceLoadStatistics;
-    if (!shouldIncludeLocalhostInResourceLoadStatistics)
-        return WTF::nullopt;
-
-    Optional<bool> enableResourceLoadStatisticsDebugMode;
-    decoder >> enableResourceLoadStatisticsDebugMode;
-    if (!enableResourceLoadStatisticsDebugMode)
-        return WTF::nullopt;
-
-    Optional<WebCore::RegistrableDomain> resourceLoadStatisticsManualPrevalentResource;
-    decoder >> resourceLoadStatisticsManualPrevalentResource;
-    if (!resourceLoadStatisticsManualPrevalentResource)
-        return WTF::nullopt;
-
-#if ENABLE(RESOURCE_LOAD_STATISTICS)
-    Optional<WebCore::ThirdPartyCookieBlockingMode> thirdPartyCookieBlockingMode;
-    decoder >> thirdPartyCookieBlockingMode;
-    if (!thirdPartyCookieBlockingMode)
-        return WTF::nullopt;
-#endif
-
-    Optional<WebCore::FirstPartyWebsiteDataRemovalMode> firstPartyWebsiteDataRemovalMode;
-    decoder >> firstPartyWebsiteDataRemovalMode;
-    if (!firstPartyWebsiteDataRemovalMode)
-        return WTF::nullopt;
-
     Optional<String> networkCacheDirectory;
     decoder >> networkCacheDirectory;
     if (!networkCacheDirectory)
@@ -298,6 +234,11 @@
     if (!isInAppBrowserPrivacyEnabled)
         return WTF::nullopt;
 
+    Optional<ResourceLoadStatisticsParameters> resourceLoadStatisticsParameters;
+    decoder >> resourceLoadStatisticsParameters;
+    if (!resourceLoadStatisticsParameters)
+        return WTF::nullopt;
+    
     return {{
         *sessionID
         , WTFMove(*boundInterfaceIdentifier)
@@ -323,20 +264,8 @@
         , WTFMove(*cookiePersistentStorageFile)
         , WTFMove(*proxySettings)
 #endif
-        , WTFMove(*resourceLoadStatisticsDirectory)
-        , WTFMove(*resourceLoadStatisticsDirectoryExtensionHandle)
-        , WTFMove(*enableResourceLoadStatistics)
-        , WTFMove(*isItpStateExplicitlySet)
-        , WTFMove(*enableResourceLoadStatisticsLogTestingEvent)
-        , WTFMove(*shouldIncludeLocalhostInResourceLoadStatistics)
-        , WTFMove(*enableResourceLoadStatisticsDebugMode)
-#if ENABLE(RESOURCE_LOAD_STATISTICS)
-        , WTFMove(*thirdPartyCookieBlockingMode)
-#endif
-        , WTFMove(*firstPartyWebsiteDataRemovalMode)
         , WTFMove(*deviceManagementRestrictionsEnabled)
         , WTFMove(*allLoadsBlockedByDeviceManagementRestrictionsForTesting)
-        , WTFMove(*resourceLoadStatisticsManualPrevalentResource)
         , WTFMove(*networkCacheDirectory)
         , WTFMove(*networkCacheDirectoryExtensionHandle)
         , WTFMove(*dataConnectionServiceType)
@@ -348,6 +277,7 @@
         , WTFMove(*suppressesConnectionTerminationOnSystemChange)
         , WTFMove(*allowsServerPreconnect)
         , WTFMove(*isInAppBrowserPrivacyEnabled)
+        , WTFMove(*resourceLoadStatisticsParameters)
     }};
 }
 

Modified: trunk/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.h (258268 => 258269)


--- trunk/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.h	2020-03-11 17:30:48 UTC (rev 258268)
+++ trunk/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.h	2020-03-11 17:42:39 UTC (rev 258269)
@@ -25,13 +25,11 @@
 
 #pragma once
 
-#include "SandboxExtension.h"
+#include "ResourceLoadStatisticsParameters.h"
 #include <WebCore/NetworkStorageSession.h>
-#include <WebCore/RegistrableDomain.h>
 #include <pal/SessionID.h>
 #include <wtf/Seconds.h>
 #include <wtf/URL.h>
-#include <wtf/text/WTFString.h>
 
 #if USE(SOUP)
 #include "SoupCookiePersistentStorageType.h"
@@ -41,11 +39,6 @@
 #include <WebCore/CurlProxySettings.h>
 #endif
 
-namespace IPC {
-class Encoder;
-class Decoder;
-}
-
 #if PLATFORM(COCOA)
 extern "C" CFStringRef const WebKit2HTTPProxyDefaultsKey;
 extern "C" CFStringRef const WebKit2HTTPSProxyDefaultsKey;
@@ -83,20 +76,8 @@
     String cookiePersistentStorageFile;
     WebCore::CurlProxySettings proxySettings;
 #endif
-    String resourceLoadStatisticsDirectory;
-    SandboxExtension::Handle resourceLoadStatisticsDirectoryExtensionHandle;
-    bool enableResourceLoadStatistics { false };
-    bool isItpStateExplicitlySet { false };
-    bool enableResourceLoadStatisticsLogTestingEvent { false };
-    bool shouldIncludeLocalhostInResourceLoadStatistics { true };
-    bool enableResourceLoadStatisticsDebugMode { false };
-#if ENABLE(RESOURCE_LOAD_STATISTICS)
-    WebCore::ThirdPartyCookieBlockingMode thirdPartyCookieBlockingMode { WebCore::ThirdPartyCookieBlockingMode::All };
-#endif
-    WebCore::FirstPartyWebsiteDataRemovalMode firstPartyWebsiteDataRemovalMode { WebCore::FirstPartyWebsiteDataRemovalMode::AllButCookies };
     bool deviceManagementRestrictionsEnabled { false };
     bool allLoadsBlockedByDeviceManagementRestrictionsForTesting { false };
-    WebCore::RegistrableDomain resourceLoadStatisticsManualPrevalentResource { };
 
     String networkCacheDirectory;
     SandboxExtension::Handle networkCacheDirectoryExtensionHandle;
@@ -109,6 +90,8 @@
     bool suppressesConnectionTerminationOnSystemChange { false };
     bool allowsServerPreconnect { true };
     bool isInAppBrowserPrivacyEnabled { false };
+    
+    ResourceLoadStatisticsParameters resourceLoadStatisticsParameters;
 };
 
 } // namespace WebKit

Modified: trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm (258268 => 258269)


--- trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm	2020-03-11 17:30:48 UTC (rev 258268)
+++ trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm	2020-03-11 17:42:39 UTC (rev 258269)
@@ -1167,13 +1167,13 @@
     m_allLoadsBlockedByDeviceManagementRestrictionsForTesting = parameters.allLoadsBlockedByDeviceManagementRestrictionsForTesting;
 
 #if ENABLE(RESOURCE_LOAD_STATISTICS)
-    m_resourceLoadStatisticsDirectory = parameters.resourceLoadStatisticsDirectory;
-    m_shouldIncludeLocalhostInResourceLoadStatistics = parameters.shouldIncludeLocalhostInResourceLoadStatistics ? ShouldIncludeLocalhost::Yes : ShouldIncludeLocalhost::No;
-    m_enableResourceLoadStatisticsDebugMode = parameters.enableResourceLoadStatisticsDebugMode ? EnableResourceLoadStatisticsDebugMode::Yes : EnableResourceLoadStatisticsDebugMode::No;
-    m_resourceLoadStatisticsManualPrevalentResource = parameters.resourceLoadStatisticsManualPrevalentResource;
-    m_thirdPartyCookieBlockingMode = parameters.thirdPartyCookieBlockingMode;
-    m_firstPartyWebsiteDataRemovalMode = parameters.firstPartyWebsiteDataRemovalMode;
-    setResourceLoadStatisticsEnabled(parameters.enableResourceLoadStatistics);
+    m_resourceLoadStatisticsDirectory = WTFMove(parameters.resourceLoadStatisticsParameters.directory);
+    m_shouldIncludeLocalhostInResourceLoadStatistics = parameters.resourceLoadStatisticsParameters.shouldIncludeLocalhost ? ShouldIncludeLocalhost::Yes : ShouldIncludeLocalhost::No;
+    m_enableResourceLoadStatisticsDebugMode = parameters.resourceLoadStatisticsParameters.enableDebugMode ? EnableResourceLoadStatisticsDebugMode::Yes : EnableResourceLoadStatisticsDebugMode::No;
+    m_resourceLoadStatisticsManualPrevalentResource = parameters.resourceLoadStatisticsParameters.manualPrevalentResource;
+    m_thirdPartyCookieBlockingMode = parameters.resourceLoadStatisticsParameters.thirdPartyCookieBlockingMode;
+    m_firstPartyWebsiteDataRemovalMode = parameters.resourceLoadStatisticsParameters.firstPartyWebsiteDataRemovalMode;
+    setResourceLoadStatisticsEnabled(parameters.resourceLoadStatisticsParameters.enabled);
 #endif
 
 #if HAVE(SESSION_CLEANUP)

Added: trunk/Source/WebKit/Shared/ResourceLoadStatisticsParameters.h (0 => 258269)


--- trunk/Source/WebKit/Shared/ResourceLoadStatisticsParameters.h	                        (rev 0)
+++ trunk/Source/WebKit/Shared/ResourceLoadStatisticsParameters.h	2020-03-11 17:42:39 UTC (rev 258269)
@@ -0,0 +1,138 @@
+/*
+ * Copyright (C) 2020 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "ArgumentCoders.h"
+#include "SandboxExtension.h"
+#include <WebCore/NetworkStorageSession.h>
+#include <WebCore/RegistrableDomain.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebKit {
+
+struct ResourceLoadStatisticsParameters {
+
+    String directory;
+    SandboxExtension::Handle directoryExtensionHandle;
+    bool enabled { false };
+    bool isItpStateExplicitlySet { false };
+    bool enableLogTestingEvent { false };
+    bool shouldIncludeLocalhost { true };
+    bool enableDebugMode { false };
+#if ENABLE(RESOURCE_LOAD_STATISTICS)
+    WebCore::ThirdPartyCookieBlockingMode thirdPartyCookieBlockingMode { WebCore::ThirdPartyCookieBlockingMode::All };
+#endif
+    WebCore::FirstPartyWebsiteDataRemovalMode firstPartyWebsiteDataRemovalMode { WebCore::FirstPartyWebsiteDataRemovalMode::AllButCookies };
+    WebCore::RegistrableDomain manualPrevalentResource { };
+    
+    void encode(IPC::Encoder& encoder) const
+    {
+        encoder << directory;
+        encoder << directoryExtensionHandle;
+        encoder << enabled;
+        encoder << isItpStateExplicitlySet;
+        encoder << enableLogTestingEvent;
+        encoder << shouldIncludeLocalhost;
+        encoder << enableDebugMode;
+#if ENABLE(RESOURCE_LOAD_STATISTICS)
+        encoder << thirdPartyCookieBlockingMode;
+#endif
+        encoder << firstPartyWebsiteDataRemovalMode;
+        encoder << manualPrevalentResource;
+    }
+
+    static Optional<ResourceLoadStatisticsParameters> decode(IPC::Decoder& decoder)
+    {
+        Optional<String> directory;
+        decoder >> directory;
+        if (!directory)
+            return WTF::nullopt;
+        
+        Optional<SandboxExtension::Handle> directoryExtensionHandle;
+        decoder >> directoryExtensionHandle;
+        if (!directoryExtensionHandle)
+            return WTF::nullopt;
+        
+        Optional<bool> enabled;
+        decoder >> enabled;
+        if (!enabled)
+            return WTF::nullopt;
+
+        Optional<bool> isItpStateExplicitlySet;
+        decoder >> isItpStateExplicitlySet;
+        if (!isItpStateExplicitlySet)
+            return WTF::nullopt;
+
+        Optional<bool> enableLogTestingEvent;
+        decoder >> enableLogTestingEvent;
+        if (!enableLogTestingEvent)
+            return WTF::nullopt;
+
+        Optional<bool> shouldIncludeLocalhost;
+        decoder >> shouldIncludeLocalhost;
+        if (!shouldIncludeLocalhost)
+            return WTF::nullopt;
+
+        Optional<bool> enableDebugMode;
+        decoder >> enableDebugMode;
+        if (!enableDebugMode)
+            return WTF::nullopt;
+
+#if ENABLE(RESOURCE_LOAD_STATISTICS)
+        Optional<WebCore::ThirdPartyCookieBlockingMode> thirdPartyCookieBlockingMode;
+        decoder >> thirdPartyCookieBlockingMode;
+        if (!thirdPartyCookieBlockingMode)
+            return WTF::nullopt;
+#endif
+
+        Optional<WebCore::FirstPartyWebsiteDataRemovalMode> firstPartyWebsiteDataRemovalMode;
+        decoder >> firstPartyWebsiteDataRemovalMode;
+        if (!firstPartyWebsiteDataRemovalMode)
+            return WTF::nullopt;
+
+        Optional<WebCore::RegistrableDomain> manualPrevalentResource;
+        decoder >> manualPrevalentResource;
+        if (!manualPrevalentResource)
+            return WTF::nullopt;
+
+        return {{
+            WTFMove(*directory),
+            WTFMove(*directoryExtensionHandle),
+            WTFMove(*enabled),
+            WTFMove(*isItpStateExplicitlySet),
+            WTFMove(*enableLogTestingEvent),
+            WTFMove(*shouldIncludeLocalhost),
+            WTFMove(*enableDebugMode),
+#if ENABLE(RESOURCE_LOAD_STATISTICS)
+            WTFMove(*thirdPartyCookieBlockingMode),
+#endif
+            WTFMove(*firstPartyWebsiteDataRemovalMode),
+            WTFMove(*manualPrevalentResource),
+        }};
+    }
+};
+
+} // namespace WebKit

Modified: trunk/Source/WebKit/UIProcess/WebProcessPool.cpp (258268 => 258269)


--- trunk/Source/WebKit/UIProcess/WebProcessPool.cpp	2020-03-11 17:30:48 UTC (rev 258268)
+++ trunk/Source/WebKit/UIProcess/WebProcessPool.cpp	2020-03-11 17:42:39 UTC (rev 258269)
@@ -577,13 +577,15 @@
         parameters.defaultDataStoreParameters.cacheStorageDirectory = WTFMove(cacheStorageDirectory);
     }
 
+    String resourceLoadStatisticsDirectory;
+    SandboxExtension::Handle resourceLoadStatisticsDirectoryExtensionHandle;
     if (m_websiteDataStore)
-        parameters.defaultDataStoreParameters.networkSessionParameters.resourceLoadStatisticsDirectory = m_websiteDataStore->resolvedResourceLoadStatisticsDirectory();
+        resourceLoadStatisticsDirectory = m_websiteDataStore->resolvedResourceLoadStatisticsDirectory();
     else if (WebKit::WebsiteDataStore::defaultDataStoreExists())
-        parameters.defaultDataStoreParameters.networkSessionParameters.resourceLoadStatisticsDirectory = WebKit::WebsiteDataStore::defaultDataStore()->parameters().networkSessionParameters.resourceLoadStatisticsDirectory;
+        resourceLoadStatisticsDirectory = WebKit::WebsiteDataStore::defaultDataStore()->parameters().networkSessionParameters.resourceLoadStatisticsParameters.directory;
     
-    if (!parameters.defaultDataStoreParameters.networkSessionParameters.resourceLoadStatisticsDirectory.isEmpty())
-        SandboxExtension::createHandleForReadWriteDirectory(parameters.defaultDataStoreParameters.networkSessionParameters.resourceLoadStatisticsDirectory, parameters.defaultDataStoreParameters.networkSessionParameters.resourceLoadStatisticsDirectoryExtensionHandle);
+    if (!resourceLoadStatisticsDirectory.isEmpty())
+        SandboxExtension::createHandleForReadWriteDirectory(resourceLoadStatisticsDirectory, resourceLoadStatisticsDirectoryExtensionHandle);
 
     bool enableResourceLoadStatistics = false;
     bool enableResourceLoadStatisticsLogTestingEvent = false;
@@ -602,13 +604,13 @@
 #endif
         if (enableResourceLoadStatistics) {
             auto networkSessionParameters = withWebsiteDataStore->parameters().networkSessionParameters;
-            shouldIncludeLocalhost = networkSessionParameters.shouldIncludeLocalhostInResourceLoadStatistics;
-            enableResourceLoadStatisticsDebugMode = networkSessionParameters.enableResourceLoadStatisticsDebugMode;
+            shouldIncludeLocalhost = networkSessionParameters.resourceLoadStatisticsParameters.shouldIncludeLocalhost;
+            enableResourceLoadStatisticsDebugMode = networkSessionParameters.resourceLoadStatisticsParameters.enableDebugMode;
 #if ENABLE(RESOURCE_LOAD_STATISTICS)
-            thirdPartyCookieBlockingMode = networkSessionParameters.thirdPartyCookieBlockingMode;
+            thirdPartyCookieBlockingMode = networkSessionParameters.resourceLoadStatisticsParameters.thirdPartyCookieBlockingMode;
 #endif
-            firstPartyWebsiteDataRemovalMode = networkSessionParameters.firstPartyWebsiteDataRemovalMode;
-            manualPrevalentResource = networkSessionParameters.resourceLoadStatisticsManualPrevalentResource;
+            firstPartyWebsiteDataRemovalMode = networkSessionParameters.resourceLoadStatisticsParameters.firstPartyWebsiteDataRemovalMode;
+            manualPrevalentResource = networkSessionParameters.resourceLoadStatisticsParameters.manualPrevalentResource;
         }
 
         parameters.defaultDataStoreParameters.perOriginStorageQuota = withWebsiteDataStore->perOriginStorageQuota();
@@ -626,13 +628,13 @@
 #endif
         if (enableResourceLoadStatistics) {
             auto networkSessionParameters = m_websiteDataStore->parameters().networkSessionParameters;
-            shouldIncludeLocalhost = networkSessionParameters.shouldIncludeLocalhostInResourceLoadStatistics;
-            enableResourceLoadStatisticsDebugMode = networkSessionParameters.enableResourceLoadStatisticsDebugMode;
+            shouldIncludeLocalhost = networkSessionParameters.resourceLoadStatisticsParameters.shouldIncludeLocalhost;
+            enableResourceLoadStatisticsDebugMode = networkSessionParameters.resourceLoadStatisticsParameters.enableDebugMode;
 #if ENABLE(RESOURCE_LOAD_STATISTICS)
-            thirdPartyCookieBlockingMode = networkSessionParameters.thirdPartyCookieBlockingMode;
+            thirdPartyCookieBlockingMode = networkSessionParameters.resourceLoadStatisticsParameters.thirdPartyCookieBlockingMode;
 #endif
-            firstPartyWebsiteDataRemovalMode = networkSessionParameters.firstPartyWebsiteDataRemovalMode;
-            manualPrevalentResource = networkSessionParameters.resourceLoadStatisticsManualPrevalentResource;
+            firstPartyWebsiteDataRemovalMode = networkSessionParameters.resourceLoadStatisticsParameters.firstPartyWebsiteDataRemovalMode;
+            manualPrevalentResource = networkSessionParameters.resourceLoadStatisticsParameters.manualPrevalentResource;
         }
 
         parameters.defaultDataStoreParameters.perOriginStorageQuota = m_websiteDataStore->perOriginStorageQuota();
@@ -655,17 +657,22 @@
     parameters.defaultDataStoreParameters.networkSessionParameters.alternativeServiceDirectory = WebsiteDataStore::defaultAlternativeServicesDirectory();
     SandboxExtension::createHandleForReadWriteDirectory(parameters.defaultDataStoreParameters.networkSessionParameters.alternativeServiceDirectory, parameters.defaultDataStoreParameters.networkSessionParameters.alternativeServiceDirectoryExtensionHandle);
 #endif
-    parameters.defaultDataStoreParameters.networkSessionParameters.enableResourceLoadStatistics = enableResourceLoadStatistics;
-    parameters.defaultDataStoreParameters.networkSessionParameters.enableResourceLoadStatisticsLogTestingEvent = enableResourceLoadStatisticsLogTestingEvent;
-    parameters.defaultDataStoreParameters.networkSessionParameters.shouldIncludeLocalhostInResourceLoadStatistics = shouldIncludeLocalhost;
-    parameters.defaultDataStoreParameters.networkSessionParameters.enableResourceLoadStatisticsDebugMode = enableResourceLoadStatisticsDebugMode;
+    bool isItpStateExplicitlySet = false;
+    parameters.defaultDataStoreParameters.networkSessionParameters.resourceLoadStatisticsParameters = ResourceLoadStatisticsParameters {
+        WTFMove(resourceLoadStatisticsDirectory),
+        WTFMove(resourceLoadStatisticsDirectoryExtensionHandle),
+        enableResourceLoadStatistics,
+        isItpStateExplicitlySet,
+        enableResourceLoadStatisticsLogTestingEvent,
+        shouldIncludeLocalhost,
+        enableResourceLoadStatisticsDebugMode,
 #if ENABLE(RESOURCE_LOAD_STATISTICS)
-    parameters.defaultDataStoreParameters.networkSessionParameters.thirdPartyCookieBlockingMode = thirdPartyCookieBlockingMode;
+        thirdPartyCookieBlockingMode,
 #endif
-    parameters.defaultDataStoreParameters.networkSessionParameters.firstPartyWebsiteDataRemovalMode = firstPartyWebsiteDataRemovalMode;
+        firstPartyWebsiteDataRemovalMode,
+        manualPrevalentResource,
+    };
 
-    parameters.defaultDataStoreParameters.networkSessionParameters.resourceLoadStatisticsManualPrevalentResource = manualPrevalentResource;
-
     // Add any platform specific parameters
     platformInitializeNetworkProcess(parameters);
 

Modified: trunk/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm (258268 => 258269)


--- trunk/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm	2020-03-11 17:30:48 UTC (rev 258268)
+++ trunk/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm	2020-03-11 17:42:39 UTC (rev 258269)
@@ -170,6 +170,20 @@
     bool isInAppBrowserPrivacyEnabled = [defaults boolForKey:[NSString stringWithFormat:@"InternalDebug%@", WebPreferencesKey::isInAppBrowserPrivacyEnabledKey().createCFString().get()]];
     
     WebsiteDataStoreParameters parameters;
+
+    ResourceLoadStatisticsParameters resourceLoadStatisticsParameters {
+        WTFMove(resourceLoadStatisticsDirectory),
+        WTFMove(resourceLoadStatisticsDirectoryHandle),
+        resourceLoadStatisticsEnabled(),
+        isItpStateExplicitlySet(),
+        hasStatisticsTestingCallback(),
+        shouldIncludeLocalhostInResourceLoadStatistics,
+        enableResourceLoadStatisticsDebugMode,
+        thirdPartyCookieBlockingMode(),
+        firstPartyWebsiteDataRemovalMode,
+        WTFMove(resourceLoadStatisticsManualPrevalentResource),
+    };
+    
     parameters.networkSessionParameters = NetworkSessionCreationParameters {
         m_sessionID,
         configuration().boundInterfaceIdentifier(),
@@ -185,18 +199,8 @@
         WTFMove(alternativeServiceStorageDirectory),
         WTFMove(alternativeServiceStorageDirectoryExtensionHandle),
 #endif
-        WTFMove(resourceLoadStatisticsDirectory),
-        WTFMove(resourceLoadStatisticsDirectoryHandle),
-        resourceLoadStatisticsEnabled(),
-        isItpStateExplicitlySet(),
-        hasStatisticsTestingCallback(),
-        shouldIncludeLocalhostInResourceLoadStatistics,
-        enableResourceLoadStatisticsDebugMode,
-        thirdPartyCookieBlockingMode(),
-        firstPartyWebsiteDataRemovalMode,
         m_configuration->deviceManagementRestrictionsEnabled(),
         m_configuration->allLoadsBlockedByDeviceManagementRestrictionsForTesting(),
-        WTFMove(resourceLoadStatisticsManualPrevalentResource),
         WTFMove(networkCacheDirectory),
         WTFMove(networkCacheDirectoryExtensionHandle),
         m_configuration->dataConnectionServiceType(),
@@ -207,7 +211,8 @@
         m_configuration->testSpeedMultiplier(),
         m_configuration->suppressesConnectionTerminationOnSystemChange(),
         m_configuration->allowsServerPreconnect(),
-        isInAppBrowserPrivacyEnabled
+        isInAppBrowserPrivacyEnabled,
+        WTFMove(resourceLoadStatisticsParameters)
     };
 
     auto cookieFile = resolvedCookieStorageFile();

Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (258268 => 258269)


--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2020-03-11 17:30:48 UTC (rev 258268)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2020-03-11 17:42:39 UTC (rev 258269)
@@ -3957,6 +3957,7 @@
 		587743A421C30AD800AE9084 /* HTTPSUpgradeList.db */ = {isa = PBXFileReference; lastKnownFileType = file; name = HTTPSUpgradeList.db; path = DerivedSources/WebKit2/HTTPSUpgradeList.db; sourceTree = BUILT_PRODUCTS_DIR; };
 		58E977DC21C499FE005D92A6 /* NetworkHTTPSUpgradeChecker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetworkHTTPSUpgradeChecker.cpp; sourceTree = "<group>"; };
 		58E977DD21C49A00005D92A6 /* NetworkHTTPSUpgradeChecker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkHTTPSUpgradeChecker.h; sourceTree = "<group>"; };
+		5C00993B2417FB7E00D53C25 /* ResourceLoadStatisticsParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceLoadStatisticsParameters.h; sourceTree = "<group>"; };
 		5C0A10C1235241A30053E2CA /* NetworkSchemeRegistry.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetworkSchemeRegistry.cpp; sourceTree = "<group>"; };
 		5C0B17741E7C879C00E9123C /* NetworkSocketStreamMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NetworkSocketStreamMessageReceiver.cpp; path = DerivedSources/WebKit2/NetworkSocketStreamMessageReceiver.cpp; sourceTree = BUILT_PRODUCTS_DIR; };
 		5C0B17751E7C879C00E9123C /* NetworkSocketStreamMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NetworkSocketStreamMessages.h; path = DerivedSources/WebKit2/NetworkSocketStreamMessages.h; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -6013,6 +6014,7 @@
 				9B1229D023FF2A5E008CA751 /* RemoteAudioDestinationIdentifier.h */,
 				F6A0C13F13281E6E0070430F /* ResourceCachesToClear.h */,
 				5CB7AFE623C681B000E49CF3 /* ResourceLoadInfo.h */,
+				5C00993B2417FB7E00D53C25 /* ResourceLoadStatisticsParameters.h */,
 				410482CB1DDD2FB500F006D0 /* RTCNetwork.cpp */,
 				410482CC1DDD2FB500F006D0 /* RTCNetwork.h */,
 				41B28B091F83AD3E00FB52AC /* RTCPacketOptions.cpp */,
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to