Bug 1293577 - Protect the image decoding task path with a mutex to avoid race conditions. r=seth

This commit is contained in:
Andrew Osmond
2016-08-10 07:35:07 -04:00
parent 9fe86c0970
commit dee397cfc1
4 changed files with 17 additions and 1 deletions

View File

@@ -105,7 +105,8 @@ IDecodingTask::Resume()
///////////////////////////////////////////////////////////////////////////////
AnimationDecodingTask::AnimationDecodingTask(NotNull<Decoder*> aDecoder)
: mDecoder(aDecoder)
: mMutex("mozilla::image::AnimationDecodingTask")
, mDecoder(aDecoder)
{
MOZ_ASSERT(!mDecoder->IsMetadataDecode(),
"Use MetadataDecodingTask for metadata decodes");
@@ -116,6 +117,8 @@ AnimationDecodingTask::AnimationDecodingTask(NotNull<Decoder*> aDecoder)
void
AnimationDecodingTask::Run()
{
MutexAutoLock lock(mMutex);
while (true) {
LexerResult result = mDecoder->Decode(WrapNotNull(this));