Index: Source/platform/image-decoders/ImageDecoder.cpp |
diff --git a/Source/platform/image-decoders/ImageDecoder.cpp b/Source/platform/image-decoders/ImageDecoder.cpp |
index cb5774dffc510ff6718f93165df02db3011adc39..87f54ce2b51bec202dd87354a26536f4779ec158 100644 |
--- a/Source/platform/image-decoders/ImageDecoder.cpp |
+++ b/Source/platform/image-decoders/ImageDecoder.cpp |
@@ -198,4 +198,44 @@ size_t ImageDecoder::findRequiredPreviousFrame(size_t frameIndex, bool frameRect |
} |
} |
+size_t ImageDecoder::countIndependentFrames() const |
+{ |
+ size_t count = 0; |
+ for (size_t i = 0; i < m_frameBufferCache.size(); ++i) { |
+ if (m_frameBufferCache[i].requiredPreviousFrameIndex() == kNotFound) |
+ ++count; |
+ } |
+ return count; |
+} |
+ |
+float ImageDecoder::countAverageDependentFrames() const |
+{ |
+ const size_t numFrames = m_frameBufferCache.size(); |
+ float total = 0; |
+ for (size_t i = 0; i < numFrames; ++i) { |
+ const ImageFrame* buffer = &m_frameBufferCache[i]; |
+ while (buffer->requiredPreviousFrameIndex() != kNotFound) { |
+ ++total; |
+ buffer = &m_frameBufferCache[buffer->requiredPreviousFrameIndex()]; |
+ } |
+ } |
+ return total / numFrames; |
+} |
+ |
+size_t ImageDecoder::countMaxDependentFrames() const |
+{ |
+ size_t max = 0; |
+ for (size_t i = 0; i < m_frameBufferCache.size(); ++i) { |
+ size_t count = 0; |
+ const ImageFrame* buffer = &m_frameBufferCache[i]; |
+ while (buffer->requiredPreviousFrameIndex() != kNotFound) { |
+ ++count; |
+ buffer = &m_frameBufferCache[buffer->requiredPreviousFrameIndex()]; |
+ } |
+ if (count > max) |
+ max = count; |
+ } |
+ return max; |
+} |
+ |
} // namespace WebCore |