Chromium Code Reviews| 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 7da3b9beaf524831f080a8816321202214490092..8d06fa7d6f880a364adcaaa6a97558658621b921 100644 |
| --- a/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h |
| +++ b/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h |
| @@ -113,6 +113,7 @@ public: |
| : m_premultiplyAlpha(alphaOption == AlphaPremultiplied) |
| , m_ignoreGammaAndColorProfile(colorOptions == GammaAndColorProfileIgnored) |
| , m_maxDecodedBytes(maxDecodedBytes) |
| + , m_haveUpdatedFrameCount(true) |
| , m_sizeAvailable(false) |
| , m_isAllDataReceived(false) |
| , m_failed(false) { } |
| @@ -137,6 +138,7 @@ public: |
| return; |
| m_data = data; |
| m_isAllDataReceived = allDataReceived; |
| + m_haveUpdatedFrameCount = false; |
| onSetData(m_data.get()); |
| } |
| @@ -161,6 +163,12 @@ public: |
| return !m_failed && m_sizeAvailable; |
| } |
| + // Whether the requested frame is fully decoded. |
| + inline bool frameIsCompleteAtIndex(size_t frameIndex) const |
| + { |
| + return (frameIndex < m_frameBufferCache.size()) && (m_frameBufferCache[frameIndex].getStatus() == ImageFrame::FrameComplete); |
| + } |
| + |
| virtual IntSize size() const { return m_size; } |
| // Decoders which downsample images should override this method to |
| @@ -216,11 +224,8 @@ public: |
| // ImageDecoder-owned pointer. |
| ImageFrame* frameBufferAtIndex(size_t); |
| - // Whether the requested frame has alpha. |
| - virtual bool frameHasAlphaAtIndex(size_t) const; |
| - |
| // Whether or not the frame is fully received. |
| - virtual bool frameIsCompleteAtIndex(size_t) const; |
| + virtual bool frameIsFullyReceivedAtIndex(size_t) const; |
| // Duration for displaying a frame in seconds. This method is only used by |
| // animated images. |
| @@ -231,6 +236,9 @@ public: |
| // it has been cleared). |
| virtual size_t frameBytesAtIndex(size_t) const; |
| + // Whether the requested frame has alpha. |
| + bool frameHasAlphaAtIndex(size_t) const; |
| + |
| ImageOrientation orientation() const { return m_orientation; } |
| static bool deferredImageDecodingEnabled(); |
| @@ -331,6 +339,9 @@ protected: |
| // memory devices. |
| size_t m_maxDecodedBytes; |
| + // Track if frameCount() was called to parse frame count after setData(). |
| + bool m_haveUpdatedFrameCount; |
|
scroggo_chromium
2016/06/02 21:00:14
According to the style guide (https://www.chromium
aleksandar.stojiljkovic
2016/06/03 19:33:57
Thanks. Done.
|
| + |
| private: |
| // Some code paths compute the size of the image as "width * height * 4" |
| // and return it as a (signed) int. Avoid overflow. |