Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(276)

Unified Diff: third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h

Issue 1962563002: Fix ImageDecoder::frameIsCompleteAtIndex - fully received instead of decoded. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 70198f1f273d547dd024ccacaf14089673ce908e..ab4aebb07ad2fd562232961211dc5c6a9621492c 100644
--- a/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h
+++ b/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h
@@ -101,6 +101,7 @@ public:
, m_maxDecodedBytes(maxDecodedBytes)
, m_sizeAvailable(false)
, m_isAllDataReceived(false)
+ , m_haveUpdatedFrameCount(true)
, m_failed(false) { }
virtual ~ImageDecoder() { }
@@ -123,6 +124,7 @@ public:
return;
m_data = data;
m_isAllDataReceived = allDataReceived;
+ m_haveUpdatedFrameCount = false;
onSetData(m_data.get());
}
@@ -147,6 +149,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
@@ -202,11 +210,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.
@@ -217,6 +222,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; }
void setIgnoreGammaAndColorProfile(bool flag) { m_ignoreGammaAndColorProfile = flag; }
@@ -315,6 +323,9 @@ protected:
// memory devices.
size_t m_maxDecodedBytes;
+ // Whether frameCount() was called to update frame count after setData().
+ bool haveUpdatedFrameCount() const { return m_haveUpdatedFrameCount; }
+
private:
// Some code paths compute the size of the image as "width * height * 4"
// and return it as a (signed) int. Avoid overflow.
@@ -328,6 +339,7 @@ private:
IntSize m_size;
bool m_sizeAvailable;
bool m_isAllDataReceived;
+ bool m_haveUpdatedFrameCount;
bool m_failed;
#if USE(QCMSLIB)

Powered by Google App Engine
This is Rietveld 408576698