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

Unified Diff: Source/platform/graphics/BitmapImage.cpp

Issue 1359953002: [BitmapImage] Don't destroy lazy-decoded frames Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/graphics/BitmapImage.cpp
diff --git a/Source/platform/graphics/BitmapImage.cpp b/Source/platform/graphics/BitmapImage.cpp
index e324ae2238771132d93295642084fe0955851313..29995ff9d0d3cbdbe299b4ece3a98803e0a9dea3 100644
--- a/Source/platform/graphics/BitmapImage.cpp
+++ b/Source/platform/graphics/BitmapImage.cpp
@@ -139,8 +139,16 @@ void BitmapImage::destroyDecodedDataIfNecessary()
// to one frame at a time.
static const size_t cLargeAnimationCutoff = 5242880;
size_t allFrameBytes = 0;
- for (size_t i = 0; i < m_frames.size(); ++i)
+ for (size_t i = 0; i < m_frames.size(); ++i) {
+ // The memory for lazy-decoded frames is managed externally.
+ if (m_frames[i].m_frame && m_frames[i].m_frame->isLazyGenerated()) {
+ // We don't mix lazy/non-lazy frames.
+ ASSERT(!allFrameBytes);
+ break;
+ }
+
allFrameBytes += m_frames[i].m_frameBytes;
+ }
if (allFrameBytes > cLargeAnimationCutoff) {
destroyDecodedData(false);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698