Title: [295708] trunk/Source/WebKit
Revision
295708
Author
[email protected]
Date
2022-06-21 18:16:05 -0700 (Tue, 21 Jun 2022)

Log Message

[GPUP] Send GPU preferences in single IPC message
https://bugs.webkit.org/show_bug.cgi?id=241809
rdar://95636552

Patch by Youssef Soliman <[email protected]> on 2022-06-21
Reviewed by Eric Carlson.

Currently the `GPUProcessProxy::updatePreferences` method sends preferences
from the web process in multiple IPC messages to the GPU process. These messages
should be consolidated into one package and sent across in a single message.

* Source/WebKit/GPUProcess/GPUProcess.cpp:
(WebKit::GPUProcess::updateGPUProcessPreferences):
(WebKit::GPUProcess::updatePreference):
(WebKit::GPUProcess::setWebMParserEnabled): Deleted.
(WebKit::GPUProcess::setWebMFormatReaderEnabled): Deleted.
(WebKit::GPUProcess::setOpusDecoderEnabled): Deleted.
(WebKit::GPUProcess::setVorbisDecoderEnabled): Deleted.
(WebKit::GPUProcess::setMediaSourceInlinePaintingEnabled): Deleted.
(WebKit::GPUProcess::setSampleBufferContentKeySessionSupportEnabled): Deleted.
* Source/WebKit/GPUProcess/GPUProcess.h:
* Source/WebKit/GPUProcess/GPUProcess.messages.in:
* Source/WebKit/GPUProcess/GPUProcessPreferences.cpp: Added.
(WebKit::GPUProcessPreferences::encode const):
(WebKit::GPUProcessPreferences::decode):
* Source/WebKit/GPUProcess/GPUProcessPreferences.h: Added.
* Source/WebKit/Sources.txt:
* Source/WebKit/UIProcess/GPU/GPUProcessProxy.cpp:
(WebKit::GPUProcessProxy::updatePreferences):
* Source/WebKit/UIProcess/GPU/GPUProcessProxy.h:
* Source/WebKit/WebKit.xcodeproj/project.pbxproj:

Canonical link: https://commits.webkit.org/251713@main

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit/GPUProcess/GPUProcess.cpp (295707 => 295708)


--- trunk/Source/WebKit/GPUProcess/GPUProcess.cpp	2022-06-22 01:05:31 UTC (rev 295707)
+++ trunk/Source/WebKit/GPUProcess/GPUProcess.cpp	2022-06-22 01:16:05 UTC (rev 295708)
@@ -35,6 +35,7 @@
 #include "GPUConnectionToWebProcess.h"
 #include "GPUProcessConnectionParameters.h"
 #include "GPUProcessCreationParameters.h"
+#include "GPUProcessPreferences.h"
 #include "GPUProcessProxyMessages.h"
 #include "GPUProcessSessionParameters.h"
 #include "LogInitialization.h"
@@ -284,6 +285,54 @@
 #endif
 }
 
+void GPUProcess::updateGPUProcessPreferences(GPUProcessPreferences&& preferences)
+{
+#if ENABLE(MEDIA_SOURCE)
+    if (updatePreference(m_preferences.webMParserEnabled, preferences.webMParserEnabled))
+        WebCore::RuntimeEnabledFeatures::sharedFeatures().setWebMParserEnabled(*m_preferences.webMParserEnabled);
+#endif
+
+#if ENABLE(WEBM_FORMAT_READER)
+    if (updatePreference(m_preferences.webMFormatReaderEnabled, preferences.webMFormatReaderEnabled))
+        PlatformMediaSessionManager::setWebMFormatReaderEnabled(*m_preferences.webMFormatReaderEnabled);
+#endif
+
+#if ENABLE(OPUS)
+    if (updatePreference(m_preferences.opusDecoderEnabled, preferences.opusDecoderEnabled))
+        PlatformMediaSessionManager::setOpusDecoderEnabled(*m_preferences.opusDecoderEnabled);
+#endif
+
+#if ENABLE(VORBIS)
+    if (updatePreference(m_preferences.vorbisDecoderEnabled, preferences.vorbisDecoderEnabled))
+        PlatformMediaSessionManager::setVorbisDecoderEnabled(*m_preferences.vorbisDecoderEnabled);
+#endif
+    
+#if ENABLE(MEDIA_SOURCE) && HAVE(AVSAMPLEBUFFERVIDEOOUTPUT)
+    if (updatePreference(m_preferences.mediaSourceInlinePaintingEnabled, preferences.mediaSourceInlinePaintingEnabled))
+        WebCore::RuntimeEnabledFeatures::sharedFeatures().setMediaSourceInlinePaintingEnabled(*m_preferences.mediaSourceInlinePaintingEnabled);
+#endif
+
+#if HAVE(AVCONTENTKEYSPECIFIER)
+    if (updatePreference(m_preferences.sampleBufferContentKeySessionSupportEnabled, preferences.sampleBufferContentKeySessionSupportEnabled))
+        MediaSessionManagerCocoa::setSampleBufferContentKeySessionSupportEnabled(*m_preferences.sampleBufferContentKeySessionSupportEnabled);
+#endif
+}
+
+bool GPUProcess::updatePreference(std::optional<bool>& oldPreference, std::optional<bool>& newPreference)
+{
+    if (newPreference.has_value() && oldPreference != newPreference) {
+        oldPreference = WTFMove(newPreference);
+        return true;
+    }
+    
+    if (!oldPreference.has_value()) {
+        oldPreference = false;
+        return true;
+    }
+    
+    return false;
+}
+
 void GPUProcess::prepareToSuspend(bool isSuspensionImminent, MonotonicTime, CompletionHandler<void()>&& completionHandler)
 {
     RELEASE_LOG(ProcessSuspension, "%p - GPUProcess::prepareToSuspend(), isSuspensionImminent: %d", this, isSuspensionImminent);
@@ -491,66 +540,6 @@
 }
 #endif
 
-#if ENABLE(MEDIA_SOURCE)
-void GPUProcess::setWebMParserEnabled(bool enabled)
-{
-    if (m_webMParserEnabled == enabled)
-        return;
-    m_webMParserEnabled = enabled;
-    WebCore::RuntimeEnabledFeatures::sharedFeatures().setWebMParserEnabled(m_webMParserEnabled);
-}
-#endif
-
-#if ENABLE(WEBM_FORMAT_READER)
-void GPUProcess::setWebMFormatReaderEnabled(bool enabled)
-{
-    if (m_webMFormatReaderEnabled == enabled)
-        return;
-    m_webMFormatReaderEnabled = enabled;
-    PlatformMediaSessionManager::setWebMFormatReaderEnabled(m_webMFormatReaderEnabled);
-}
-#endif
-
-#if ENABLE(OPUS)
-void GPUProcess::setOpusDecoderEnabled(bool enabled)
-{
-    if (m_opusEnabled == enabled)
-        return;
-    m_opusEnabled = enabled;
-    PlatformMediaSessionManager::setOpusDecoderEnabled(m_opusEnabled);
-}
-#endif
-
-#if ENABLE(VORBIS)
-void GPUProcess::setVorbisDecoderEnabled(bool enabled)
-{
-    if (m_vorbisEnabled == enabled)
-        return;
-    m_vorbisEnabled = enabled;
-    PlatformMediaSessionManager::setVorbisDecoderEnabled(m_vorbisEnabled);
-}
-#endif
-
-#if ENABLE(MEDIA_SOURCE) && HAVE(AVSAMPLEBUFFERVIDEOOUTPUT)
-void GPUProcess::setMediaSourceInlinePaintingEnabled(bool enabled)
-{
-    if (m_mediaSourceInlinePaintingEnabled == enabled)
-        return;
-    m_mediaSourceInlinePaintingEnabled = enabled;
-    WebCore::RuntimeEnabledFeatures::sharedFeatures().setMediaSourceInlinePaintingEnabled(m_mediaSourceInlinePaintingEnabled);
-}
-#endif
-
-#if HAVE(AVCONTENTKEYSPECIFIER)
-void GPUProcess::setSampleBufferContentKeySessionSupportEnabled(bool enabled)
-{
-    if (m_sampleBufferContentKeySessionSupportEnabled == enabled)
-        return;
-    m_sampleBufferContentKeySessionSupportEnabled = enabled;
-    MediaSessionManagerCocoa::setSampleBufferContentKeySessionSupportEnabled(enabled);
-}
-#endif
-
 void GPUProcess::webProcessConnectionCountForTesting(CompletionHandler<void(uint64_t)>&& completionHandler)
 {
     completionHandler(GPUConnectionToWebProcess::objectCountForTesting());

Modified: trunk/Source/WebKit/GPUProcess/GPUProcess.h (295707 => 295708)


--- trunk/Source/WebKit/GPUProcess/GPUProcess.h	2022-06-22 01:05:31 UTC (rev 295707)
+++ trunk/Source/WebKit/GPUProcess/GPUProcess.h	2022-06-22 01:16:05 UTC (rev 295708)
@@ -28,6 +28,7 @@
 #if ENABLE(GPU_PROCESS)
 
 #include "AuxiliaryProcess.h"
+#include "GPUProcessPreferences.h"
 #include "SandboxExtension.h"
 #include "ShareableBitmap.h"
 #include "WebPageProxyIdentifier.h"
@@ -138,9 +139,12 @@
 
     // Message Handlers
     void initializeGPUProcess(GPUProcessCreationParameters&&);
+    void updateGPUProcessPreferences(GPUProcessPreferences&&);
     void createGPUConnectionToWebProcess(WebCore::ProcessIdentifier, PAL::SessionID, IPC::Attachment&&, GPUProcessConnectionParameters&&, CompletionHandler<void()>&&);
     void addSession(PAL::SessionID, GPUProcessSessionParameters&&);
     void removeSession(PAL::SessionID);
+    
+    bool updatePreference(std::optional<bool>& oldPreference, std::optional<bool>& newPreference);
 
 #if ENABLE(MEDIA_STREAM)
     void setMockCaptureDevicesEnabled(bool);
@@ -168,30 +172,6 @@
     RetainPtr<NSDictionary> additionalStateForDiagnosticReport() const final;
 #endif
 
-#if ENABLE(MEDIA_SOURCE)
-    void setWebMParserEnabled(bool);
-#endif
-
-#if ENABLE(WEBM_FORMAT_READER)
-    void setWebMFormatReaderEnabled(bool);
-#endif
-
-#if ENABLE(OPUS)
-    void setOpusDecoderEnabled(bool);
-#endif
-
-#if ENABLE(VORBIS)
-    void setVorbisDecoderEnabled(bool);
-#endif
-
-#if ENABLE(MEDIA_SOURCE) && HAVE(AVSAMPLEBUFFERVIDEOOUTPUT)
-    void setMediaSourceInlinePaintingEnabled(bool);
-#endif
-
-#if HAVE(AVCONTENTKEYSPECIFIER)
-    void setSampleBufferContentKeySessionSupportEnabled(bool);
-#endif
-
 #if ENABLE(CFPREFS_DIRECT_MODE)
     void notifyPreferencesChanged(const String& domain, const String& key, const std::optional<String>& encodedValue);
     void dispatchSimulatedNotificationsForPreferenceChange(const String& key) final;
@@ -208,6 +188,8 @@
     // Connections to WebProcesses.
     HashMap<WebCore::ProcessIdentifier, Ref<GPUConnectionToWebProcess>> m_webProcessConnections;
     MonotonicTime m_creationTime { MonotonicTime::now() };
+    
+    GPUProcessPreferences m_preferences;
 
 #if ENABLE(MEDIA_STREAM)
     struct MediaCaptureAccess {
@@ -247,24 +229,6 @@
     bool m_enableVP9Decoder { false };
     bool m_enableVP9SWDecoder { false };
 #endif
-#if ENABLE(MEDIA_SOURCE)
-    bool m_webMParserEnabled { false };
-#endif
-#if ENABLE(WEBM_FORMAT_READER)
-    bool m_webMFormatReaderEnabled { false };
-#endif
-#if ENABLE(OPUS)
-    bool m_opusEnabled { false };
-#endif
-#if ENABLE(VORBIS)
-    bool m_vorbisEnabled { false };
-#endif
-#if ENABLE(MEDIA_SOURCE) && HAVE(AVSAMPLEBUFFERVIDEOOUTPUT)
-    bool m_mediaSourceInlinePaintingEnabled { false };
-#endif
-#if HAVE(AVCONTENTKEYSPECIFIER)
-    bool m_sampleBufferContentKeySessionSupportEnabled { false };
-#endif
 
 };
 

Modified: trunk/Source/WebKit/GPUProcess/GPUProcess.messages.in (295707 => 295708)


--- trunk/Source/WebKit/GPUProcess/GPUProcess.messages.in	2022-06-22 01:05:31 UTC (rev 295707)
+++ trunk/Source/WebKit/GPUProcess/GPUProcess.messages.in	2022-06-22 01:16:05 UTC (rev 295708)
@@ -26,6 +26,8 @@
     InitializeGPUProcess(struct WebKit::GPUProcessCreationParameters processCreationParameters)
 
     CreateGPUConnectionToWebProcess(WebCore::ProcessIdentifier processIdentifier, PAL::SessionID sessionID, IPC::Attachment connectionIdentifier, struct WebKit::GPUProcessConnectionParameters parameters) -> ()
+    
+    UpdateGPUProcessPreferences(struct WebKit::GPUProcessPreferences preferences)
 
     PrepareToSuspend(bool isSuspensionImminent, MonotonicTime estimatedSuspendTime) -> ()
     ProcessDidResume()
@@ -57,30 +59,6 @@
     ShowScreenPicker() -> (std::optional<WebCore::CaptureDevice> device)
 #endif
 
-#if ENABLE(MEDIA_SOURCE)
-    SetWebMParserEnabled(bool enabled);
-#endif
-
-#if ENABLE(WEBM_FORMAT_READER)
-    SetWebMFormatReaderEnabled(bool enabled);
-#endif
-
-#if ENABLE(OPUS)
-    SetOpusDecoderEnabled(bool enabled);
-#endif
-
-#if ENABLE(VORBIS)
-    SetVorbisDecoderEnabled(bool enabled);
-#endif
-
-#if ENABLE(MEDIA_SOURCE) && HAVE(AVSAMPLEBUFFERVIDEOOUTPUT)
-    SetMediaSourceInlinePaintingEnabled(bool enabled);
-#endif
-
-#if HAVE(AVCONTENTKEYSPECIFIER)
-    SetSampleBufferContentKeySessionSupportEnabled(bool enabled);
-#endif
-
     RequestBitmapImageForCurrentTime(WebCore::ProcessIdentifier processIdentifier, WebCore::MediaPlayerIdentifier playerIdentifier) -> (WebKit::ShareableBitmap::Handle handle)
 
 #if ENABLE(CFPREFS_DIRECT_MODE)

Added: trunk/Source/WebKit/GPUProcess/GPUProcessPreferences.cpp (0 => 295708)


--- trunk/Source/WebKit/GPUProcess/GPUProcessPreferences.cpp	                        (rev 0)
+++ trunk/Source/WebKit/GPUProcess/GPUProcessPreferences.cpp	2022-06-22 01:16:05 UTC (rev 295708)
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+
+#include "config.h"
+#include "GPUProcessPreferences.h"
+
+#if ENABLE(GPU_PROCESS)
+
+#include "ArgumentCoders.h"
+
+#if PLATFORM(COCOA)
+#include "ArgumentCodersCF.h"
+#endif
+
+namespace WebKit {
+
+GPUProcessPreferences::GPUProcessPreferences() = default;
+
+void GPUProcessPreferences::encode(IPC::Encoder& encoder) const
+{
+#if ENABLE(OPUS)
+    encoder << opusDecoderEnabled;
+#endif
+    
+#if ENABLE(VORBIS)
+    encoder << vorbisDecoderEnabled;
+#endif
+    
+#if ENABLE(WEBM_FORMAT_READER)
+    encoder << webMFormatReaderEnabled;
+#endif
+    
+#if ENABLE(MEDIA_SOURCE) && ENABLE(VP9)
+    encoder << webMParserEnabled;
+#endif
+    
+#if ENABLE(MEDIA_SOURCE) && HAVE(AVSAMPLEBUFFERVIDEOOUTPUT)
+    encoder << mediaSourceInlinePaintingEnabled;
+#endif
+    
+#if HAVE(AVCONTENTKEYSPECIFIER)
+    encoder << sampleBufferContentKeySessionSupportEnabled;
+#endif
+}
+
+bool GPUProcessPreferences::decode(IPC::Decoder& decoder, GPUProcessPreferences& result)
+{
+#if ENABLE(OPUS)
+    if (!decoder.decode(result.opusDecoderEnabled))
+        return false;
+#endif
+    
+#if ENABLE(VORBIS)
+    if (!decoder.decode(result.vorbisDecoderEnabled))
+        return false;
+#endif
+    
+#if ENABLE(WEBM_FORMAT_READER)
+    if (!decoder.decode(result.webMFormatReaderEnabled))
+        return false;
+#endif
+    
+#if ENABLE(MEDIA_SOURCE) && ENABLE(VP9)
+    if (!decoder.decode(result.webMParserEnabled))
+        return false;
+#endif
+    
+#if ENABLE(MEDIA_SOURCE) && HAVE(AVSAMPLEBUFFERVIDEOOUTPUT)
+    if (!decoder.decode(result.mediaSourceInlinePaintingEnabled))
+        return false;
+#endif
+    
+#if HAVE(AVCONTENTKEYSPECIFIER)
+    if (!decoder.decode(result.sampleBufferContentKeySessionSupportEnabled))
+        return false;
+#endif
+    return true;
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(GPU_PROCESS)

Added: trunk/Source/WebKit/GPUProcess/GPUProcessPreferences.h (0 => 295708)


--- trunk/Source/WebKit/GPUProcess/GPUProcessPreferences.h	                        (rev 0)
+++ trunk/Source/WebKit/GPUProcess/GPUProcessPreferences.h	2022-06-22 01:16:05 UTC (rev 295708)
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2022 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
+
+#if ENABLE(GPU_PROCESS)
+
+#include <optional>
+
+namespace IPC {
+class Decoder;
+class Encoder;
+}
+
+namespace WebKit {
+
+struct GPUProcessPreferences {
+    GPUProcessPreferences();
+    
+#if ENABLE(OPUS)
+    std::optional<bool> opusDecoderEnabled;
+#endif
+    
+#if ENABLE(VORBIS)
+    std::optional<bool> vorbisDecoderEnabled;
+#endif
+    
+#if ENABLE(WEBM_FORMAT_READER)
+    std::optional<bool> webMFormatReaderEnabled;
+#endif
+    
+#if ENABLE(MEDIA_SOURCE) && ENABLE(VP9)
+    std::optional<bool> webMParserEnabled;
+#endif
+    
+#if ENABLE(MEDIA_SOURCE) && HAVE(AVSAMPLEBUFFERVIDEOOUTPUT)
+    std::optional<bool> mediaSourceInlinePaintingEnabled;
+#endif
+    
+#if HAVE(AVCONTENTKEYSPECIFIER)
+    std::optional<bool> sampleBufferContentKeySessionSupportEnabled;
+#endif
+
+    void encode(IPC::Encoder&) const;
+    static WARN_UNUSED_RETURN bool decode(IPC::Decoder&, GPUProcessPreferences&);
+};
+
+} // namespace WebKit
+
+#endif // ENABLE(GPU_PROCESS)

Modified: trunk/Source/WebKit/Sources.txt (295707 => 295708)


--- trunk/Source/WebKit/Sources.txt	2022-06-22 01:05:31 UTC (rev 295707)
+++ trunk/Source/WebKit/Sources.txt	2022-06-22 01:16:05 UTC (rev 295708)
@@ -24,6 +24,7 @@
 GPUProcess/GPUProcess.cpp
 GPUProcess/GPUConnectionToWebProcess.cpp
 GPUProcess/GPUProcessCreationParameters.cpp
+GPUProcess/GPUProcessPreferences.cpp
 GPUProcess/graphics/ImageBufferShareableAllocator.cpp
 GPUProcess/graphics/RemoteDisplayListRecorder.cpp
 GPUProcess/graphics/RemoteGraphicsContextGL.cpp

Modified: trunk/Source/WebKit/UIProcess/GPU/GPUProcessProxy.cpp (295707 => 295708)


--- trunk/Source/WebKit/UIProcess/GPU/GPUProcessProxy.cpp	2022-06-22 01:05:31 UTC (rev 295707)
+++ trunk/Source/WebKit/UIProcess/GPU/GPUProcessProxy.cpp	2022-06-22 01:16:05 UTC (rev 295708)
@@ -32,6 +32,7 @@
 #include "GPUProcessConnectionParameters.h"
 #include "GPUProcessCreationParameters.h"
 #include "GPUProcessMessages.h"
+#include "GPUProcessPreferences.h"
 #include "GPUProcessProxyMessages.h"
 #include "GPUProcessSessionParameters.h"
 #include "Logging.h"
@@ -625,14 +626,13 @@
     if (!canSendMessage())
         return;
 
-    // FIXME: We should consider consolidating these into a single struct and propagating it to the GPU process as a single IPC message,
-    // instead of sending one message for each preference.
-    // FIXME: It's not ideal that these features are controlled by preferences-level feature flags (i.e. per-web view), but there is only
+    // FIXME (https://bugs.webkit.org/show_bug.cgi?id=241821): It's not ideal that these features are controlled by preferences-level feature flags (i.e. per-web view), but there is only
     // one GPU process and the runtime-enabled features backing these preferences are process-wide. We should refactor each of these features
     // so that they aren't process-global, and then reimplement this feature flag propagation to the GPU Process in a way that respects the
     // settings of the page that is hosting each media element.
     // For the time being, each of the below features are enabled in the GPU Process if it is enabled by at least one web page's preferences.
     // In practice, all web pages' preferences should agree on these feature flag values.
+    GPUProcessPreferences gpuPreferences;
     for (auto page : webProcess.pages()) {
         auto& preferences = page->preferences();
         if (!preferences.useGPUProcessForMediaEnabled())
@@ -639,47 +639,37 @@
             continue;
 
 #if ENABLE(OPUS)
-        if (!m_hasEnabledOpus && preferences.opusDecoderEnabled()) {
-            m_hasEnabledOpus = true;
-            send(Messages::GPUProcess::SetOpusDecoderEnabled(m_hasEnabledOpus), 0);
-        }
+        if (preferences.opusDecoderEnabled())
+            gpuPreferences.opusDecoderEnabled = true;
 #endif
 
 #if ENABLE(VORBIS)
-        if (!m_hasEnabledVorbis && preferences.vorbisDecoderEnabled()) {
-            m_hasEnabledVorbis = true;
-            send(Messages::GPUProcess::SetVorbisDecoderEnabled(m_hasEnabledVorbis), 0);
-        }
+        if (preferences.vorbisDecoderEnabled())
+            gpuPreferences.vorbisDecoderEnabled = true;
 #endif
 
 #if ENABLE(WEBM_FORMAT_READER)
-        if (!m_hasEnabledWebMFormatReader && preferences.webMFormatReaderEnabled()) {
-            m_hasEnabledWebMFormatReader = true;
-            send(Messages::GPUProcess::SetWebMFormatReaderEnabled(m_hasEnabledWebMFormatReader), 0);
-        }
+        if (preferences.webMFormatReaderEnabled())
+            gpuPreferences.webMFormatReaderEnabled = true;
 #endif
 
 #if ENABLE(MEDIA_SOURCE) && ENABLE(VP9)
-        if (!m_hasEnabledWebMParser && preferences.webMParserEnabled()) {
-            m_hasEnabledWebMParser = true;
-            send(Messages::GPUProcess::SetWebMParserEnabled(m_hasEnabledWebMParser), 0);
-        }
+        if (preferences.webMParserEnabled())
+            gpuPreferences.webMParserEnabled = true;
 #endif
 
 #if ENABLE(MEDIA_SOURCE) && HAVE(AVSAMPLEBUFFERVIDEOOUTPUT)
-        if (!m_hasEnabledMediaSourceInlinePainting && preferences.mediaSourceInlinePaintingEnabled()) {
-            m_hasEnabledMediaSourceInlinePainting = true;
-            send(Messages::GPUProcess::SetMediaSourceInlinePaintingEnabled(m_hasEnabledMediaSourceInlinePainting), 0);
-        }
+        if (preferences.mediaSourceInlinePaintingEnabled())
+            gpuPreferences.mediaSourceInlinePaintingEnabled = true;
 #endif
 
 #if HAVE(AVCONTENTKEYSPECIFIER)
-        if (!m_hasEnabledSampleBufferContentKeySessionSupport && preferences.sampleBufferContentKeySessionSupportEnabled()) {
-            m_hasEnabledSampleBufferContentKeySessionSupport = true;
-            send(Messages::GPUProcess::SetSampleBufferContentKeySessionSupportEnabled(m_hasEnabledSampleBufferContentKeySessionSupport), 0);
-        }
+        if (preferences.sampleBufferContentKeySessionSupportEnabled())
+            gpuPreferences.sampleBufferContentKeySessionSupportEnabled = true;
 #endif
     }
+    
+    send(Messages::GPUProcess::UpdateGPUProcessPreferences(gpuPreferences), 0);
 }
 
 void GPUProcessProxy::updateScreenPropertiesIfNeeded()

Modified: trunk/Source/WebKit/UIProcess/GPU/GPUProcessProxy.h (295707 => 295708)


--- trunk/Source/WebKit/UIProcess/GPU/GPUProcessProxy.h	2022-06-22 01:05:31 UTC (rev 295707)
+++ trunk/Source/WebKit/UIProcess/GPU/GPUProcessProxy.h	2022-06-22 01:16:05 UTC (rev 295708)
@@ -168,30 +168,6 @@
     bool m_hasSentDisplayCaptureSandboxExtension { false };
 #endif
 
-#if ENABLE(MEDIA_SOURCE) && ENABLE(VP9)
-    bool m_hasEnabledWebMParser { false };
-#endif
-
-#if ENABLE(WEBM_FORMAT_READER)
-    bool m_hasEnabledWebMFormatReader { false };
-#endif
-
-#if ENABLE(OPUS)
-    bool m_hasEnabledOpus { false };
-#endif
-
-#if ENABLE(VORBIS)
-    bool m_hasEnabledVorbis { false };
-#endif
-
-#if ENABLE(MEDIA_SOURCE) && HAVE(AVSAMPLEBUFFERVIDEOOUTPUT)
-    bool m_hasEnabledMediaSourceInlinePainting { false };
-#endif
-
-#if HAVE(AVCONTENTKEYSPECIFIER)
-    bool m_hasEnabledSampleBufferContentKeySessionSupport { false };
-#endif
-
 #if HAVE(SCREEN_CAPTURE_KIT)
     bool m_hasEnabledScreenCaptureKit { false };
 #endif

Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (295707 => 295708)


--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2022-06-22 01:05:31 UTC (rev 295707)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2022-06-22 01:16:05 UTC (rev 295708)
@@ -5109,6 +5109,8 @@
 		57FE686C2604827800BF45E4 /* _WKAuthenticatorAttachment.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _WKAuthenticatorAttachment.h; sourceTree = "<group>"; };
 		57FE688A260ABB3D00BF45E4 /* PrivateClickMeasurementNetworkLoader.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PrivateClickMeasurementNetworkLoader.h; sourceTree = "<group>"; };
 		57FE688B260ABB3D00BF45E4 /* PrivateClickMeasurementNetworkLoader.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = PrivateClickMeasurementNetworkLoader.cpp; sourceTree = "<group>"; };
+		5ABF2BEC2862353F000DCE74 /* GPUProcessPreferences.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = GPUProcessPreferences.cpp; sourceTree = "<group>"; };
+		5ABF2BED2862353F000DCE74 /* GPUProcessPreferences.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPUProcessPreferences.h; sourceTree = "<group>"; };
 		5C00993B2417FB7E00D53C25 /* ResourceLoadStatisticsParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceLoadStatisticsParameters.h; sourceTree = "<group>"; };
 		5C05FDF227AB4FA5003A2487 /* PrivateRelayed.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PrivateRelayed.h; sourceTree = "<group>"; };
 		5C0A10C1235241A30053E2CA /* NetworkSchemeRegistry.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetworkSchemeRegistry.cpp; sourceTree = "<group>"; };
@@ -9044,6 +9046,8 @@
 				2D9FB2022375209D0049F936 /* GPUProcess.messages.in */,
 				2D9FB2142375209D0049F936 /* GPUProcessCreationParameters.cpp */,
 				2D9FB2032375209D0049F936 /* GPUProcessCreationParameters.h */,
+				5ABF2BEC2862353F000DCE74 /* GPUProcessPreferences.cpp */,
+				5ABF2BED2862353F000DCE74 /* GPUProcessPreferences.h */,
 				4150A5A023E06C910051264A /* GPUProcessSessionParameters.h */,
 			);
 			path = GPUProcess;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to