Implement cache size limit
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 24 Jan 2015 02:27:31 +0000 (02:27 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 24 Jan 2015 02:27:31 +0000 (02:27 +0000)
commitb5494c7a950376de14e93403b76d2c55f956d664
treea518ab9870f25e5ec552cf8707b8467dbeb61797
parentdbb580f32585790bc094829ea052bd8e87639532
Implement cache size limit
https://bugs.webkit.org/show_bug.cgi?id=140844

Reviewed by Andreas Kling.

Prevent the cache from growing without bounds. The simple scheme implemented here
estimates the cache size from number of entries. When the estimated size exceeds
the maximum size we randomly clear 1/4 of the entries.

* NetworkProcess/cache/NetworkCacheStorage.h:
* NetworkProcess/cache/NetworkCacheStorageCocoa.mm:
(WebKit::NetworkCacheStorage::NetworkCacheStorage):
(WebKit::NetworkCacheStorage::initialize):
(WebKit::NetworkCacheStorage::removeEntry):
(WebKit::NetworkCacheStorage::store):
(WebKit::NetworkCacheStorage::setMaximumSize):
(WebKit::NetworkCacheStorage::clear):
(WebKit::NetworkCacheStorage::shrinkIfNeeded):
(WebKit::NetworkCacheStorage::initializeKeyFilter): Deleted.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@179052 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebKit2/ChangeLog
Source/WebKit2/NetworkProcess/cache/NetworkCacheStorage.h
Source/WebKit2/NetworkProcess/cache/NetworkCacheStorageCocoa.mm