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

Unified Diff: Source/platform/image-decoders/ImageDecoder.cpp

Issue 23532077: [Experiment] Animated image decoder benchmark tool Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 11 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
« no previous file with comments | « Source/platform/image-decoders/ImageDecoder.h ('k') | Source/web/ImageDecodeBench.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « Source/platform/image-decoders/ImageDecoder.h ('k') | Source/web/ImageDecodeBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698