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

Unified Diff: Source/platform/graphics/test/MockImageDecoder.h

Issue 688423004: Remove multi-frame image decoder when the image is completely decoded (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fix DeferredImageDecoderTest crash Created 6 years, 1 month 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/graphics/ImageFrameGeneratorTest.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/graphics/test/MockImageDecoder.h
diff --git a/Source/platform/graphics/test/MockImageDecoder.h b/Source/platform/graphics/test/MockImageDecoder.h
index f5ab1a90e06e92737b2cd47dbea0760e847bc68a..063f49255ea74641c8e710c2472103b02faab47c 100644
--- a/Source/platform/graphics/test/MockImageDecoder.h
+++ b/Source/platform/graphics/test/MockImageDecoder.h
@@ -69,8 +69,9 @@ public:
virtual bool setSize(unsigned width, unsigned height) override
{
ImageDecoder::setSize(width, height);
- m_frameBufferCache.resize(1);
- m_frameBufferCache[0].setSize(width, height);
+ m_frameBufferCache.resize(m_client->frameCount());
+ for (size_t index = 0; index < m_client->frameCount(); ++index)
+ m_frameBufferCache[index].setSize(width, height);
return true;
}
@@ -89,12 +90,12 @@ public:
return m_client->repetitionCount();
}
- virtual ImageFrame* frameBufferAtIndex(size_t) override
+ virtual ImageFrame* frameBufferAtIndex(size_t index) override
{
m_client->frameBufferRequested();
- m_frameBufferCache[0].setStatus(m_client->status());
- return &m_frameBufferCache[0];
+ m_frameBufferCache[index].setStatus(m_client->status());
+ return &m_frameBufferCache[index];
}
virtual bool frameIsCompleteAtIndex(size_t) const override
@@ -107,7 +108,13 @@ public:
return m_client->frameDuration();
}
- void setFrameHasAlpha(bool hasAlpha) { m_frameBufferCache[0].setHasAlpha(hasAlpha); }
+ void setFrameHasAlpha(bool hasAlpha)
+ {
+ for (size_t index = 0; index < m_client->frameCount(); ++index)
+ m_frameBufferCache[index].setHasAlpha(hasAlpha);
+ }
+
+ virtual size_t clearCacheExceptFrame(size_t) override { return 0; }
private:
MockImageDecoderClient* m_client;
« no previous file with comments | « Source/platform/graphics/ImageFrameGeneratorTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698