mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 23:31:56 +00:00
Bug 1293577 - Part 2. Add mutex to MetadataDecodingTask to protect from decoding races. r=seth
This commit is contained in:
parent
b98f2c8525
commit
e80df3e463
@ -158,7 +158,8 @@ AnimationDecodingTask::ShouldPreferSyncRun() const
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
MetadataDecodingTask::MetadataDecodingTask(NotNull<Decoder*> aDecoder)
|
||||
: mDecoder(aDecoder)
|
||||
: mMutex("mozilla::image::MetadataDecodingTask")
|
||||
, mDecoder(aDecoder)
|
||||
{
|
||||
MOZ_ASSERT(mDecoder->IsMetadataDecode(),
|
||||
"Use DecodingTask for non-metadata decodes");
|
||||
@ -167,6 +168,8 @@ MetadataDecodingTask::MetadataDecodingTask(NotNull<Decoder*> aDecoder)
|
||||
void
|
||||
MetadataDecodingTask::Run()
|
||||
{
|
||||
MutexAutoLock lock(mMutex);
|
||||
|
||||
LexerResult result = mDecoder->Decode(WrapNotNull(this));
|
||||
|
||||
if (result.is<TerminalState>()) {
|
||||
|
@ -113,6 +113,9 @@ public:
|
||||
private:
|
||||
virtual ~MetadataDecodingTask() { }
|
||||
|
||||
/// Mutex protecting access to mDecoder.
|
||||
Mutex mMutex;
|
||||
|
||||
NotNull<RefPtr<Decoder>> mDecoder;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user