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

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: better check in unit test 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 7da3b9beaf524831f080a8816321202214490092..fc0cd8feeb94aca766ae715659b8eb8d1093f62c 100644
--- a/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h
+++ b/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h
@@ -115,6 +115,7 @@ public:
, m_maxDecodedBytes(maxDecodedBytes)
, m_sizeAvailable(false)
, m_isAllDataReceived(false)
+ , m_haveUpdatedFrameCount(true)
, m_failed(false) { }
virtual ~ImageDecoder() { }
@@ -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;
+ // Whether frameCount() was called to update frame count after setData().
Peter Kasting 2016/06/10 00:10:02 Nit: update -> update the
+ 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.
@@ -344,6 +355,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