зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1523013 - Clear SamplesWaitingForKey::mProxy in Shutdown(). r=cpearce
There's a strong cycle of references between SamplesWaitingForKey and CDMProxy that does not get cleared unless keys actually come in. This causes a leak. One way to avoid that leak is to clear the proxy reference when the things holding the SamplesWaitingForKey is shut down. Differential Revision: https://phabricator.services.mozilla.com/D17960 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
bf0e86a9dc
Коммит
0f605627fd
|
@ -251,6 +251,7 @@ class EMEDecryptor : public MediaDataDecoder,
|
|||
return InvokeAsync(mTaskQueue, __func__, [self, this]() {
|
||||
MOZ_ASSERT(!mIsShutdown);
|
||||
mIsShutdown = true;
|
||||
mSamplesWaitingForKey->BreakCycles();
|
||||
mSamplesWaitingForKey = nullptr;
|
||||
RefPtr<MediaDataDecoder> decoder = mDecoder.forget();
|
||||
mProxy = nullptr;
|
||||
|
@ -347,6 +348,7 @@ RefPtr<MediaDataDecoder::FlushPromise> EMEMediaDataDecoderProxy::Flush() {
|
|||
RefPtr<ShutdownPromise> EMEMediaDataDecoderProxy::Shutdown() {
|
||||
RefPtr<EMEMediaDataDecoderProxy> self = this;
|
||||
return InvokeAsync(mThread, __func__, [self, this]() {
|
||||
mSamplesWaitingForKey->BreakCycles();
|
||||
mSamplesWaitingForKey = nullptr;
|
||||
mProxy = nullptr;
|
||||
return MediaDataDecoderProxy::Shutdown();
|
||||
|
|
|
@ -69,4 +69,9 @@ void SamplesWaitingForKey::Flush() {
|
|||
mSamples.Clear();
|
||||
}
|
||||
|
||||
void SamplesWaitingForKey::BreakCycles() {
|
||||
MutexAutoLock lock(mMutex);
|
||||
mProxy = nullptr;
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -42,6 +42,8 @@ class SamplesWaitingForKey {
|
|||
|
||||
void Flush();
|
||||
|
||||
void BreakCycles();
|
||||
|
||||
protected:
|
||||
~SamplesWaitingForKey();
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче