Commit cc7aad3f authored by Leon Scroggins III's avatar Leon Scroggins III Committed by Commit Bot

Lock generator_mutex_ inside DecodeFailed

Bug: 962126

We typically lock this mutex before reading or writing to
decode_failed_. Do so in one more place to avoid a data race.

Change-Id: I0248e4dd99defc5ad3d09575096847e6455adfc9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1610085Reviewed-by: default avatarKhushal <khushalsagar@chromium.org>
Reviewed-by: default avatarStephen Chenney <schenney@chromium.org>
Commit-Queue: Stephen Chenney <schenney@chromium.org>
Auto-Submit: Leon Scroggins <scroggo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#659475}
parent c5324012
......@@ -103,7 +103,10 @@ class PLATFORM_EXPORT ImageFrameGenerator final
SkISize GetSupportedDecodeSize(const SkISize& requested_size) const;
bool IsMultiFrame() const { return is_multi_frame_; }
bool DecodeFailed() const { return decode_failed_; }
bool DecodeFailed() const {
MutexLocker lock(generator_mutex_);
return decode_failed_;
}
bool HasAlpha(size_t index);
......@@ -149,7 +152,7 @@ class PLATFORM_EXPORT ImageFrameGenerator final
const std::vector<SkISize> supported_sizes_;
// Prevents concurrent access to all variables below.
Mutex generator_mutex_;
mutable Mutex generator_mutex_;
bool decode_failed_ = false;
bool yuv_decoding_failed_ = false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment