GMPChild.h (3526B)
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 5 6 #ifndef GMPChild_h_ 7 #define GMPChild_h_ 8 9 #include "GMPLoader.h" 10 #include "GMPStorageChild.h" 11 #include "GMPTimerChild.h" 12 #include "gmp-entrypoints.h" 13 #include "mozilla/gmp/PGMPChild.h" 14 #include "prlink.h" 15 16 namespace mozilla { 17 18 class ChildProfilerController; 19 20 namespace gmp { 21 22 class GMPContentChild; 23 24 class GMPChild : public PGMPChild { 25 friend class PGMPChild; 26 27 public: 28 NS_INLINE_DECL_REFCOUNTING(GMPChild, override) 29 30 GMPChild(); 31 32 bool Init(const nsAString& aPluginPath, const char* aParentBuildID, 33 mozilla::ipc::UntypedEndpoint&& aEndpoint); 34 void Shutdown(); 35 MessageLoop* GMPMessageLoop(); 36 37 // Main thread only. 38 GMPTimerChild* GetGMPTimers(); 39 GMPStorageChild* GetGMPStorage(); 40 41 #if defined(XP_MACOSX) && defined(MOZ_SANDBOX) 42 bool SetMacSandboxInfo(bool aAllowWindowServer); 43 #endif 44 45 private: 46 friend class GMPContentChild; 47 48 virtual ~GMPChild(); 49 50 bool GetUTF8LibPath(nsACString& aOutLibPath); 51 52 bool GetPluginName(nsACString& aPluginName) const; 53 54 mozilla::ipc::IPCResult RecvProvideStorageId(const nsCString& aStorageId); 55 56 mozilla::ipc::IPCResult RecvStartPlugin(const nsString& aAdapter); 57 mozilla::ipc::IPCResult RecvPreloadLibs(const nsCString& aLibs); 58 59 PGMPTimerChild* AllocPGMPTimerChild(); 60 bool DeallocPGMPTimerChild(PGMPTimerChild* aActor); 61 62 PGMPStorageChild* AllocPGMPStorageChild(); 63 bool DeallocPGMPStorageChild(PGMPStorageChild* aActor); 64 65 void GMPContentChildActorDestroy(GMPContentChild* aGMPContentChild); 66 67 mozilla::ipc::IPCResult RecvCrashPluginNow(); 68 mozilla::ipc::IPCResult RecvCloseActive(); 69 70 mozilla::ipc::IPCResult RecvInitGMPContentChild( 71 Endpoint<PGMPContentChild>&& aEndpoint); 72 73 mozilla::ipc::IPCResult RecvFlushFOGData(FlushFOGDataResolver&& aResolver); 74 75 mozilla::ipc::IPCResult RecvTestTriggerMetrics( 76 TestTriggerMetricsResolver&& aResolve); 77 78 mozilla::ipc::IPCResult RecvInitProfiler( 79 Endpoint<mozilla::PProfilerChild>&& aEndpoint); 80 81 mozilla::ipc::IPCResult RecvPreferenceUpdate(const Pref& aPref); 82 83 mozilla::ipc::IPCResult RecvShutdown(ShutdownResolver&& aResolver); 84 85 #if defined(XP_WIN) 86 mozilla::ipc::IPCResult RecvInitDllServices( 87 const bool& aCanRecordReleaseTelemetry, 88 const bool& aIsReadyForBackgroundProcessing); 89 90 mozilla::ipc::IPCResult RecvGetUntrustedModulesData( 91 GetUntrustedModulesDataResolver&& aResolver); 92 mozilla::ipc::IPCResult RecvUnblockUntrustedModulesThread(); 93 #endif // defined(XP_WIN) 94 95 void ActorDestroy(ActorDestroyReason aWhy) override; 96 void ProcessingError(Result aCode, const char* aReason) override; 97 98 GMPErr GetAPI(const char* aAPIName, void* aHostAPI, void** aPluginAPI, 99 const nsACString& aKeySystem = ""_ns); 100 101 nsTArray<std::pair<nsCString, nsCString>> MakeCDMHostVerificationPaths( 102 const nsACString& aPluginLibPath); 103 104 nsTArray<RefPtr<GMPContentChild>> mGMPContentChildren; 105 106 RefPtr<GMPTimerChild> mTimerChild; 107 RefPtr<GMPStorageChild> mStorage; 108 109 RefPtr<ChildProfilerController> mProfilerController; 110 111 MessageLoop* mGMPMessageLoop; 112 nsString mPluginPath; 113 nsCString mStorageId; 114 UniquePtr<GMPLoader> mGMPLoader; 115 #ifdef XP_LINUX 116 nsTArray<void*> mLibHandles; 117 #endif 118 }; 119 120 } // namespace gmp 121 } // namespace mozilla 122 123 #endif // GMPChild_h_