Skip to content

Commit

Permalink
Unreviewed, reverting 275959@main
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=270987
rdar://124627196

REGRESSION(275959@main): Breaks scrollperf.

Reverted change:

    Resolve directories on WorkQueue in UI process
    https://bugs.webkit.org/show_bug.cgi?id=270300
    rdar://123841003
    https://commits.webkit.org/275959@main

Canonical link: https://commits.webkit.org/276110@main
  • Loading branch information
szewai committed Mar 14, 2024
1 parent 58cbb3a commit 88b5877
Show file tree
Hide file tree
Showing 10 changed files with 223 additions and 315 deletions.
1 change: 0 additions & 1 deletion Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,6 @@ - (instancetype)_initWithConfiguration:(_WKWebsiteDataStoreConfiguration *)confi

auto sessionID = configuration.isPersistent ? PAL::SessionID::generatePersistentSessionID() : PAL::SessionID::generateEphemeralSessionID();
API::Object::constructInWrapper<WebKit::WebsiteDataStore>(self, configuration->_configuration->copy(), sessionID);
_websiteDataStore->resolveDirectoriesAsynchronously();

return self;
}
Expand Down
5 changes: 2 additions & 3 deletions Source/WebKit/UIProcess/GPU/GPUProcessProxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -644,16 +644,15 @@ static inline GPUProcessSessionParameters gpuProcessSessionParameters(const Webs
{
GPUProcessSessionParameters parameters;

auto& resolvedDirectories = const_cast<WebsiteDataStore&>(store).resolvedDirectories();
parameters.mediaCacheDirectory = resolvedDirectories.mediaCacheDirectory;
parameters.mediaCacheDirectory = store.resolvedMediaCacheDirectory();
SandboxExtension::Handle mediaCacheDirectoryExtensionHandle;
if (!parameters.mediaCacheDirectory.isEmpty()) {
if (auto handle = SandboxExtension::createHandleWithoutResolvingPath(parameters.mediaCacheDirectory, SandboxExtension::Type::ReadWrite))
parameters.mediaCacheDirectorySandboxExtensionHandle = WTFMove(*handle);
}

#if ENABLE(LEGACY_ENCRYPTED_MEDIA)
parameters.mediaKeysStorageDirectory = resolvedDirectories.mediaKeysStorageDirectory;
parameters.mediaKeysStorageDirectory = store.resolvedMediaKeysDirectory();
SandboxExtension::Handle mediaKeysStorageDirectorySandboxExtensionHandle;
if (!parameters.mediaKeysStorageDirectory.isEmpty()) {
if (auto handle = SandboxExtension::createHandleWithoutResolvingPath(parameters.mediaKeysStorageDirectory, SandboxExtension::Type::ReadWrite))
Expand Down
11 changes: 5 additions & 6 deletions Source/WebKit/UIProcess/WebProcessPool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -819,10 +819,9 @@ void WebProcessPool::registerHighDynamicRangeChangeCallback()

WebProcessDataStoreParameters WebProcessPool::webProcessDataStoreParameters(WebProcessProxy& process, WebsiteDataStore& websiteDataStore)
{
websiteDataStore.waitForDirectoriesToResolveIfNecessary();
websiteDataStore.resolveDirectoriesIfNecessary();

auto& resolvedDirectories = websiteDataStore.resolvedDirectories();
String mediaCacheDirectory = resolvedDirectories.mediaCacheDirectory;
String mediaCacheDirectory = websiteDataStore.resolvedMediaCacheDirectory();
#if !ENABLE(GPU_PROCESS)
SandboxExtension::Handle mediaCacheDirectoryExtensionHandle;
if (!mediaCacheDirectory.isEmpty()) {
Expand All @@ -831,7 +830,7 @@ WebProcessDataStoreParameters WebProcessPool::webProcessDataStoreParameters(WebP
}
#endif

String mediaKeyStorageDirectory = resolvedDirectories.mediaKeysStorageDirectory;
String mediaKeyStorageDirectory = websiteDataStore.resolvedMediaKeysDirectory();
SandboxExtension::Handle mediaKeyStorageDirectoryExtensionHandle;
if (!mediaKeyStorageDirectory.isEmpty()) {
if (auto handle = SandboxExtension::createHandleWithoutResolvingPath(mediaKeyStorageDirectory, SandboxExtension::Type::ReadWrite))
Expand All @@ -843,7 +842,7 @@ WebProcessDataStoreParameters WebProcessPool::webProcessDataStoreParameters(WebP
if (!m_javaScriptConfigurationDirectory.isEmpty())
javaScriptConfigurationDirectory = resolvePathForSandboxExtension(m_javaScriptConfigurationDirectory);
else if (javaScriptConfigurationFileEnabled())
javaScriptConfigurationDirectory = resolvedDirectories.javaScriptConfigurationDirectory;
javaScriptConfigurationDirectory = websiteDataStore.resolvedJavaScriptConfigurationDirectory();

SandboxExtension::Handle javaScriptConfigurationDirectoryExtensionHandle;
if (!javaScriptConfigurationDirectory.isEmpty()) {
Expand All @@ -852,7 +851,7 @@ WebProcessDataStoreParameters WebProcessPool::webProcessDataStoreParameters(WebP
}

#if ENABLE(ARKIT_INLINE_PREVIEW)
auto modelElementCacheDirectory = resolvedDirectories.modelElementCacheDirectory;
auto modelElementCacheDirectory = websiteDataStore.resolvedModelElementCacheDirectory();
SandboxExtension::Handle modelElementCacheDirectoryExtensionHandle;
if (!modelElementCacheDirectory.isEmpty()) {
if (auto handle = SandboxExtension::createHandleWithoutResolvingPath(modelElementCacheDirectory, SandboxExtension::Type::ReadWrite))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,9 @@ bool experimentalFeatureEnabled(const String& key, bool defaultValue)
if (!httpsProxy.isValid() && (isSafari || isMiniBrowser))
httpsProxy = URL { [defaults stringForKey:(NSString *)WebKit2HTTPSProxyDefaultsKey] };

auto& directories = resolvedDirectories();
#if HAVE(ALTERNATIVE_SERVICE)
SandboxExtension::Handle alternativeServiceStorageDirectoryExtensionHandle;
String alternativeServiceStorageDirectory = directories.alternativeServicesDirectory;
String alternativeServiceStorageDirectory = resolvedAlternativeServicesStorageDirectory();
createHandleFromResolvedPathIfPossible(alternativeServiceStorageDirectory, alternativeServiceStorageDirectoryExtensionHandle);
#endif

Expand All @@ -204,7 +203,7 @@ bool experimentalFeatureEnabled(const String& key, bool defaultValue)
parameters.networkSessionParameters.resourceLoadStatisticsParameters.standaloneApplicationDomain = WebCore::RegistrableDomain { m_configuration->standaloneApplicationURL() };
parameters.networkSessionParameters.resourceLoadStatisticsParameters.manualPrevalentResource = WTFMove(resourceLoadStatisticsManualPrevalentResource);

auto cookieFile = directories.cookieStorageFile;
auto cookieFile = resolvedCookieStorageFile();
createHandleFromResolvedPathIfPossible(FileSystem::parentPath(cookieFile), parameters.cookieStoragePathExtensionHandle);

if (m_uiProcessCookieStorageIdentifier.isEmpty()) {
Expand Down Expand Up @@ -947,14 +946,14 @@ static NavigatingToAppBoundDomain schemeOrDomainIsAppBound(const String& host, c

void WebsiteDataStore::saveRecentSearches(const String& name, const Vector<WebCore::RecentSearch>& searchItems)
{
m_queue->dispatch([name = name.isolatedCopy(), searchItems = crossThreadCopy(searchItems), directory = resolvedDirectories().searchFieldHistoryDirectory.isolatedCopy()] {
m_queue->dispatch([name = name.isolatedCopy(), searchItems = crossThreadCopy(searchItems), directory = resolvedSearchFieldHistoryDirectory().isolatedCopy()] {
WebCore::saveRecentSearchesToFile(name, searchItems, directory);
});
}

void WebsiteDataStore::loadRecentSearches(const String& name, CompletionHandler<void(Vector<WebCore::RecentSearch>&&)>&& completionHandler)
{
m_queue->dispatch([name = name.isolatedCopy(), completionHandler = WTFMove(completionHandler), directory = resolvedDirectories().searchFieldHistoryDirectory.isolatedCopy()]() mutable {
m_queue->dispatch([name = name.isolatedCopy(), completionHandler = WTFMove(completionHandler), directory = resolvedSearchFieldHistoryDirectory().isolatedCopy()]() mutable {
auto result = WebCore::loadRecentSearchesFromFile(name, directory);
RunLoop::main().dispatch([completionHandler = WTFMove(completionHandler), result = crossThreadCopy(result)]() mutable {
completionHandler(WTFMove(result));
Expand All @@ -964,7 +963,7 @@ static NavigatingToAppBoundDomain schemeOrDomainIsAppBound(const String& host, c

void WebsiteDataStore::removeRecentSearches(WallTime oldestTimeToRemove, CompletionHandler<void()>&& completionHandler)
{
m_queue->dispatch([time = oldestTimeToRemove.isolatedCopy(), directory = resolvedDirectories().searchFieldHistoryDirectory.isolatedCopy(), completionHandler = WTFMove(completionHandler)]() mutable {
m_queue->dispatch([time = oldestTimeToRemove.isolatedCopy(), directory = resolvedSearchFieldHistoryDirectory().isolatedCopy(), completionHandler = WTFMove(completionHandler)]() mutable {
WebCore::removeRecentlyModifiedRecentSearchesFromFile(time, directory);
RunLoop::main().dispatch(WTFMove(completionHandler));
});
Expand Down
Loading

0 comments on commit 88b5877

Please sign in to comment.