Bug 1319190 - Make sure we release the last VideoDecoderChild ref on the video manager thread. r=dvander

--HG--
extra : rebase_source : 52450808793a3be6abd04fe7be345d3ac1b608d3
This commit is contained in:
Matt Woodrow 2016-11-22 15:51:18 +13:00
parent 1c5f147c9f
commit 6c7788b023

View File

@ -37,10 +37,18 @@ RemoteVideoDecoder::~RemoteVideoDecoder()
// task queue for the VideoDecoderChild thread to keep
// it alive until we send the delete message.
RefPtr<VideoDecoderChild> actor = mActor;
VideoDecoderManagerChild::GetManagerThread()->Dispatch(NS_NewRunnableFunction([actor]() {
RefPtr<Runnable> task = NS_NewRunnableFunction([actor]() {
MOZ_ASSERT(actor);
actor->DestroyIPDL();
}), NS_DISPATCH_NORMAL);
});
// Drop out references to the actor so that the last ref
// always gets released on the manager thread.
actor = nullptr;
mActor = nullptr;
VideoDecoderManagerChild::GetManagerThread()->Dispatch(task.forget(), NS_DISPATCH_NORMAL);
}
RefPtr<MediaDataDecoder::InitPromise>