[mac] Keep around more decoded image data, since it's purgeable
authorakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Nov 2014 00:36:33 +0000 (00:36 +0000)
committerakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Nov 2014 00:36:33 +0000 (00:36 +0000)
commitbf25c9421109bfe90b2d2d51403b24b30d625fd6
treebce4d3431cbf5738e6616f67056b5e66041b3012
parentc959f3eb24276cafb05e473131fb8d086d10ff30
[mac] Keep around more decoded image data, since it's purgeable
<https://webkit.org/b/125273>
<rdar://problem/13205438>

Patch by Tim Horton <timothy_horton@apple.com> on 2014-11-02
Reviewed by Simon Fraser and Andreas Kling.

No new tests, just an optimization.

Instead of throwing away decoded image data eagerly, allow the operating
system to manage the memory via the standard purgeability mechanism,
where it can.

This improves the performance on some pathological cases (extremely large
animated GIFs) by up to 8x.

* loader/cache/MemoryCache.cpp:
(WebCore::MemoryCache::pruneLiveResourcesToSize):
Don't prune live resources' decoded data if it is purgeable.

* platform/graphics/BitmapImage.cpp:
(WebCore::BitmapImage::destroyDecodedDataIfNecessary):
Don't eagerly throw away decoded image data if it's purgeable.

* loader/cache/CachedImage.h:
* loader/cache/CachedResource.h:
(WebCore::CachedResource::decodedDataIsPurgeable):
* platform/graphics/BitmapImage.h:
* platform/graphics/Image.h:
(WebCore::Image::decodedDataIsPurgeable):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@176106 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/loader/cache/CachedImage.h
Source/WebCore/loader/cache/CachedResource.h
Source/WebCore/loader/cache/MemoryCache.cpp
Source/WebCore/platform/graphics/BitmapImage.cpp
Source/WebCore/platform/graphics/BitmapImage.h
Source/WebCore/platform/graphics/Image.h
Source/WebCore/platform/graphics/cg/ImageSourceCG.cpp