GMPContentChild.h (2107B)
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 GMPContentChild_h_ 7 #define GMPContentChild_h_ 8 9 #include "mozilla/gmp/PGMPContentChild.h" 10 11 #if defined(MOZ_SANDBOX) && defined(MOZ_DEBUG) && defined(ENABLE_TESTS) 12 # include "mozilla/SandboxTestingChild.h" 13 #endif 14 15 namespace mozilla::gmp { 16 17 class GMPChild; 18 19 /** 20 * This class allows the GMP process to receive requests to create GMP 21 * decoder/encoder objects on behalf of the parent/content processes. 22 */ 23 class GMPContentChild final : public PGMPContentChild { 24 public: 25 // Mark AddRef and Release as `final`, as they overload pure virtual 26 // implementations in PGMPContentChild. 27 NS_INLINE_DECL_THREADSAFE_REFCOUNTING(GMPContentChild, final) 28 29 explicit GMPContentChild(GMPChild* aChild) : mGMPChild(aChild) {} 30 31 MessageLoop* GMPMessageLoop(); 32 33 mozilla::ipc::IPCResult RecvPGMPVideoDecoderConstructor( 34 PGMPVideoDecoderChild* aActor) override; 35 mozilla::ipc::IPCResult RecvPGMPVideoEncoderConstructor( 36 PGMPVideoEncoderChild* aActor) override; 37 mozilla::ipc::IPCResult RecvPChromiumCDMConstructor( 38 PChromiumCDMChild* aActor, const nsACString& aKeySystem) override; 39 40 already_AddRefed<PGMPVideoDecoderChild> AllocPGMPVideoDecoderChild(); 41 42 already_AddRefed<PGMPVideoEncoderChild> AllocPGMPVideoEncoderChild(); 43 44 already_AddRefed<PChromiumCDMChild> AllocPChromiumCDMChild( 45 const nsACString& aKeySystem); 46 47 #if defined(MOZ_SANDBOX) && defined(MOZ_DEBUG) && defined(ENABLE_TESTS) 48 mozilla::ipc::IPCResult RecvInitSandboxTesting( 49 Endpoint<PSandboxTestingChild>&& aEndpoint); 50 #endif 51 52 void ActorDestroy(ActorDestroyReason aWhy) override; 53 void ProcessingError(Result aCode, const char* aReason) override; 54 55 void CloseActive(); 56 bool IsUsed(); 57 58 GMPChild* mGMPChild; 59 60 private: 61 ~GMPContentChild() = default; 62 }; 63 64 } // namespace mozilla::gmp 65 66 #endif // GMPContentChild_h_