Title: [160349] trunk/Source/WebCore
- Revision
- 160349
- Author
- akl...@apple.com
- Date
- 2013-12-09 21:57:55 -0800 (Mon, 09 Dec 2013)
Log Message
Clear out font width measurement caches on memory pressure.
<https://webkit.org/b/125481>
The data kept in WidthCaches can be regenerated on demand. Throwing
it away when we're under memory pressure buys us ~4MB on Membuster3.
Reviewed by Antti Koivisto.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (160348 => 160349)
--- trunk/Source/WebCore/ChangeLog 2013-12-10 05:52:24 UTC (rev 160348)
+++ trunk/Source/WebCore/ChangeLog 2013-12-10 05:57:55 UTC (rev 160349)
@@ -1,3 +1,13 @@
+2013-12-09 Andreas Kling <akl...@apple.com>
+
+ Clear out font width measurement caches on memory pressure.
+ <https://webkit.org/b/125481>
+
+ The data kept in WidthCaches can be regenerated on demand. Throwing
+ it away when we're under memory pressure buys us ~4MB on Membuster3.
+
+ Reviewed by Antti Koivisto.
+
2013-12-09 Seokju Kwon <seo...@webkit.org>
Web Inspector: Remove enabled() in InspectorRuntimeAgent.
Modified: trunk/Source/WebCore/platform/graphics/Font.cpp (160348 => 160349)
--- trunk/Source/WebCore/platform/graphics/Font.cpp 2013-12-10 05:52:24 UTC (rev 160348)
+++ trunk/Source/WebCore/platform/graphics/Font.cpp 2013-12-10 05:57:55 UTC (rev 160349)
@@ -216,6 +216,12 @@
fontGlyphsCache().clear();
}
+void clearWidthCaches()
+{
+ for (auto it = fontGlyphsCache().begin(), end = fontGlyphsCache().end(); it != end; ++it)
+ it->value->glyphs.get().widthCache().clear();
+}
+
static unsigned makeFontSelectorFlags(const FontDescription& description)
{
return static_cast<unsigned>(description.script()) << 1 | static_cast<unsigned>(description.smallCaps());
Modified: trunk/Source/WebCore/platform/graphics/Font.h (160348 => 160349)
--- trunk/Source/WebCore/platform/graphics/Font.h 2013-12-10 05:52:24 UTC (rev 160348)
+++ trunk/Source/WebCore/platform/graphics/Font.h 2013-12-10 05:57:55 UTC (rev 160349)
@@ -309,6 +309,7 @@
void invalidateFontGlyphsCache();
void pruneUnreferencedEntriesFromFontGlyphsCache();
+void clearWidthCaches();
inline Font::~Font()
{
Modified: trunk/Source/WebCore/platform/mac/MemoryPressureHandlerMac.mm (160348 => 160349)
--- trunk/Source/WebCore/platform/mac/MemoryPressureHandlerMac.mm 2013-12-10 05:52:24 UTC (rev 160348)
+++ trunk/Source/WebCore/platform/mac/MemoryPressureHandlerMac.mm 2013-12-10 05:57:55 UTC (rev 160349)
@@ -161,6 +161,8 @@
cssValuePool().drain();
+ clearWidthCaches();
+
gcController().discardAllCompiledCode();
// FastMalloc has lock-free thread specific caches that can only be cleared from the thread itself.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes