[EME] Push CDMFactory into the platform layer
authorzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Aug 2017 09:54:42 +0000 (09:54 +0000)
committerzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Aug 2017 09:54:42 +0000 (09:54 +0000)
commitf6a0608262ccae617de52b08c37a12cd7bed41e1
treea53eb8a2c8be473dd80a83480cc3689c06f129a7
parent8d9b8a75d6484b048638ba819ade43f36c04d01e
[EME] Push CDMFactory into the platform layer
https://bugs.webkit.org/show_bug.cgi?id=175129

Reviewed by Xabier Rodriguez-Calvar.

This is a follow-up to r219678 that moved the majority of CDM abstraction
classes into the platform layer, but missed the CDMFactory class.

The CDMFactory abstraction is now also placed in the platform layer. Only
change to the interface is that the createCDM() method can't accept a CDM
object reference anymore since that class is cemented into the WebCore
layer, and no current implementation used it anyway.

Additionally, the static Vector object of registered factories is moved
under the CDMFactory class, along with the register and unregister
functions. The platformRegisterFactories() function is added to allow for
platform-specific factory registrations to occur when the registered
factories are queried for the first time. Empty implementation for this
function is provided for non-GStreamer platforms, while for GStreamer
the implementation is kept in CDMFactoryGStreamer.cpp. It's still empty
for now, but it will register the ClearKey factory there in the near
future.

No new tests -- none affected, only refactoring.

* CMakeLists.txt:
* Modules/encryptedmedia/CDM.cpp:
(WebCore::createCDMPrivateForKeySystem):
(WebCore::CDM::supportsKeySystem):
(WebCore::CDM::CDM):
(): Deleted.
(WebCore::CDM::registerCDMFactory): Deleted.
(WebCore::CDM::unregisterCDMFactory): Deleted.
* Modules/encryptedmedia/CDM.h:
(WebCore::CDMFactory::~CDMFactory): Deleted.
* PlatformWPE.cmake:
* platform/GStreamer.cmake:
* platform/encryptedmedia/CDMFactory.cpp: Added.
(WebCore::CDMFactory::registerFactory):
(WebCore::CDMFactory::unregisterFactory):
(WebCore::CDMFactory::platformRegisterFactories):
* platform/encryptedmedia/CDMFactory.h: Added.
(WebCore::CDMFactory::~CDMFactory):
* platform/encryptedmedia/clearkey/CDMClearKey.cpp:
(WebCore::CDMFactoryClearKey::createCDM):
* platform/encryptedmedia/clearkey/CDMClearKey.h:
* platform/encryptedmedia/gstreamer/CDMFactoryGStreamer.cpp: Added.
(WebCore::CDMFactory::platformRegisterFactories):
* testing/MockCDMFactory.cpp:
(WebCore::m_weakPtrFactory):
(WebCore::MockCDMFactory::unregister):
(WebCore::MockCDMFactory::createCDM):
* testing/MockCDMFactory.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220264 268f45cc-cd09-0410-ab3c-d52691b4dbfc
13 files changed:
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/Modules/encryptedmedia/CDM.cpp
Source/WebCore/Modules/encryptedmedia/CDM.h
Source/WebCore/PlatformWPE.cmake
Source/WebCore/platform/GStreamer.cmake
Source/WebCore/platform/encryptedmedia/CDMFactory.cpp [new file with mode: 0644]
Source/WebCore/platform/encryptedmedia/CDMFactory.h [new file with mode: 0644]
Source/WebCore/platform/encryptedmedia/clearkey/CDMClearKey.cpp
Source/WebCore/platform/encryptedmedia/clearkey/CDMClearKey.h
Source/WebCore/platform/graphics/gstreamer/eme/CDMFactoryGStreamer.cpp [new file with mode: 0644]
Source/WebCore/testing/MockCDMFactory.cpp
Source/WebCore/testing/MockCDMFactory.h