mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 22:01:30 +00:00
Bug 1570369 - Part 4: Use IPDL refcounted for PChromiumCDM, r=jya
Differential Revision: https://phabricator.services.mozilla.com/D40255 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
af25db52b0
commit
c67bb3eb29
@ -20,7 +20,9 @@ class ChromiumCDMChild : public PChromiumCDMChild,
|
|||||||
public cdm::Host_9,
|
public cdm::Host_9,
|
||||||
public cdm::Host_10 {
|
public cdm::Host_10 {
|
||||||
public:
|
public:
|
||||||
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(ChromiumCDMChild);
|
// Mark AddRef and Release as `final`, as they overload pure virtual
|
||||||
|
// implementations in PChromiumCDMChild.
|
||||||
|
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(ChromiumCDMChild, final);
|
||||||
|
|
||||||
explicit ChromiumCDMChild(GMPContentChild* aPlugin);
|
explicit ChromiumCDMChild(GMPContentChild* aPlugin);
|
||||||
|
|
||||||
|
@ -36,7 +36,9 @@ class ChromiumCDMParent final : public PChromiumCDMParent,
|
|||||||
public:
|
public:
|
||||||
typedef MozPromise<bool, MediaResult, /* IsExclusive = */ true> InitPromise;
|
typedef MozPromise<bool, MediaResult, /* IsExclusive = */ true> InitPromise;
|
||||||
|
|
||||||
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(ChromiumCDMParent)
|
// Mark AddRef and Release as `final`, as they overload pure virtual
|
||||||
|
// implementations in PChromiumCDMParent.
|
||||||
|
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(ChromiumCDMParent, final)
|
||||||
|
|
||||||
ChromiumCDMParent(GMPContentParent* aContentParent, uint32_t aPluginId);
|
ChromiumCDMParent(GMPContentParent* aContentParent, uint32_t aPluginId);
|
||||||
|
|
||||||
|
@ -61,15 +61,8 @@ bool GMPContentChild::DeallocPGMPVideoEncoderChild(
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
PChromiumCDMChild* GMPContentChild::AllocPChromiumCDMChild() {
|
already_AddRefed<PChromiumCDMChild> GMPContentChild::AllocPChromiumCDMChild() {
|
||||||
ChromiumCDMChild* actor = new ChromiumCDMChild(this);
|
return MakeAndAddRef<ChromiumCDMChild>(this);
|
||||||
actor->AddRef();
|
|
||||||
return actor;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool GMPContentChild::DeallocPChromiumCDMChild(PChromiumCDMChild* aActor) {
|
|
||||||
static_cast<ChromiumCDMChild*>(aActor)->Release();
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mozilla::ipc::IPCResult GMPContentChild::RecvPGMPVideoDecoderConstructor(
|
mozilla::ipc::IPCResult GMPContentChild::RecvPGMPVideoDecoderConstructor(
|
||||||
|
@ -35,8 +35,7 @@ class GMPContentChild : public PGMPContentChild, public GMPSharedMem {
|
|||||||
PGMPVideoEncoderChild* AllocPGMPVideoEncoderChild();
|
PGMPVideoEncoderChild* AllocPGMPVideoEncoderChild();
|
||||||
bool DeallocPGMPVideoEncoderChild(PGMPVideoEncoderChild* aActor);
|
bool DeallocPGMPVideoEncoderChild(PGMPVideoEncoderChild* aActor);
|
||||||
|
|
||||||
PChromiumCDMChild* AllocPChromiumCDMChild();
|
already_AddRefed<PChromiumCDMChild> AllocPChromiumCDMChild();
|
||||||
bool DeallocPChromiumCDMChild(PChromiumCDMChild* aActor);
|
|
||||||
|
|
||||||
void ActorDestroy(ActorDestroyReason aWhy) override;
|
void ActorDestroy(ActorDestroyReason aWhy) override;
|
||||||
void ProcessingError(Result aCode, const char* aReason) override;
|
void ProcessingError(Result aCode, const char* aReason) override;
|
||||||
|
@ -162,11 +162,11 @@ nsCOMPtr<nsISerialEventTarget> GMPContentParent::GMPEventTarget() {
|
|||||||
|
|
||||||
already_AddRefed<ChromiumCDMParent> GMPContentParent::GetChromiumCDM() {
|
already_AddRefed<ChromiumCDMParent> GMPContentParent::GetChromiumCDM() {
|
||||||
GMP_LOG("GMPContentParent::GetChromiumCDM(this=%p)", this);
|
GMP_LOG("GMPContentParent::GetChromiumCDM(this=%p)", this);
|
||||||
PChromiumCDMParent* actor = SendPChromiumCDMConstructor();
|
|
||||||
if (!actor) {
|
RefPtr<ChromiumCDMParent> parent = new ChromiumCDMParent(this, GetPluginId());
|
||||||
|
if (!SendPChromiumCDMConstructor(parent)) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
RefPtr<ChromiumCDMParent> parent = static_cast<ChromiumCDMParent*>(actor);
|
|
||||||
|
|
||||||
// TODO: Remove parent from mChromiumCDMs in ChromiumCDMParent::Destroy().
|
// TODO: Remove parent from mChromiumCDMs in ChromiumCDMParent::Destroy().
|
||||||
mChromiumCDMs.AppendElement(parent);
|
mChromiumCDMs.AppendElement(parent);
|
||||||
@ -209,13 +209,6 @@ nsresult GMPContentParent::GetGMPVideoEncoder(GMPVideoEncoderParent** aGMPVE) {
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
PChromiumCDMParent* GMPContentParent::AllocPChromiumCDMParent() {
|
|
||||||
GMP_LOG("GMPContentParent::AllocPChromiumCDMParent(this=%p)", this);
|
|
||||||
ChromiumCDMParent* parent = new ChromiumCDMParent(this, GetPluginId());
|
|
||||||
NS_ADDREF(parent);
|
|
||||||
return parent;
|
|
||||||
}
|
|
||||||
|
|
||||||
PGMPVideoDecoderParent* GMPContentParent::AllocPGMPVideoDecoderParent(
|
PGMPVideoDecoderParent* GMPContentParent::AllocPGMPVideoDecoderParent(
|
||||||
const uint32_t& aDecryptorId) {
|
const uint32_t& aDecryptorId) {
|
||||||
GMP_LOG("GMPContentParent::AllocPGMPVideoDecoderParent(this=%p)", this);
|
GMP_LOG("GMPContentParent::AllocPGMPVideoDecoderParent(this=%p)", this);
|
||||||
@ -224,14 +217,6 @@ PGMPVideoDecoderParent* GMPContentParent::AllocPGMPVideoDecoderParent(
|
|||||||
return vdp;
|
return vdp;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GMPContentParent::DeallocPChromiumCDMParent(PChromiumCDMParent* aActor) {
|
|
||||||
GMP_LOG("GMPContentParent::DeallocPChromiumCDMParent(this=%p, aActor=%p)",
|
|
||||||
this, aActor);
|
|
||||||
ChromiumCDMParent* parent = static_cast<ChromiumCDMParent*>(aActor);
|
|
||||||
NS_RELEASE(parent);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool GMPContentParent::DeallocPGMPVideoDecoderParent(
|
bool GMPContentParent::DeallocPGMPVideoDecoderParent(
|
||||||
PGMPVideoDecoderParent* aActor) {
|
PGMPVideoDecoderParent* aActor) {
|
||||||
GMP_LOG("GMPContentParent::DeallocPGMPVideoDecoderParent(this=%p, aActor=%p)",
|
GMP_LOG("GMPContentParent::DeallocPGMPVideoDecoderParent(this=%p, aActor=%p)",
|
||||||
|
@ -76,9 +76,6 @@ class GMPContentParent final : public PGMPContentParent, public GMPSharedMem {
|
|||||||
PGMPVideoEncoderParent* AllocPGMPVideoEncoderParent() override;
|
PGMPVideoEncoderParent* AllocPGMPVideoEncoderParent() override;
|
||||||
bool DeallocPGMPVideoEncoderParent(PGMPVideoEncoderParent* aActor) override;
|
bool DeallocPGMPVideoEncoderParent(PGMPVideoEncoderParent* aActor) override;
|
||||||
|
|
||||||
PChromiumCDMParent* AllocPChromiumCDMParent() override;
|
|
||||||
bool DeallocPChromiumCDMParent(PChromiumCDMParent* aActor) override;
|
|
||||||
|
|
||||||
void CloseIfUnused();
|
void CloseIfUnused();
|
||||||
// Needed because NewRunnableMethod tried to use the class that the method
|
// Needed because NewRunnableMethod tried to use the class that the method
|
||||||
// lives on to store the receiver, but PGMPContentParent isn't refcounted.
|
// lives on to store the receiver, but PGMPContentParent isn't refcounted.
|
||||||
|
@ -9,7 +9,7 @@ include GMPTypes;
|
|||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace gmp {
|
namespace gmp {
|
||||||
|
|
||||||
async protocol PChromiumCDM
|
async refcounted protocol PChromiumCDM
|
||||||
{
|
{
|
||||||
manager PGMPContent;
|
manager PGMPContent;
|
||||||
child:
|
child:
|
||||||
|
Loading…
Reference in New Issue
Block a user