Title: [173172] trunk/Source/WebCore
Revision
173172
Author
[email protected]
Date
2014-09-02 08:54:26 -0700 (Tue, 02 Sep 2014)

Log Message

Prevent decoded images from being destroyed when they're in use.
https://bugs.webkit.org/show_bug.cgi?id=136259.

Patch by Daewoong Jang <[email protected]> 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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (173171 => 173172)


--- trunk/Source/WebCore/ChangeLog	2014-09-02 15:51:33 UTC (rev 173171)
+++ trunk/Source/WebCore/ChangeLog	2014-09-02 15:54:26 UTC (rev 173172)
@@ -1,3 +1,19 @@
+2014-09-02  Daewoong Jang  <[email protected]>
+
+        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  <[email protected]>
 
         RenderThemeMac::paintProgressBar creates a buffer without respecting the destination's acceleration setting

Modified: trunk/Source/WebCore/loader/cache/CachedImage.cpp (173171 => 173172)


--- trunk/Source/WebCore/loader/cache/CachedImage.cpp	2014-09-02 15:51:33 UTC (rev 173171)
+++ trunk/Source/WebCore/loader/cache/CachedImage.cpp	2014-09-02 15:54:26 UTC (rev 173172)
@@ -456,7 +456,7 @@
 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())
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to