Prevent decoded images from being destroyed when they're in use.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 2 Sep 2014 15:54:26 +0000 (15:54 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 2 Sep 2014 15:54:26 +0000 (15:54 +0000)
https://bugs.webkit.org/show_bug.cgi?id=136259.

Patch by Daewoong Jang <daewoong.jang@navercorp.com> on 2014-09-02
Reviewed by Darin Adler.

Try to fix a regression introduced by r172790. Before the patch,
CachedImage does not release its Image object if it still has clients.
However this behavior was changed due to removal of CachedResource::isSafeToMakePurgeable(),
which implied a call to CachedResource::hasClients(). This patch restores
the behavior by adding a check to hasClients() in CachedImage::destroyDecodedData().

* loader/cache/CachedImage.cpp:
(WebCore::CachedImage::destroyDecodedData):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@173172 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/loader/cache/CachedImage.cpp

index 4fbf5cb..166a9ec 100644 (file)
@@ -1,3 +1,19 @@
+2014-09-02  Daewoong Jang  <daewoong.jang@navercorp.com>
+
+        Prevent decoded images from being destroyed when they're in use.
+        https://bugs.webkit.org/show_bug.cgi?id=136259.
+
+        Reviewed by Darin Adler.
+
+        Try to fix a regression introduced by r172790. Before the patch,
+        CachedImage does not release its Image object if it still has clients.
+        However this behavior was changed due to removal of CachedResource::isSafeToMakePurgeable(),
+        which implied a call to CachedResource::hasClients(). This patch restores
+        the behavior by adding a check to hasClients() in CachedImage::destroyDecodedData().
+
+        * loader/cache/CachedImage.cpp:
+        (WebCore::CachedImage::destroyDecodedData):
+
 2014-09-01  Tim Horton  <timothy_horton@apple.com>
 
         RenderThemeMac::paintProgressBar creates a buffer without respecting the destination's acceleration setting
index c92a622..f49d7ad 100644 (file)
@@ -456,7 +456,7 @@ void CachedImage::responseReceived(const ResourceResponse& response)
 void CachedImage::destroyDecodedData()
 {
     bool canDeleteImage = !m_image || (m_image->hasOneRef() && m_image->isBitmapImage());
-    if (canDeleteImage && !isLoading()) {
+    if (canDeleteImage && !isLoading() && !hasClients()) {
         m_image = 0;
         setDecodedSize(0);
     } else if (m_image && !errorOccurred())