Title: [276437] trunk/Source/WebKit
Revision
276437
Author
[email protected]
Date
2021-04-22 09:04:13 -0700 (Thu, 22 Apr 2021)

Log Message

Call RemoteCDMFactory::registerFactory() in WebProcess::setUseGPUProcessForMedia()
https://bugs.webkit.org/show_bug.cgi?id=224907

Reviewed by Eric Carlson.

Call RemoteCDMFactory::registerFactory() in WebProcess::setUseGPUProcessForMedia() like we
did before r275887, instead of doing it in the GPUProcessConnection constructor. This is
safer as it makes sure the CDMFactory gets registered even if the GPUProcess has not launched
yet. This is also more consistent with what we do for LegacyCDM since Bug 224905.

The MediaKeys API still seems functional after r275887 (unlike the LegacyCDM one) so it does
not seem it caused obvious breakage. That said, it is still safer to restore pre-r275887
behavior. There is also no drawback to restoring the previous behavior since I made sure the
GPUProcess does not get launched eagerly.

* WebProcess/GPU/GPUProcessConnection.cpp:
(WebKit::GPUProcessConnection::GPUProcessConnection):
(WebKit::GPUProcessConnection::dispatchMessage):
* WebProcess/GPU/GPUProcessConnection.h:
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::setUseGPUProcessForMedia):
(WebKit::WebProcess::cdmFactory):
* WebProcess/WebProcess.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (276436 => 276437)


--- trunk/Source/WebKit/ChangeLog	2021-04-22 15:17:56 UTC (rev 276436)
+++ trunk/Source/WebKit/ChangeLog	2021-04-22 16:04:13 UTC (rev 276437)
@@ -1,3 +1,29 @@
+2021-04-22  Chris Dumez  <[email protected]>
+
+        Call RemoteCDMFactory::registerFactory() in WebProcess::setUseGPUProcessForMedia()
+        https://bugs.webkit.org/show_bug.cgi?id=224907
+
+        Reviewed by Eric Carlson.
+
+        Call RemoteCDMFactory::registerFactory() in WebProcess::setUseGPUProcessForMedia() like we
+        did before r275887, instead of doing it in the GPUProcessConnection constructor. This is
+        safer as it makes sure the CDMFactory gets registered even if the GPUProcess has not launched
+        yet. This is also more consistent with what we do for LegacyCDM since Bug 224905.
+
+        The MediaKeys API still seems functional after r275887 (unlike the LegacyCDM one) so it does
+        not seem it caused obvious breakage. That said, it is still safer to restore pre-r275887
+        behavior. There is also no drawback to restoring the previous behavior since I made sure the
+        GPUProcess does not get launched eagerly.
+
+        * WebProcess/GPU/GPUProcessConnection.cpp:
+        (WebKit::GPUProcessConnection::GPUProcessConnection):
+        (WebKit::GPUProcessConnection::dispatchMessage):
+        * WebProcess/GPU/GPUProcessConnection.h:
+        * WebProcess/WebProcess.cpp:
+        (WebKit::WebProcess::setUseGPUProcessForMedia):
+        (WebKit::WebProcess::cdmFactory):
+        * WebProcess/WebProcess.h:
+
 2021-04-22  Carlos Garcia Campos  <[email protected]>
 
         [SOUP] Add support for preconnect

Modified: trunk/Source/WebKit/WebProcess/GPU/GPUProcessConnection.cpp (276436 => 276437)


--- trunk/Source/WebKit/WebProcess/GPU/GPUProcessConnection.cpp	2021-04-22 15:17:56 UTC (rev 276436)
+++ trunk/Source/WebKit/WebProcess/GPU/GPUProcessConnection.cpp	2021-04-22 16:04:13 UTC (rev 276437)
@@ -101,11 +101,6 @@
     addLanguageChangeObserver(this, languagesChanged);
 
     if (WebProcess::singleton().shouldUseRemoteRenderingFor(RenderingPurpose::MediaPainting)) {
-#if ENABLE(ENCRYPTED_MEDIA)
-        auto& cdmFactories = CDMFactory::registeredFactories();
-        cdmFactories.clear();
-        cdmFactory().registerFactory(cdmFactories);
-#endif
         mediaEngineConfigurationFactory().registerFactory();
 #if ENABLE(VP9)
         enableVP9Decoders(PlatformMediaSessionManager::shouldEnableVP8Decoder(), PlatformMediaSessionManager::shouldEnableVP9Decoder(), PlatformMediaSessionManager::shouldEnableVP9SWDecoder());
@@ -160,13 +155,6 @@
 }
 #endif
 
-#if ENABLE(ENCRYPTED_MEDIA)
-RemoteCDMFactory& GPUProcessConnection::cdmFactory()
-{
-    return *WebProcess::singleton().supplement<RemoteCDMFactory>();
-}
-#endif
-
 RemoteMediaEngineConfigurationFactory& GPUProcessConnection::mediaEngineConfigurationFactory()
 {
     return *WebProcess::singleton().supplement<RemoteMediaEngineConfigurationFactory>();
@@ -194,7 +182,7 @@
 
 #if ENABLE(ENCRYPTED_MEDIA)
     if (decoder.messageReceiverName() == Messages::RemoteCDMInstanceSession::messageReceiverName()) {
-        WebProcess::singleton().supplement<RemoteCDMFactory>()->didReceiveSessionMessage(connection, decoder);
+        WebProcess::singleton().cdmFactory().didReceiveSessionMessage(connection, decoder);
         return true;
     }
 #endif

Modified: trunk/Source/WebKit/WebProcess/GPU/GPUProcessConnection.h (276436 => 276437)


--- trunk/Source/WebKit/WebProcess/GPU/GPUProcessConnection.h	2021-04-22 15:17:56 UTC (rev 276436)
+++ trunk/Source/WebKit/WebProcess/GPU/GPUProcessConnection.h	2021-04-22 16:04:13 UTC (rev 276437)
@@ -40,7 +40,6 @@
 namespace WebKit {
 
 class RemoteAudioSourceProviderManager;
-class RemoteCDMFactory;
 class RemoteMediaEngineConfigurationFactory;
 class RemoteMediaPlayerManager;
 class WebPage;
@@ -72,10 +71,6 @@
     RemoteAudioSourceProviderManager& audioSourceProviderManager();
 #endif
 
-#if ENABLE(ENCRYPTED_MEDIA)
-    RemoteCDMFactory& cdmFactory();
-#endif
-
     RemoteMediaEngineConfigurationFactory& mediaEngineConfigurationFactory();
 
     void updateMediaConfiguration();

Modified: trunk/Source/WebKit/WebProcess/WebProcess.cpp (276436 => 276437)


--- trunk/Source/WebKit/WebProcess/WebProcess.cpp	2021-04-22 15:17:56 UTC (rev 276436)
+++ trunk/Source/WebKit/WebProcess/WebProcess.cpp	2021-04-22 16:04:13 UTC (rev 276437)
@@ -1971,11 +1971,12 @@
     m_useGPUProcessForMedia = useGPUProcessForMedia;
 
 #if ENABLE(ENCRYPTED_MEDIA)
-    if (!useGPUProcessForMedia) {
-        auto& cdmFactories = CDMFactory::registeredFactories();
-        cdmFactories.clear();
+    auto& cdmFactories = CDMFactory::registeredFactories();
+    cdmFactories.clear();
+    if (useGPUProcessForMedia)
+        cdmFactory().registerFactory(cdmFactories);
+    else
         CDMFactory::platformRegisterFactories(cdmFactories);
-    }
 #endif
 
 #if USE(AUDIO_SESSION)
@@ -2078,6 +2079,14 @@
 }
 #endif
 
+#if ENABLE(GPU_PROCESS) && ENABLE(ENCRYPTED_MEDIA)
+RemoteCDMFactory& WebProcess::cdmFactory()
+{
+    return *supplement<RemoteCDMFactory>();
+}
+#endif
+
+
 } // namespace WebKit
 
 #undef RELEASE_LOG_SESSION_ID

Modified: trunk/Source/WebKit/WebProcess/WebProcess.h (276436 => 276437)


--- trunk/Source/WebKit/WebProcess/WebProcess.h	2021-04-22 15:17:56 UTC (rev 276436)
+++ trunk/Source/WebKit/WebProcess/WebProcess.h	2021-04-22 16:04:13 UTC (rev 276437)
@@ -118,6 +118,7 @@
 class NetworkProcessConnection;
 class ObjCObjectGraph;
 class ProcessAssertion;
+class RemoteCDMFactory;
 class RemoteLegacyCDMFactory;
 struct ServiceWorkerInitializationData;
 class StorageAreaMap;
@@ -244,7 +245,9 @@
 #if ENABLE(LEGACY_ENCRYPTED_MEDIA)
     RemoteLegacyCDMFactory& legacyCDMFactory();
 #endif
-
+#if ENABLE(ENCRYPTED_MEDIA)
+    RemoteCDMFactory& cdmFactory();
+#endif
 #endif // ENABLE(GPU_PROCESS)
 
 #if ENABLE(WEB_AUTHN)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to