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

Unified Diff: third_party/WebKit/Source/platform/graphics/BitmapImageTest.cpp

Issue 1857543002: Don't recreate SkImages for high-res (GIF, WEBP...) animations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review #4 fix. Thanks @pkasting. Created 4 years, 9 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/graphics/BitmapImageTest.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/BitmapImageTest.cpp b/third_party/WebKit/Source/platform/graphics/BitmapImageTest.cpp
index 7e9d0cf23347076588268ba618b9a509e22c2490..3b2c50f13a8da366798ce039ac7be658ebe13934 100644
--- a/third_party/WebKit/Source/platform/graphics/BitmapImageTest.cpp
+++ b/third_party/WebKit/Source/platform/graphics/BitmapImageTest.cpp
@@ -69,7 +69,7 @@ public:
}
// Accessors to BitmapImage's protected methods.
- void destroyDecodedData(bool destroyAll) { m_image->destroyDecodedData(destroyAll); }
+ void destroyDecodedData() { m_image->destroyDecodedData(); }
size_t frameCount() { return m_image->frameCount(); }
void frameAtIndex(size_t index)
{
@@ -145,24 +145,12 @@ private:
bool m_enableDeferredDecoding;
};
-TEST_F(BitmapImageTest, destroyDecodedDataExceptCurrentFrame)
-{
- loadImage("/LayoutTests/fast/images/resources/animated-10color.gif");
- size_t totalSize = decodedSize();
- size_t frame = frameCount() / 2;
- setCurrentFrame(frame);
- size_t size = frameDecodedSize(frame);
- destroyDecodedData(false);
- EXPECT_LT(m_imageObserver->m_lastDecodedSizeChangedDelta, 0);
- EXPECT_GE(m_imageObserver->m_lastDecodedSizeChangedDelta, -static_cast<int>(totalSize - size));
-}
-
TEST_F(BitmapImageTest, destroyAllDecodedData)
{
loadImage("/LayoutTests/fast/images/resources/animated-10color.gif");
size_t totalSize = decodedSize();
EXPECT_GT(totalSize, 0u);
- destroyDecodedData(true);
+ destroyDecodedData();
EXPECT_EQ(-static_cast<int>(totalSize), m_imageObserver->m_lastDecodedSizeChangedDelta);
EXPECT_EQ(0u, decodedSize());
}
@@ -266,13 +254,6 @@ TEST_F(BitmapImageTest, correctDecodedDataSize)
frameAtIndex(1);
int frameSize = static_cast<int>(m_image->size().area() * sizeof(ImageFrame::PixelData));
EXPECT_EQ(frameSize * 2, m_imageObserver->m_lastDecodedSizeChangedDelta);
-
- // Trying to destroy all data except an undecoded frame should cause the
- // decoder to seek backwards and preserve the most recent previous frame
- // necessary to decode that undecoded frame, and destroy all other frames.
- setCurrentFrame(2);
- destroyDecodedData(false);
- EXPECT_EQ(-frameSize, m_imageObserver->m_lastDecodedSizeChangedDelta);
}
TEST_F(BitmapImageTest, recachingFrameAfterDataChanged)
@@ -305,12 +286,6 @@ TEST_F(BitmapImageDeferredDecodingTest, correctDecodedDataSize)
int frameSize = static_cast<int>(m_image->size().area() * sizeof(ImageFrame::PixelData));
EXPECT_EQ(frameSize, m_imageObserver->m_lastDecodedSizeChangedDelta);
frameAtIndex(0);
Peter Kasting 2016/04/05 01:55:58 This frameAtIndex() call should be removed as well
-
- // Trying to destroy all data except an undecoded frame should go ahead and
- // destroy all other frames.
- setCurrentFrame(2);
- destroyDecodedData(false);
- EXPECT_EQ(-frameSize * 2, m_imageObserver->m_lastDecodedSizeChangedDelta);
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698