blink/images: Ensure thread-safe access to ImageDecoder frames.
ImageFrameGenerator ensures that accessing the cached ImageDecoders is thread-safe using a mutex, locked for the duration of ImageFrameGenerator::TryToResumeDecode. However, the bitmap returned by this method holds a reference to the pixel buffer which can still be mutated by the ImageDecoder. This can introduce a race between copying the pixel buffer to the caller's memory and another thread writing to it to decode a subsequent frame. Ensure the above is avoided by holding the mutex for the duration of the decode and copying the pixel buffer to the caller's memory if necessary. R=chrishtr@chromium.org BUG=840946 Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2 Change-Id: I110c54232385b5d335001f221a480371968f9551 Reviewed-on: https://chromium-review.googlesource.com/1050619 Commit-Queue: Khushal <khushalsagar@chromium.org> Reviewed-by:Chris Harrelson <chrishtr@chromium.org> Cr-Commit-Position: refs/heads/master@{#557059}
Showing
Please register or sign in to comment