Use random() instead of begin() to limit cache sizes
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 26 Oct 2018 17:07:49 +0000 (17:07 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 26 Oct 2018 17:07:49 +0000 (17:07 +0000)
commitfac3907dd9edb201ab5bd55dabf6bed6d9a7cc62
tree5cbaf41ef4093c78aa05179adfda445685ceb056
parent0043d5c73cd8d6bedd5bd9739b407742000d1e66
Use random() instead of begin() to limit cache sizes
https://bugs.webkit.org/show_bug.cgi?id=190957

Reviewed by Chris Dumez.

Source/WebCore:

We currently use cache.remove(cache.begin()) pattern to limit sized of various caches.
This is a bad pattern for tables that never rehash (because they have fixed maximum size) as most of the
keys get permanently stuck in the table.

* css/CSSValuePool.cpp:
(WebCore::CSSValuePool::createColorValue):
(WebCore::CSSValuePool::createFontFamilyValue):
(WebCore::CSSValuePool::createFontFaceValue):
* dom/InlineStyleSheetOwner.cpp:
(WebCore::InlineStyleSheetOwner::createSheet):
* dom/SelectorQuery.cpp:
* platform/graphics/FontCascade.cpp:
(WebCore::retrieveOrAddCachedFonts):
* platform/graphics/cocoa/FontCacheCoreText.cpp:
(WebCore::shouldAutoActivateFontIfNeeded):
* platform/mac/PublicSuffixMac.mm:
(WebCore::topPrivatelyControlledDomain):

Source/WebKit:

* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::didCollectPrewarmInformation):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@237463 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/css/CSSValuePool.cpp
Source/WebCore/dom/InlineStyleSheetOwner.cpp
Source/WebCore/dom/SelectorQuery.cpp
Source/WebCore/platform/graphics/FontCascade.cpp
Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp
Source/WebCore/platform/mac/PublicSuffixMac.mm
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/WebProcessPool.cpp