Title: [158478] trunk/Source/WebCore
Revision
158478
Author
akl...@apple.com
Date
2013-11-01 18:53:22 -0700 (Fri, 01 Nov 2013)

Log Message

createFontFaceValue() should be smarter about overgrown cache.
<https://webkit.org/b/123643>

Instead of clearing the whole font-face value cache when it passes
128 entries, just delete one entry at random.

Reviewed by Geoffrey Garen.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (158477 => 158478)


--- trunk/Source/WebCore/ChangeLog	2013-11-02 01:51:00 UTC (rev 158477)
+++ trunk/Source/WebCore/ChangeLog	2013-11-02 01:53:22 UTC (rev 158478)
@@ -1,3 +1,13 @@
+2013-11-01  Andreas Kling  <akl...@apple.com>
+
+        createFontFaceValue() should be smarter about overgrown cache.
+        <https://webkit.org/b/123643>
+
+        Instead of clearing the whole font-face value cache when it passes
+        128 entries, just delete one entry at random.
+
+        Reviewed by Geoffrey Garen.
+
 2013-11-01  Thiago de Barros Lacerda  <thiago.lace...@openbossa.org>
 
         Fixing mac code to use new MediaStreamDescriptor create method

Modified: trunk/Source/WebCore/css/CSSValuePool.cpp (158477 => 158478)


--- trunk/Source/WebCore/css/CSSValuePool.cpp	2013-11-02 01:51:00 UTC (rev 158477)
+++ trunk/Source/WebCore/css/CSSValuePool.cpp	2013-11-02 01:53:22 UTC (rev 158478)
@@ -127,10 +127,10 @@
 
 PassRefPtr<CSSValueList> CSSValuePool::createFontFaceValue(const AtomicString& string)
 {
-    // Just wipe out the cache and start rebuilding if it gets too big.
+    // Remove one entry at random if the cache grows too large.
     const int maximumFontFaceCacheSize = 128;
-    if (m_fontFaceValueCache.size() > maximumFontFaceCacheSize)
-        m_fontFaceValueCache.clear();
+    if (m_fontFaceValueCache.size() >= maximumFontFaceCacheSize)
+        m_fontFaceValueCache.remove(m_fontFaceValueCache.begin());
 
     RefPtr<CSSValueList>& value = m_fontFaceValueCache.add(string, nullptr).iterator->value;
     if (!value)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to