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

Unified Diff: Source/WebCore/loader/cache/CachedImage.cpp

Issue 10441007: Merge 117376 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1132/
Patch Set: Created 8 years, 7 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/WebCore/loader/cache/CachedImage.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/loader/cache/CachedImage.cpp
===================================================================
--- Source/WebCore/loader/cache/CachedImage.cpp (revision 118299)
+++ Source/WebCore/loader/cache/CachedImage.cpp (working copy)
@@ -75,6 +75,7 @@
CachedImage::~CachedImage()
{
+ clearImage();
}
void CachedImage::decodedDataDeletionTimerFired(Timer<CachedImage>*)
@@ -302,7 +303,7 @@
#if ENABLE(SVG)
m_svgImageCache.clear();
#endif
- m_image = 0;
+ clearImage();
setEncodedSize(0);
}
@@ -328,6 +329,15 @@
m_image = BitmapImage::create(this);
}
+inline void CachedImage::clearImage()
+{
+ // If our Image has an observer, it's always us so we need to clear the back pointer
+ // before dropping our reference.
+ if (m_image)
+ m_image->setImageObserver(0);
+ m_image.clear();
+}
+
size_t CachedImage::maximumDecodedImageSize()
{
if (!m_loader || m_loader->reachedTerminalState())
« no previous file with comments | « Source/WebCore/loader/cache/CachedImage.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698