Bug 1676372 - Avoid including PlatformDecoderModule.h in header files. r=mattwoodrow

Differential Revision: https://phabricator.services.mozilla.com/D96544
This commit is contained in:
Simon Giesecke 2020-11-26 13:20:59 +00:00
parent eb1c061636
commit e1afffcd87
5 changed files with 34 additions and 14 deletions

View file

@ -18,7 +18,6 @@
#include "MediaInfo.h" #include "MediaInfo.h"
#include "VideoUtils.h" #include "VideoUtils.h"
#include "VPXDecoder.h" #include "VPXDecoder.h"
#include "mozilla/CDMProxy.h"
#include "mozilla/ClearOnShutdown.h" #include "mozilla/ClearOnShutdown.h"
#include "mozilla/RemoteDecoderManagerChild.h" #include "mozilla/RemoteDecoderManagerChild.h"
#include "mozilla/RemoteDecoderModule.h" #include "mozilla/RemoteDecoderModule.h"
@ -230,6 +229,8 @@ PDMFactory::PDMFactory() {
CreateNullPDM(); CreateNullPDM();
} }
PDMFactory::~PDMFactory() = default;
PDMFactory::PDMFactory(const RemoteDecodeIn& aProcess) { PDMFactory::PDMFactory(const RemoteDecodeIn& aProcess) {
switch (aProcess) { switch (aProcess) {
case RemoteDecodeIn::RddProcess: case RemoteDecodeIn::RddProcess:

View file

@ -7,19 +7,37 @@
#if !defined(PDMFactory_h_) #if !defined(PDMFactory_h_)
# define PDMFactory_h_ # define PDMFactory_h_
# include <utility>
# include "DecoderDoctorDiagnostics.h" # include "DecoderDoctorDiagnostics.h"
# include "PlatformDecoderModule.h" # include "mozilla/AlreadyAddRefed.h"
# include "mozilla/StaticMutex.h" # include "mozilla/EnumSet.h"
# include "mozilla/MozPromise.h"
class CDMProxy; # include "mozilla/RefPtr.h"
# include "nsISupports.h"
# include "nsStringFwd.h"
# include "nsTArray.h"
namespace mozilla { namespace mozilla {
class CDMProxy;
class MediaDataDecoder;
class MediaResult;
class PDMFactoryImpl; class PDMFactoryImpl;
class PlatformDecoderModule;
class StaticMutex;
template <typename T>
struct MaxEnumValue;
template <class T> template <class T>
class StaticAutoPtr; class StaticAutoPtr;
struct CreateDecoderParams;
struct CreateDecoderParamsForAsync;
struct SupportDecoderParams;
enum class RemoteDecodeIn; enum class RemoteDecodeIn;
using PDMCreateDecoderPromise =
MozPromise<RefPtr<MediaDataDecoder>, MediaResult,
/* IsExclusive = */ true>;
class PDMFactory final { class PDMFactory final {
public: public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(PDMFactory) NS_INLINE_DECL_THREADSAFE_REFCOUNTING(PDMFactory)
@ -33,7 +51,7 @@ class PDMFactory final {
// Factory method that creates the appropriate PlatformDecoderModule for // Factory method that creates the appropriate PlatformDecoderModule for
// the platform we're running on. // the platform we're running on.
RefPtr<PlatformDecoderModule::CreateDecoderPromise> CreateDecoder( RefPtr<PDMCreateDecoderPromise> CreateDecoder(
const CreateDecoderParams& aParams); const CreateDecoderParams& aParams);
bool SupportsMimeType(const nsACString& aMimeType, bool SupportsMimeType(const nsACString& aMimeType,
@ -78,7 +96,7 @@ class PDMFactory final {
static void SetSupported(const MediaCodecsSupported& aSupported); static void SetSupported(const MediaCodecsSupported& aSupported);
private: private:
virtual ~PDMFactory() = default; virtual ~PDMFactory();
// Will set PDM list for the required process. // Will set PDM list for the required process.
// This is used to determine which PDMs are available on the given process // This is used to determine which PDMs are available on the given process
// from the content process. // from the content process.
@ -104,11 +122,10 @@ class PDMFactory final {
const SupportDecoderParams& aParams, const SupportDecoderParams& aParams,
DecoderDoctorDiagnostics* aDiagnostics) const; DecoderDoctorDiagnostics* aDiagnostics) const;
RefPtr<PlatformDecoderModule::CreateDecoderPromise> CreateDecoderWithPDM( RefPtr<PDMCreateDecoderPromise> CreateDecoderWithPDM(
PlatformDecoderModule* aPDM, const CreateDecoderParams& aParams); PlatformDecoderModule* aPDM, const CreateDecoderParams& aParams);
RefPtr<PlatformDecoderModule::CreateDecoderPromise> RefPtr<PDMCreateDecoderPromise> CheckAndMaybeCreateDecoder(
CheckAndMaybeCreateDecoder(CreateDecoderParamsForAsync&& aParams, CreateDecoderParamsForAsync&& aParams, uint32_t aIndex);
uint32_t aIndex);
nsTArray<RefPtr<PlatformDecoderModule>> mCurrentPDMs; nsTArray<RefPtr<PlatformDecoderModule>> mCurrentPDMs;
RefPtr<PlatformDecoderModule> mEMEPDM; RefPtr<PlatformDecoderModule> mEMEPDM;

View file

@ -14,6 +14,7 @@
# include "MediaEventSource.h" # include "MediaEventSource.h"
# include "MediaInfo.h" # include "MediaInfo.h"
# include "MediaResult.h" # include "MediaResult.h"
# include "PDMFactory.h"
# include "mozilla/EnumSet.h" # include "mozilla/EnumSet.h"
# include "mozilla/EnumTypeTraits.h" # include "mozilla/EnumTypeTraits.h"
# include "mozilla/MozPromise.h" # include "mozilla/MozPromise.h"
@ -329,9 +330,7 @@ class PlatformDecoderModule {
SupportsColorDepth(videoInfo->mColorDepth, aDiagnostics); SupportsColorDepth(videoInfo->mColorDepth, aDiagnostics);
} }
typedef MozPromise<RefPtr<MediaDataDecoder>, MediaResult, using CreateDecoderPromise = PDMCreateDecoderPromise;
/* IsExclusive = */ true>
CreateDecoderPromise;
protected: protected:
PlatformDecoderModule() = default; PlatformDecoderModule() = default;

View file

@ -8,6 +8,7 @@
#define mozilla_InputTaskManager_h #define mozilla_InputTaskManager_h
#include "TaskController.h" #include "TaskController.h"
#include "mozilla/StaticPtr.h"
namespace mozilla { namespace mozilla {

View file

@ -10,6 +10,7 @@
#include "nsThreadUtils.h" #include "nsThreadUtils.h"
#include <algorithm> #include <algorithm>
#include <initializer_list> #include <initializer_list>
#include "GeckoProfiler.h"
#include "mozilla/EventQueue.h" #include "mozilla/EventQueue.h"
#include "mozilla/BackgroundHangMonitor.h" #include "mozilla/BackgroundHangMonitor.h"
#include "mozilla/InputTaskManager.h" #include "mozilla/InputTaskManager.h"
@ -21,6 +22,7 @@
#include "nsIThreadInternal.h" #include "nsIThreadInternal.h"
#include "nsQueryObject.h" #include "nsQueryObject.h"
#include "nsThread.h" #include "nsThread.h"
#include "prenv.h"
#include "prsystem.h" #include "prsystem.h"
#ifdef XP_WIN #ifdef XP_WIN