| Index: third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h
|
| diff --git a/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h b/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h
|
| index cb8ccebc0d91dd6a8319b1342863ece1bd302189..c5dd9532fdea684918ebabd03d40b07abeb0619d 100644
|
| --- a/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h
|
| +++ b/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h
|
| @@ -240,11 +240,13 @@ class PLATFORM_EXPORT ImageDecoder {
|
|
|
| bool failed() const { return m_failed; }
|
|
|
| - // Clears decoded pixel data from all frames except the provided frame.
|
| + // Clears decoded pixel data from all frames except the provided frame. If
|
| + // subsequent frames depend on this frame's required previous frame, then that
|
| + // frame is also kept in cache to prevent re-decoding from the beginning.
|
| // Callers may pass WTF::kNotFound to clear all frames.
|
| // Note: If |m_frameBufferCache| contains only one frame, it won't be cleared.
|
| // Returns the number of bytes of frame data actually cleared.
|
| - virtual size_t clearCacheExceptFrame(size_t);
|
| + size_t clearCacheExceptFrame(size_t);
|
|
|
| // If the image has a cursor hot-spot, stores it in the argument
|
| // and returns true. Otherwise returns false.
|
| @@ -343,6 +345,26 @@ class PLATFORM_EXPORT ImageDecoder {
|
| // future decodes to purge old frames as it goes.
|
| void updateAggressivePurging(size_t index);
|
|
|
| + // The method is only relevant for multi-frame images.
|
| + //
|
| + // This method indicates whether the provided frame has enough data to decode
|
| + // successive frames that depend on it. It is used by clearCacheExceptFrame
|
| + // to determine which frame to keep in cache when the indicated frame is not
|
| + // yet sufficiently decoded.
|
| + //
|
| + // The default condition is that the frame status needs to be FramePartial or
|
| + // FrameComplete, since the data of previous frames is copied in
|
| + // initFrameBuffer() before setting the status to FramePartial. For WebP,
|
| + // however, the status needs to be FrameComplete since the complete buffer is
|
| + // used to do alpha blending in WEBPImageDecoder::applyPostProcessing().
|
| + //
|
| + // Before calling this, verify that frame |index| exists by checking that
|
| + // |index| is smaller than |m_frameBufferCache|.size().
|
| + virtual bool frameStatusSufficientForSuccessors(size_t index) {
|
| + DCHECK(index < m_frameBufferCache.size());
|
| + return m_frameBufferCache[index].getStatus() != ImageFrame::FrameEmpty;
|
| + }
|
| +
|
| private:
|
| enum class SniffResult { JPEG, PNG, GIF, WEBP, ICO, BMP, Invalid };
|
|
|
|
|