зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 13ed73c1c335 (bug 1551615) for causing wpt leaks in Gecko Media Process.
This commit is contained in:
Родитель
fa3904e234
Коммит
28a4757c10
|
@ -655,9 +655,12 @@ mozilla::ipc::IPCResult GMPChild::RecvInitGMPContentChild(
|
||||||
|
|
||||||
void GMPChild::GMPContentChildActorDestroy(GMPContentChild* aGMPContentChild) {
|
void GMPChild::GMPContentChildActorDestroy(GMPContentChild* aGMPContentChild) {
|
||||||
for (uint32_t i = mGMPContentChildren.Length(); i > 0; i--) {
|
for (uint32_t i = mGMPContentChildren.Length(); i > 0; i--) {
|
||||||
RefPtr<GMPContentChild>& destroyedActor = mGMPContentChildren[i - 1];
|
UniquePtr<GMPContentChild>& toDestroy = mGMPContentChildren[i - 1];
|
||||||
if (destroyedActor.get() == aGMPContentChild) {
|
if (toDestroy.get() == aGMPContentChild) {
|
||||||
SendPGMPContentChildDestroyed();
|
SendPGMPContentChildDestroyed();
|
||||||
|
RefPtr<DeleteTask<GMPContentChild>> task =
|
||||||
|
new DeleteTask<GMPContentChild>(toDestroy.release());
|
||||||
|
MessageLoop::current()->PostTask(task.forget());
|
||||||
mGMPContentChildren.RemoveElementAt(i - 1);
|
mGMPContentChildren.RemoveElementAt(i - 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,7 @@ class GMPChild : public PGMPChild {
|
||||||
|
|
||||||
nsTArray<std::pair<nsCString, nsCString>> MakeCDMHostVerificationPaths();
|
nsTArray<std::pair<nsCString, nsCString>> MakeCDMHostVerificationPaths();
|
||||||
|
|
||||||
nsTArray<RefPtr<GMPContentChild>> mGMPContentChildren;
|
nsTArray<UniquePtr<GMPContentChild>> mGMPContentChildren;
|
||||||
|
|
||||||
RefPtr<GMPTimerChild> mTimerChild;
|
RefPtr<GMPTimerChild> mTimerChild;
|
||||||
RefPtr<GMPStorageChild> mStorage;
|
RefPtr<GMPStorageChild> mStorage;
|
||||||
|
|
|
@ -14,6 +14,12 @@
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace gmp {
|
namespace gmp {
|
||||||
|
|
||||||
|
GMPContentChild::GMPContentChild(GMPChild* aChild) : mGMPChild(aChild) {
|
||||||
|
MOZ_COUNT_CTOR(GMPContentChild);
|
||||||
|
}
|
||||||
|
|
||||||
|
GMPContentChild::~GMPContentChild() { MOZ_COUNT_DTOR(GMPContentChild); }
|
||||||
|
|
||||||
MessageLoop* GMPContentChild::GMPMessageLoop() {
|
MessageLoop* GMPContentChild::GMPMessageLoop() {
|
||||||
return mGMPChild->GMPMessageLoop();
|
return mGMPChild->GMPMessageLoop();
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,11 +16,8 @@ class GMPChild;
|
||||||
|
|
||||||
class GMPContentChild : public PGMPContentChild, public GMPSharedMem {
|
class GMPContentChild : public PGMPContentChild, public GMPSharedMem {
|
||||||
public:
|
public:
|
||||||
// Mark AddRef and Release as `final`, as they overload pure virtual
|
explicit GMPContentChild(GMPChild* aChild);
|
||||||
// implementations in PGMPContentChild.
|
virtual ~GMPContentChild();
|
||||||
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(GMPContentChild, final)
|
|
||||||
|
|
||||||
explicit GMPContentChild(GMPChild* aChild) : mGMPChild(aChild) {}
|
|
||||||
|
|
||||||
MessageLoop* GMPMessageLoop();
|
MessageLoop* GMPMessageLoop();
|
||||||
|
|
||||||
|
@ -48,9 +45,6 @@ class GMPContentChild : public PGMPContentChild, public GMPSharedMem {
|
||||||
bool IsUsed();
|
bool IsUsed();
|
||||||
|
|
||||||
GMPChild* mGMPChild;
|
GMPChild* mGMPChild;
|
||||||
|
|
||||||
private:
|
|
||||||
~GMPContentChild() = default;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace gmp
|
} // namespace gmp
|
||||||
|
|
|
@ -42,11 +42,23 @@ GMPContentParent::~GMPContentParent() {
|
||||||
GetBoolString(mChromiumCDMs.IsEmpty()), mCloseBlockerCount);
|
GetBoolString(mChromiumCDMs.IsEmpty()), mCloseBlockerCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class ReleaseGMPContentParent : public Runnable {
|
||||||
|
public:
|
||||||
|
explicit ReleaseGMPContentParent(GMPContentParent* aToRelease)
|
||||||
|
: Runnable("gmp::ReleaseGMPContentParent"), mToRelease(aToRelease) {}
|
||||||
|
|
||||||
|
NS_IMETHOD Run() override { return NS_OK; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
RefPtr<GMPContentParent> mToRelease;
|
||||||
|
};
|
||||||
|
|
||||||
void GMPContentParent::ActorDestroy(ActorDestroyReason aWhy) {
|
void GMPContentParent::ActorDestroy(ActorDestroyReason aWhy) {
|
||||||
GMP_LOG_DEBUG("GMPContentParent::ActorDestroy(this=%p, aWhy=%d)", this,
|
GMP_LOG_DEBUG("GMPContentParent::ActorDestroy(this=%p, aWhy=%d)", this,
|
||||||
static_cast<int>(aWhy));
|
static_cast<int>(aWhy));
|
||||||
MOZ_ASSERT(mVideoDecoders.IsEmpty() && mVideoEncoders.IsEmpty() &&
|
MOZ_ASSERT(mVideoDecoders.IsEmpty() && mVideoEncoders.IsEmpty() &&
|
||||||
mChromiumCDMs.IsEmpty());
|
mChromiumCDMs.IsEmpty());
|
||||||
|
NS_DispatchToCurrentThread(new ReleaseGMPContentParent(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
void GMPContentParent::CheckThread() {
|
void GMPContentParent::CheckThread() {
|
||||||
|
|
|
@ -22,9 +22,7 @@ class GMPContentParent final : public PGMPContentParent, public GMPSharedMem {
|
||||||
friend class PGMPContentParent;
|
friend class PGMPContentParent;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Mark AddRef and Release as `final`, as they overload pure virtual
|
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(GMPContentParent)
|
||||||
// implementations in PGMPContentParent.
|
|
||||||
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(GMPContentParent, final)
|
|
||||||
|
|
||||||
explicit GMPContentParent(GMPParent* aParent = nullptr);
|
explicit GMPContentParent(GMPParent* aParent = nullptr);
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ include protocol PChromiumCDM;
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace gmp {
|
namespace gmp {
|
||||||
|
|
||||||
intr refcounted protocol PGMPContent
|
intr protocol PGMPContent
|
||||||
{
|
{
|
||||||
manages PGMPVideoDecoder;
|
manages PGMPVideoDecoder;
|
||||||
manages PGMPVideoEncoder;
|
manages PGMPVideoEncoder;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче