Memory cache live resources repeatedly purged during painting
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 24 Apr 2015 11:20:10 +0000 (11:20 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 24 Apr 2015 11:20:10 +0000 (11:20 +0000)
commit66e7c2749393c33409b38ff6d08c3d83000cb22e
tree47b46278ac90fc50bbf46c1146a2518ea04054f1
parent135c05425bd248c36bb128183012ecc2b6ebed45
Memory cache live resources repeatedly purged during painting
https://bugs.webkit.org/show_bug.cgi?id=144104
Source/WebCore:

<rdar://problem/20667695>

Reviewed by Chris Dumez.

On some PLT pages (like nytimes.com) we get into state where painting repeatedly purges live bitmaps.
This slows down page loads significantly.

This might have regressed because improvements in page caching keep more pages and so resources 'live'.

With this path we do all regular cache pruning asynchronously. If memory is really critical
the low memory handling code will still prune synchronously.

* loader/cache/CachedResource.cpp:
(WebCore::CachedResource::removeClient):
(WebCore::CachedResource::didAccessDecodedData):

    prune() -> pruneSoon()

* loader/cache/MemoryCache.cpp:

    Decrease the pruning size target from 0.95 to 0.8 so we don't need to prune so often.

(WebCore::MemoryCache::needsPruning):

    Factor into a function.

(WebCore::MemoryCache::prune):
(WebCore::MemoryCache::pruneSoon):

    Prune asynchronously.

* loader/cache/MemoryCache.h:

LayoutTests:

Reviewed by Chris Dumez.

* http/tests/cache/disk-cache/disk-cache-vary-cookie.html:

    These clearMemoryCache calls are now done by cache-test.js.

* http/tests/cache/disk-cache/resources/cache-test.js:
(loadResources):

    Make sure to clear the memory cache explicitly in the beginning so we always hit the disk cache.

(runTests):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@183261 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/http/tests/cache/disk-cache/disk-cache-vary-cookie.html
LayoutTests/http/tests/cache/disk-cache/resources/cache-test.js
Source/WebCore/ChangeLog
Source/WebCore/loader/cache/CachedResource.cpp
Source/WebCore/loader/cache/MemoryCache.cpp
Source/WebCore/loader/cache/MemoryCache.h