diff --git a/dom/media/gmp/GMPChild.cpp b/dom/media/gmp/GMPChild.cpp index 0e24fd5b8f01..2d7b9f682407 100644 --- a/dom/media/gmp/GMPChild.cpp +++ b/dom/media/gmp/GMPChild.cpp @@ -44,7 +44,6 @@ #include "prio.h" #ifdef XP_WIN # include // for _exit() -# include "mozilla/WinDllServices.h" # include "WinUtils.h" #else # include // for _exit() @@ -757,38 +756,6 @@ mozilla::ipc::IPCResult GMPChild::RecvShutdown(ShutdownResolver&& aResolver) { return IPC_OK(); } -#if defined(XP_WIN) -mozilla::ipc::IPCResult GMPChild::RecvInitDllServices( - const bool& aCanRecordReleaseTelemetry, - const bool& aIsReadyForBackgroundProcessing) { - if (aCanRecordReleaseTelemetry) { - RefPtr dllSvc(DllServices::Get()); - dllSvc->StartUntrustedModulesProcessor(aIsReadyForBackgroundProcessing); - } - return IPC_OK(); -} - -mozilla::ipc::IPCResult GMPChild::RecvGetUntrustedModulesData( - GetUntrustedModulesDataResolver&& aResolver) { - RefPtr dllSvc(DllServices::Get()); - dllSvc->GetUntrustedModulesData()->Then( - GetMainThreadSerialEventTarget(), __func__, - [aResolver](Maybe&& aData) { - aResolver(std::move(aData)); - }, - [aResolver](nsresult aReason) { aResolver(Nothing()); }); - return IPC_OK(); -} - -mozilla::ipc::IPCResult GMPChild::RecvUnblockUntrustedModulesThread() { - if (nsCOMPtr obs = - mozilla::services::GetObserverService()) { - obs->NotifyObservers(nullptr, "unblock-untrusted-modules-thread", nullptr); - } - return IPC_OK(); -} -#endif // defined(XP_WIN) - } // namespace gmp } // namespace mozilla diff --git a/dom/media/gmp/GMPChild.h b/dom/media/gmp/GMPChild.h index 2973827691b2..3cb5bfa6e6f3 100644 --- a/dom/media/gmp/GMPChild.h +++ b/dom/media/gmp/GMPChild.h @@ -82,16 +82,6 @@ class GMPChild : public PGMPChild { mozilla::ipc::IPCResult RecvShutdown(ShutdownResolver&& aResolver); -#if defined(XP_WIN) - mozilla::ipc::IPCResult RecvInitDllServices( - const bool& aCanRecordReleaseTelemetry, - const bool& aIsReadyForBackgroundProcessing); - - mozilla::ipc::IPCResult RecvGetUntrustedModulesData( - GetUntrustedModulesDataResolver&& aResolver); - mozilla::ipc::IPCResult RecvUnblockUntrustedModulesThread(); -#endif // defined(XP_WIN) - void ActorDestroy(ActorDestroyReason aWhy) override; void ProcessingError(Result aCode, const char* aReason) override; diff --git a/dom/media/gmp/GMPParent.cpp b/dom/media/gmp/GMPParent.cpp index 223a2d1fda9a..7b2204015672 100644 --- a/dom/media/gmp/GMPParent.cpp +++ b/dom/media/gmp/GMPParent.cpp @@ -39,7 +39,6 @@ #include "runnable_utils.h" #ifdef XP_WIN # include "mozilla/FileUtilsWin.h" -# include "mozilla/WinDllServices.h" # include "WMFDecoderModule.h" #endif #if defined(MOZ_WIDGET_ANDROID) @@ -299,23 +298,13 @@ class NotifyGMPProcessLoadedTask : public Runnable { } #endif - nsCOMPtr gmpEventTarget = - mGMPParent->GMPEventTarget(); - if (NS_WARN_IF(!gmpEventTarget)) { - return NS_ERROR_FAILURE; - } - -#if defined(XP_WIN) - RefPtr dllSvc(DllServices::Get()); - bool isReadyForBackgroundProcessing = - dllSvc->IsReadyForBackgroundProcessing(); - gmpEventTarget->Dispatch(NewRunnableMethod( - "GMPParent::SendInitDllServices", mGMPParent, - &GMPParent::SendInitDllServices, isReadyForBackgroundProcessing, - Telemetry::CanRecordReleaseData())); -#endif - if (canProfile) { + nsCOMPtr gmpEventTarget = + mGMPParent->GMPEventTarget(); + if (!gmpEventTarget) { + return NS_ERROR_FAILURE; + } + ipc::Endpoint profilerParent( ProfilerParent::CreateForProcess(mProcessId)); @@ -442,49 +431,6 @@ mozilla::ipc::IPCResult GMPParent::RecvFOGData(ByteBuf&& aBuf) { return IPC_OK(); } -#if defined(XP_WIN) -mozilla::ipc::IPCResult GMPParent::RecvGetModulesTrust( - ModulePaths&& aModPaths, bool aRunAtNormalPriority, - GetModulesTrustResolver&& aResolver) { - class ModulesTrustRunnable final : public Runnable { - public: - ModulesTrustRunnable(ModulePaths&& aModPaths, bool aRunAtNormalPriority, - GetModulesTrustResolver&& aResolver) - : Runnable("GMPParent::RecvGetModulesTrust::ModulesTrustRunnable"), - mModPaths(std::move(aModPaths)), - mResolver(std::move(aResolver)), - mEventTarget(GetCurrentSerialEventTarget()), - mRunAtNormalPriority(aRunAtNormalPriority) {} - - NS_IMETHOD Run() override { - RefPtr dllSvc(DllServices::Get()); - dllSvc->GetModulesTrust(std::move(mModPaths), mRunAtNormalPriority) - ->Then( - mEventTarget, __func__, - [self = RefPtr{this}](ModulesMapResult&& aResult) { - self->mResolver(Some(ModulesMapResult(std::move(aResult)))); - }, - [self = RefPtr{this}](nsresult aRv) { - self->mResolver(Nothing()); - }); - return NS_OK; - } - - private: - ~ModulesTrustRunnable() override = default; - - ModulePaths mModPaths; - GetModulesTrustResolver mResolver; - nsCOMPtr mEventTarget; - bool mRunAtNormalPriority; - }; - - NS_DispatchToMainThread(MakeAndAddRef( - std::move(aModPaths), aRunAtNormalPriority, std::move(aResolver))); - return IPC_OK(); -} -#endif // defined(XP_WIN) - void GMPParent::CloseIfUnused() { MOZ_ASSERT(GMPEventTarget()->IsOnCurrentThread()); GMP_PARENT_LOG_DEBUG("%s", __FUNCTION__); diff --git a/dom/media/gmp/GMPParent.h b/dom/media/gmp/GMPParent.h index a529b31df1ce..918188c64197 100644 --- a/dom/media/gmp/GMPParent.h +++ b/dom/media/gmp/GMPParent.h @@ -178,12 +178,6 @@ class GMPParent final mozilla::ipc::IPCResult RecvFOGData(ByteBuf&& aBuf); -#if defined(XP_WIN) - mozilla::ipc::IPCResult RecvGetModulesTrust( - ModulePaths&& aModPaths, bool aRunAtNormalPriority, - GetModulesTrustResolver&& aResolver); -#endif // defined(XP_WIN) - bool IsUsed() { return mGMPContentChildCount > 0 || !mGetContentParentPromises.IsEmpty(); } diff --git a/dom/media/gmp/GMPPlatform.cpp b/dom/media/gmp/GMPPlatform.cpp index fbe66f3eb3f1..1a76015ed42f 100644 --- a/dom/media/gmp/GMPPlatform.cpp +++ b/dom/media/gmp/GMPPlatform.cpp @@ -13,10 +13,6 @@ #include "base/time.h" #include "mozilla/ReentrantMonitor.h" -#ifdef XP_WIN -# include "mozilla/UntrustedModulesProcessor.h" -#endif - #include namespace mozilla::gmp { @@ -221,17 +217,6 @@ void SendFOGData(ipc::ByteBuf&& buf) { } } -#ifdef XP_WIN -RefPtr SendGetModulesTrust( - ModulePaths&& aModules, bool aRunAtNormalPriority) { - if (!sChild) { - return PGMPChild::GetModulesTrustPromise::CreateAndReject( - ipc::ResponseRejectReason::SendError, __func__); - } - return sChild->SendGetModulesTrust(std::move(aModules), aRunAtNormalPriority); -} -#endif - GMPThreadImpl::GMPThreadImpl() : mMutex("GMPThreadImpl"), mThread("GMPThread") { MOZ_COUNT_CTOR(GMPThread); } diff --git a/dom/media/gmp/GMPPlatform.h b/dom/media/gmp/GMPPlatform.h index 6253305a8417..ee4571d85691 100644 --- a/dom/media/gmp/GMPPlatform.h +++ b/dom/media/gmp/GMPPlatform.h @@ -6,21 +6,14 @@ #ifndef GMPPlatform_h_ #define GMPPlatform_h_ -#include "mozilla/RefPtr.h" #include "gmp-platform.h" #include -#include "mozilla/gmp/PGMPChild.h" -namespace mozilla { -#ifdef XP_WIN -struct ModulePaths; -#endif - -namespace ipc { +namespace mozilla::ipc { class ByteBuf; -} // namespace ipc +} // namespace mozilla::ipc -namespace gmp { +namespace mozilla::gmp { class GMPChild; @@ -34,12 +27,6 @@ GMPErr SetTimerOnMainThread(GMPTask* aTask, int64_t aTimeoutMS); void SendFOGData(ipc::ByteBuf&& buf); -#ifdef XP_WIN -RefPtr SendGetModulesTrust( - ModulePaths&& aModules, bool aRunNormal); -#endif - -} // namespace gmp -} // namespace mozilla +} // namespace mozilla::gmp #endif // GMPPlatform_h_ diff --git a/dom/media/gmp/GMPServiceParent.cpp b/dom/media/gmp/GMPServiceParent.cpp index 2a552dc1b526..a77082466e8e 100644 --- a/dom/media/gmp/GMPServiceParent.cpp +++ b/dom/media/gmp/GMPServiceParent.cpp @@ -31,9 +31,6 @@ #include "mozilla/SyncRunnable.h" #include "mozilla/Telemetry.h" #include "mozilla/Unused.h" -#if defined(XP_WIN) -# include "mozilla/UntrustedModulesData.h" -#endif #include "nsAppDirectoryServiceDefs.h" #include "nsComponentManagerUtils.h" #include "nsDirectoryServiceDefs.h" @@ -714,67 +711,6 @@ void GeckoMediaPluginServiceParent::SendFlushFOGData( } } -#if defined(XP_WIN) -void GeckoMediaPluginServiceParent::SendGetUntrustedModulesData( - nsTArray>& promises) { - MOZ_ASSERT(NS_IsMainThread()); - MutexAutoLock lock(mMutex); - - for (const RefPtr& gmp : mPlugins) { - if (gmp->State() != GMPState::Loaded) { - // Plugins that are not in the Loaded state have no process attached to - // them, and any IPC we would attempt to send them would be ignored (or - // result in a warning on debug builds). - continue; - } - RefPtr promise = - new GetUntrustedModulesDataPromise::Private(__func__); - // Direct dispatch will resolve the promise on the same thread, which is - // faster; IPC will move execution back to the main thread. - promise->UseDirectTaskDispatch(__func__); - promises.EmplaceBack(promise); - - mGMPThread->Dispatch( - NewRunnableMethod>&&, - ipc::RejectCallback&&>( - "GMPParent::SendGetUntrustedModulesData", gmp, - static_cast>&& - aResolve, - mozilla::ipc::RejectCallback&& aReject)>( - &GMPParent::SendGetUntrustedModulesData), - - [promise](Maybe&& aValue) { - promise->Resolve(std::move(aValue), __func__); - }, - [promise](ipc::ResponseRejectReason&& aReason) { - promise->Reject(std::move(aReason), __func__); - }), - NS_DISPATCH_NORMAL); - } -} - -void GeckoMediaPluginServiceParent::SendUnblockUntrustedModulesThread() { - MOZ_ASSERT(NS_IsMainThread()); - MutexAutoLock lock(mMutex); - - for (const RefPtr& gmp : mPlugins) { - if (gmp->State() != GMPState::Loaded) { - // Plugins that are not in the Loaded state have no process attached to - // them, and any IPC we would attempt to send them would be ignored (or - // result in a warning on debug builds). - continue; - } - - mGMPThread->Dispatch( - NewRunnableMethod<>("GMPParent::SendUnblockUntrustedModulesThread", gmp, - static_cast( - &GMPParent::SendUnblockUntrustedModulesThread)), - NS_DISPATCH_NORMAL); - } -} -#endif - RefPtr GeckoMediaPluginServiceParent::TestTriggerMetrics() { MOZ_ASSERT(NS_IsMainThread()); diff --git a/dom/media/gmp/GMPServiceParent.h b/dom/media/gmp/GMPServiceParent.h index be40c7a264af..7b9c6a95afbc 100644 --- a/dom/media/gmp/GMPServiceParent.h +++ b/dom/media/gmp/GMPServiceParent.h @@ -82,16 +82,6 @@ class GeckoMediaPluginServiceParent final void SendFlushFOGData(nsTArray>& promises); -#if defined(XP_WIN) - using GetUntrustedModulesDataPromise = - PGMPParent::GetUntrustedModulesDataPromise; - - void SendGetUntrustedModulesData( - nsTArray>& promises); - - void SendUnblockUntrustedModulesThread(); -#endif - /* * ** Test-only Method ** * diff --git a/dom/media/gmp/PGMP.ipdl b/dom/media/gmp/PGMP.ipdl index b3dcd9a64567..d5771cb2aeaf 100644 --- a/dom/media/gmp/PGMP.ipdl +++ b/dom/media/gmp/PGMP.ipdl @@ -9,12 +9,6 @@ include protocol PGMPTimer; include protocol PGMPStorage; include protocol PProfiler; -#if defined(XP_WIN) -[MoveOnly] using mozilla::UntrustedModulesData from "mozilla/UntrustedModulesData.h"; -[MoveOnly] using mozilla::ModulePaths from "mozilla/UntrustedModulesData.h"; -[MoveOnly] using mozilla::ModulesMapResult from "mozilla/UntrustedModulesData.h"; -#endif - include "mozilla/ipc/ByteBufUtils.h"; include "GMPParent.h"; include "GMPChild.h"; @@ -42,11 +36,6 @@ parent: // https://firefox-source-docs.mozilla.org/toolkit/components/glean/dev/ipc.html async FOGData(ByteBuf buf); -#if defined(XP_WIN) - async GetModulesTrust(ModulePaths aModPaths, bool aRunAtNormalPriority) - returns (ModulesMapResult? modMapResult); -#endif // defined(XP_WIN) - child: async CrashPluginNow(); [Nested=inside_sync] sync StartPlugin(nsString adapter); @@ -62,20 +51,6 @@ child: // https://firefox-source-docs.mozilla.org/toolkit/components/glean/dev/ipc.html async FlushFOGData() returns (ByteBuf buf); -#if defined(XP_WIN) - async InitDllServices(bool canRecordReleaseTelemetry, - bool aIsReadyForBackgroundProcessing); - - async GetUntrustedModulesData() returns (UntrustedModulesData? data); - - /** - * This method is used to notify a child process to start - * processing module loading events in UntrustedModulesProcessor. - * This should be called when the parent process has gone idle. - */ - async UnblockUntrustedModulesThread(); -#endif // defined(XP_WIN) - // Test-only method. // Asks the GMP process to trigger test-only instrumentation. // The unused returned value is to have a promise we can await. diff --git a/dom/media/gmp/moz.build b/dom/media/gmp/moz.build index a2b1be5ed892..4557793b4a0d 100644 --- a/dom/media/gmp/moz.build +++ b/dom/media/gmp/moz.build @@ -114,6 +114,7 @@ DIRS += [ IPDL_SOURCES += [ "GMPTypes.ipdlh", "PChromiumCDM.ipdl", + "PGMP.ipdl", "PGMPService.ipdl", "PGMPStorage.ipdl", "PGMPTimer.ipdl", @@ -122,7 +123,6 @@ IPDL_SOURCES += [ ] PREPROCESSED_IPDL_SOURCES += [ - "PGMP.ipdl", "PGMPContent.ipdl", ] diff --git a/toolkit/components/telemetry/other/UntrustedModules.cpp b/toolkit/components/telemetry/other/UntrustedModules.cpp index 7a80cd9c8d60..fc988c2d063b 100644 --- a/toolkit/components/telemetry/other/UntrustedModules.cpp +++ b/toolkit/components/telemetry/other/UntrustedModules.cpp @@ -6,7 +6,6 @@ #include "UntrustedModules.h" -#include "GMPServiceParent.h" #include "mozilla/dom/ContentParent.h" #include "mozilla/MozPromise.h" #include "mozilla/net/SocketProcessParent.h" @@ -151,17 +150,6 @@ MultiGetUntrustedModulesData::GetUntrustedModuleLoadEvents() { } } - if (RefPtr gmps = - gmp::GeckoMediaPluginServiceParent::GetSingleton()) { - nsTArray> - promises; - gmps->SendGetUntrustedModulesData(promises); - for (auto& promise : promises) { - AddPending(std::move(promise)); - } - } - return mPromise; } diff --git a/toolkit/xre/dllservices/UntrustedModulesProcessor.cpp b/toolkit/xre/dllservices/UntrustedModulesProcessor.cpp index 1d1183735541..4deb920a52b9 100644 --- a/toolkit/xre/dllservices/UntrustedModulesProcessor.cpp +++ b/toolkit/xre/dllservices/UntrustedModulesProcessor.cpp @@ -8,8 +8,6 @@ #include -#include "GMPPlatform.h" -#include "GMPServiceParent.h" #include "mozilla/CmdLineAndEnvUtils.h" #include "mozilla/DebugOnly.h" #include "mozilla/dom/ContentChild.h" @@ -83,11 +81,9 @@ bool UntrustedModulesProcessor::IsSupportedProcessType() { return Telemetry::CanRecordReleaseData(); case GeckoProcessType_RDD: case GeckoProcessType_Utility: - case GeckoProcessType_GMPlugin: - // For GMPlugin, RDD and Utility process, we check the telemetry settings - // in RDDChild::Init() / UtilityProcessChild::Init() / GMPChild::Init() - // running in the browser process because CanRecordReleaseData() always - // returns false here. + // For RDD and Utility process, we check the telemetry settings in + // RDDChild::Init() / UtilityProcessChild::Init() running in the browser + // process because CanRecordReleaseData() always returns false here. return true; default: return false; @@ -201,10 +197,6 @@ NS_IMETHODIMP UntrustedModulesProcessor::Observe(nsISupports* aSubject, Unused << proc->SendUnblockUntrustedModulesThread(); } } - if (RefPtr gmps = - gmp::GeckoMediaPluginServiceParent::GetSingleton()) { - gmps->SendUnblockUntrustedModulesThread(); - } } return NS_OK; @@ -767,10 +759,6 @@ UntrustedModulesProcessor::SendGetModulesTrust(ModulePaths&& aModules, ipc::UtilityProcessChild::GetSingleton().get(), std::move(aModules), runNormal); } - case GeckoProcessType_GMPlugin: { - return ::mozilla::gmp::SendGetModulesTrust(std::move(aModules), - runNormal); - } default: { MOZ_ASSERT_UNREACHABLE("Unsupported process type"); return GetModulesTrustIpcPromise::CreateAndReject( diff --git a/toolkit/xre/dllservices/WinDllServices.cpp b/toolkit/xre/dllservices/WinDllServices.cpp index 115e9e362796..b98a15252b55 100644 --- a/toolkit/xre/dllservices/WinDllServices.cpp +++ b/toolkit/xre/dllservices/WinDllServices.cpp @@ -30,7 +30,12 @@ DllServices* DllServices::Get() { static StaticLocalRefPtr sInstance( []() -> already_AddRefed { RefPtr dllSvc(new DllServices()); - dllSvc->EnableFull(); + // Full DLL services require XPCOM, which GMP doesn't have + if (XRE_IsGMPluginProcess()) { + dllSvc->EnableBasic(); + } else { + dllSvc->EnableFull(); + } auto setClearOnShutdown = [ptr = &sInstance]() -> void { ClearOnShutdown(ptr); @@ -75,6 +80,10 @@ RefPtr DllServices::GetUntrustedModulesData() { } void DllServices::DisableFull() { + if (XRE_IsGMPluginProcess()) { + return; + } + if (mUntrustedModulesProcessor) { mUntrustedModulesProcessor->Disable(); }