Flush pending writes on Skia scratch textures used in Chromium
Chromium uses textures allocated by Skia's internal resource manager for
video rendering. In case the textures are recycled, they might have
pending write operations on them. Most commonly they have a pending
framebuffer discard that gets inserted when a texture is chosen for
recycling. These pending operations need to be flushed before the texture
is accessed outside of Skia. Otherwise it's possible that the pending
operations get deferred until after Chromium uses the texture.
In other words, we need to guarantee that the order of operations is:
1. Pending writes from Skia are flushed
2. Chromium writes to the texture without involving Skia
3. Chromium requests a readback of the texture using Skia
4. Skia reads back the texture
instead of
1. Chromium writes to the texture without involving Skia
2. Chromium requests a readback of the texture using Skia
3. Pending writes from Skia are flushed
4. Skia reads back the texture
BUG=504773, 499555
TEST=WebGL conformance tests
Review URL: https://codereview.chromium.org/
1225583003
Cr-Commit-Position: refs/heads/master@{#338089}