Skip to content

Commit

Permalink
[GPUP] WebContent process consumes a sandbox extension to the media c…
Browse files Browse the repository at this point in the history
…ache directory unnecessarily

https://bugs.webkit.org/show_bug.cgi?id=265406
rdar://110540943

Reviewed by Brent Fulgham.

Disable this code when the GPU process is enabled. As a follow-up, I plan to disable the runtime setting
for Media in the GPU process for Cocoa platforms, since that should never be turned off.

* Source/WebKit/Shared/WebProcessDataStoreParameters.h:
* Source/WebKit/Shared/WebProcessDataStoreParameters.serialization.in:
* Source/WebKit/UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::webProcessDataStoreParameters):
* Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::platformSetWebsiteDataStoreParameters):

Canonical link: https://commits.webkit.org/271677@main
  • Loading branch information
pvollan committed Dec 7, 2023
1 parent 3a91772 commit 0c06435
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Source/WebKit/Shared/WebProcessDataStoreParameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ struct WebProcessDataStoreParameters {
SandboxExtension::Handle applicationCacheDirectoryExtensionHandle;
String applicationCacheFlatFileSubdirectoryName;
String mediaCacheDirectory;
#if !ENABLE(GPU_PROCESS)
SandboxExtension::Handle mediaCacheDirectoryExtensionHandle;
#endif
String mediaKeyStorageDirectory;
SandboxExtension::Handle mediaKeyStorageDirectoryExtensionHandle;
FileSystem::Salt mediaKeysStorageSalt;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
WebKit::SandboxExtension::Handle applicationCacheDirectoryExtensionHandle;
String applicationCacheFlatFileSubdirectoryName;
String mediaCacheDirectory;
#if !ENABLE(GPU_PROCESS)
WebKit::SandboxExtension::Handle mediaCacheDirectoryExtensionHandle;
#endif
String mediaKeyStorageDirectory;
WebKit::SandboxExtension::Handle mediaKeyStorageDirectoryExtensionHandle;
FileSystem::Salt mediaKeysStorageSalt;
Expand Down
4 changes: 4 additions & 0 deletions Source/WebKit/UIProcess/WebProcessPool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -720,11 +720,13 @@ WebProcessDataStoreParameters WebProcessPool::webProcessDataStoreParameters(WebP
String applicationCacheFlatFileSubdirectoryName = websiteDataStore.applicationCacheFlatFileSubdirectoryName();

String mediaCacheDirectory = websiteDataStore.resolvedMediaCacheDirectory();
#if !ENABLE(GPU_PROCESS)
SandboxExtension::Handle mediaCacheDirectoryExtensionHandle;
if (!mediaCacheDirectory.isEmpty()) {
if (auto handle = SandboxExtension::createHandleWithoutResolvingPath(mediaCacheDirectory, SandboxExtension::Type::ReadWrite))
mediaCacheDirectoryExtensionHandle = WTFMove(*handle);
}
#endif

String mediaKeyStorageDirectory = websiteDataStore.resolvedMediaKeysDirectory();
SandboxExtension::Handle mediaKeyStorageDirectoryExtensionHandle;
Expand Down Expand Up @@ -773,7 +775,9 @@ WebProcessDataStoreParameters WebProcessPool::webProcessDataStoreParameters(WebP
WTFMove(applicationCacheDirectoryExtensionHandle),
WTFMove(applicationCacheFlatFileSubdirectoryName),
WTFMove(mediaCacheDirectory),
#if !ENABLE(GPU_PROCESS)
WTFMove(mediaCacheDirectoryExtensionHandle),
#endif
WTFMove(mediaKeyStorageDirectory),
WTFMove(mediaKeyStorageDirectoryExtensionHandle),
WTFMove(mediaKeyStorageSalt),
Expand Down
2 changes: 2 additions & 0 deletions Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,9 @@ static void setVideoDecoderBehaviors(OptionSet<VideoDecoderBehavior> videoDecode
{
#if ENABLE(SANDBOX_EXTENSIONS)
SandboxExtension::consumePermanently(parameters.applicationCacheDirectoryExtensionHandle);
#if !ENABLE(GPU_PROCESS)
SandboxExtension::consumePermanently(parameters.mediaCacheDirectoryExtensionHandle);
#endif
SandboxExtension::consumePermanently(parameters.mediaKeyStorageDirectoryExtensionHandle);
SandboxExtension::consumePermanently(parameters.javaScriptConfigurationDirectoryExtensionHandle);
#if ENABLE(ARKIT_INLINE_PREVIEW)
Expand Down

0 comments on commit 0c06435

Please sign in to comment.