Diff
Modified: trunk/Source/WebCore/ChangeLog (136865 => 136866)
--- trunk/Source/WebCore/ChangeLog 2012-12-06 19:47:37 UTC (rev 136865)
+++ trunk/Source/WebCore/ChangeLog 2012-12-06 19:48:25 UTC (rev 136866)
@@ -1,3 +1,19 @@
+2012-12-06 Andreas Kling <[email protected]>
+
+ [Mac] Drain the CSSValuePool on memory pressure.
+ <http://webkit.org/b/104274>
+
+ Reviewed by Antti Koivisto.
+
+ Add a drain() mechanism to CSSValuePool and call it when we're under memory pressure.
+
+ * WebCore.xcodeproj/project.pbxproj:
+ * css/CSSValuePool.cpp:
+ (WebCore::CSSValuePool::drain):
+ * css/CSSValuePool.h:
+ * platform/mac/MemoryPressureHandlerMac.mm:
+ (WebCore::MemoryPressureHandler::releaseMemory):
+
2012-12-05 Adam Klein <[email protected]>
Remove gyp config for incomplete and unused Apple Mac gyp build
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (136865 => 136866)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2012-12-06 19:47:37 UTC (rev 136865)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2012-12-06 19:48:25 UTC (rev 136866)
@@ -6224,7 +6224,7 @@
E47E276816036EDC00EE2AFB /* DocumentStyleSheetCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E47E276716036EDC00EE2AFB /* DocumentStyleSheetCollection.cpp */; };
E4946EAE156E64DD00D3297F /* StyleRuleImport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4946EAC156E64DD00D3297F /* StyleRuleImport.cpp */; };
E4946EAF156E64DD00D3297F /* StyleRuleImport.h in Headers */ = {isa = PBXBuildFile; fileRef = E4946EAD156E64DD00D3297F /* StyleRuleImport.h */; };
- E49BD9FA131FD2ED003C56F0 /* CSSValuePool.h in Headers */ = {isa = PBXBuildFile; fileRef = E49BD9F9131FD2ED003C56F0 /* CSSValuePool.h */; };
+ E49BD9FA131FD2ED003C56F0 /* CSSValuePool.h in Headers */ = {isa = PBXBuildFile; fileRef = E49BD9F9131FD2ED003C56F0 /* CSSValuePool.h */; settings = {ATTRIBUTES = (Private, ); }; };
E49BDA0B131FD3E5003C56F0 /* CSSValuePool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E49BDA0A131FD3E5003C56F0 /* CSSValuePool.cpp */; };
E4AFCFA50DAF29A300F5F55C /* UnitBezier.h in Headers */ = {isa = PBXBuildFile; fileRef = E4AFCFA40DAF29A300F5F55C /* UnitBezier.h */; };
E4AFD00B0DAF335400F5F55C /* SMILTime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4AFD0050DAF335400F5F55C /* SMILTime.cpp */; };
@@ -22668,6 +22668,7 @@
F5E0C65C1643C42C00D6CB69 /* BaseChooserOnlyDateAndTimeInputType.h in Headers */,
C33EE5C514FB49610002095A /* BaseClickableWithKeyInputType.h in Headers */,
F59C96001255B23F000623C0 /* BaseDateAndTimeInputType.h in Headers */,
+ E49BD9FA131FD2ED003C56F0 /* CSSValuePool.h in Headers */,
45861C73161949DC00010F3A /* BaseMultipleFieldsDateAndTimeInputType.h in Headers */,
F55B3DAE1251F12D003EF269 /* BaseTextInputType.h in Headers */,
FBD6AF8A15EF25DF008B7110 /* BasicShapeFunctions.h in Headers */,
@@ -22877,7 +22878,6 @@
A80E6CEE0A1989CA007FB8C5 /* CSSValue.h in Headers */,
6565815109D13043000E61D7 /* CSSValueKeywords.h in Headers */,
A80E6CE90A1989CA007FB8C5 /* CSSValueList.h in Headers */,
- E49BD9FA131FD2ED003C56F0 /* CSSValuePool.h in Headers */,
CAE9F910146441F000C245B1 /* CSSVariableValue.h in Headers */,
93F1992F08245E59001E9ABC /* Cursor.h in Headers */,
BC2272A20E82E87C00E7F975 /* CursorData.h in Headers */,
Modified: trunk/Source/WebCore/css/CSSValuePool.cpp (136865 => 136866)
--- trunk/Source/WebCore/css/CSSValuePool.cpp 2012-12-06 19:47:37 UTC (rev 136865)
+++ trunk/Source/WebCore/css/CSSValuePool.cpp 2012-12-06 19:48:25 UTC (rev 136866)
@@ -132,4 +132,20 @@
return value;
}
+void CSSValuePool::drain()
+{
+ m_colorValueCache.clear();
+ m_fontFaceValueCache.clear();
+ m_fontFamilyValueCache.clear();
+
+ for (int i = 0; i < numCSSValueKeywords; ++i)
+ m_identifierValueCache[i] = 0;
+
+ for (int i = 0; i < maximumCacheableIntegerValue; ++i) {
+ m_pixelValueCache[i] = 0;
+ m_percentValueCache[i] = 0;
+ m_numberValueCache[i] = 0;
+ }
}
+
+}
Modified: trunk/Source/WebCore/css/CSSValuePool.h (136865 => 136866)
--- trunk/Source/WebCore/css/CSSValuePool.h 2012-12-06 19:47:37 UTC (rev 136865)
+++ trunk/Source/WebCore/css/CSSValuePool.h 2012-12-06 19:48:25 UTC (rev 136866)
@@ -52,6 +52,8 @@
PassRefPtr<CSSPrimitiveValue> createValue(const String& value, CSSPrimitiveValue::UnitTypes type) { return CSSPrimitiveValue::create(value, type); }
template<typename T> static PassRefPtr<CSSPrimitiveValue> createValue(T value) { return CSSPrimitiveValue::create(value); }
+ void drain();
+
private:
CSSValuePool();
Modified: trunk/Source/WebCore/platform/mac/MemoryPressureHandlerMac.mm (136865 => 136866)
--- trunk/Source/WebCore/platform/mac/MemoryPressureHandlerMac.mm 2012-12-06 19:47:37 UTC (rev 136865)
+++ trunk/Source/WebCore/platform/mac/MemoryPressureHandlerMac.mm 2012-12-06 19:48:25 UTC (rev 136866)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2011, 2012 Apple Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -26,6 +26,7 @@
#import "config.h"
#import "MemoryPressureHandler.h"
+#import <WebCore/CSSValuePool.h>
#import <WebCore/GCController.h>
#import <WebCore/FontCache.h>
#import <WebCore/MemoryCache.h>
@@ -151,6 +152,8 @@
LayerPool::sharedPool()->drain();
+ cssValuePool().drain();
+
gcController().discardAllCompiledCode();
WTF::releaseFastMallocFreeMemory();