Skip to content
Permalink
Browse files
Introduce ResourceLoadStatisticsParameters and move members from Netw…
…orkSessionCreationParameters

https://bugs.webkit.org/show_bug.cgi?id=208895

Patch by Alex Christensen <achristensen@webkit.org> 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:

Canonical link: https://commits.webkit.org/221847@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@258269 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Alex Christensen authored and webkit-commit-queue committed Mar 11, 2020
1 parent e872f59 commit 7e7866ca1b45345743ce1a51c961a9cc8cf48ab7
@@ -1,3 +1,31 @@
2020-03-11 Alex Christensen <achristensen@webkit.org>

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 <cdumez@apple.com>

Defer async scripts until DOMContentLoaded or first paint, whichever comes first
@@ -333,7 +333,7 @@ void NetworkProcess::initializeNetworkProcess(NetworkProcessCreationParameters&&

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)));
@@ -80,7 +80,7 @@ NetworkSession::NetworkSession(NetworkProcess& networkProcess, const NetworkSess
: 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 @@ NetworkSession::NetworkSession(NetworkProcess& networkProcess, const NetworkSess
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;
@@ -64,19 +64,6 @@ void NetworkSessionCreationParameters::encode(IPC::Encoder& encoder) const
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 @@ void NetworkSessionCreationParameters::encode(IPC::Encoder& encoder) const
encoder << suppressesConnectionTerminationOnSystemChange;
encoder << allowsServerPreconnect;
encoder << isInAppBrowserPrivacyEnabled;
encoder << resourceLoadStatisticsParameters;
}

Optional<NetworkSessionCreationParameters> NetworkSessionCreationParameters::decode(IPC::Decoder& decoder)
@@ -181,58 +169,6 @@ Optional<NetworkSessionCreationParameters> NetworkSessionCreationParameters::dec
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 @@ Optional<NetworkSessionCreationParameters> NetworkSessionCreationParameters::dec
if (!isInAppBrowserPrivacyEnabled)
return WTF::nullopt;

Optional<ResourceLoadStatisticsParameters> resourceLoadStatisticsParameters;
decoder >> resourceLoadStatisticsParameters;
if (!resourceLoadStatisticsParameters)
return WTF::nullopt;

return {{
*sessionID
, WTFMove(*boundInterfaceIdentifier)
@@ -323,20 +264,8 @@ Optional<NetworkSessionCreationParameters> NetworkSessionCreationParameters::dec
, 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 @@ Optional<NetworkSessionCreationParameters> NetworkSessionCreationParameters::dec
, WTFMove(*suppressesConnectionTerminationOnSystemChange)
, WTFMove(*allowsServerPreconnect)
, WTFMove(*isInAppBrowserPrivacyEnabled)
, WTFMove(*resourceLoadStatisticsParameters)
}};
}

@@ -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 @@ struct NetworkSessionCreationParameters {
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 @@ struct NetworkSessionCreationParameters {
bool suppressesConnectionTerminationOnSystemChange { false };
bool allowsServerPreconnect { true };
bool isInAppBrowserPrivacyEnabled { false };

ResourceLoadStatisticsParameters resourceLoadStatisticsParameters;
};

} // namespace WebKit
@@ -1167,13 +1167,13 @@ - (void)URLSession:(NSURLSession *)session webSocketTask:(NSURLSessionWebSocketT
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)

0 comments on commit 7e7866c

Please sign in to comment.