Changeset 195917 in webkit
- Timestamp:
- Jan 30, 2016 4:53:20 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 37 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r195911 r195917 1 2016-01-30 Commit Queue <commit-queue@webkit.org> 2 3 Unreviewed, rolling out r195911. 4 https://bugs.webkit.org/show_bug.cgi?id=153723 5 6 Caused frequent assertion failures on bots (Requested by ap on 7 #webkit). 8 9 Reverted changeset: 10 11 "Replace CaseFoldingHash with ASCIICaseInsensitiveHash" 12 https://bugs.webkit.org/show_bug.cgi?id=153639 13 http://trac.webkit.org/changeset/195911 14 1 15 2016-01-30 Darin Adler <darin@apple.com> 2 16 -
trunk/Source/WTF/wtf/text/StringHash.h
r195911 r195917 1 1 /* 2 * Copyright (C) 2006 -2008, 2012-2013, 2016Apple Inc. All rights reserved2 * Copyright (C) 2006, 2007, 2008, 2012, 2013 Apple Inc. All rights reserved 3 3 * Copyright (C) Research In Motion Limited 2009. All rights reserved. 4 4 * … … 34 34 } 35 35 36 // The hash() functions on StringHash and ASCIICaseInsensitiveHash do not support36 // The hash() functions on StringHash and CaseFoldingHash do not support 37 37 // null strings. get(), contains(), and add() on HashMap<String,..., StringHash> 38 38 // cause a null-pointer dereference when passed null strings. … … 72 72 }; 73 73 74 class ASCIICaseInsensitiveHash {74 class CaseFoldingHash { 75 75 public: 76 76 template<typename T> static inline UChar foldCase(T character) 77 77 { 78 return toASCIILower(character); 78 if (std::is_same<T, LChar>::value) 79 return StringImpl::latin1CaseFoldTable[character]; 80 81 return u_foldCase(character, U_FOLD_CASE_DEFAULT); 79 82 } 80 83 … … 103 106 static inline unsigned hash(const char* data, unsigned length) 104 107 { 105 return hash(reinterpret_cast<const LChar*>(data), length);108 return CaseFoldingHash::hash(reinterpret_cast<const LChar*>(data), length); 106 109 } 107 110 108 static inline bool equal(const StringImpl& a, const StringImpl& b)109 {110 return equalIgnoringASCIICase(a, b);111 }112 111 static inline bool equal(const StringImpl* a, const StringImpl* b) 113 112 { 114 ASSERT(a); 115 ASSERT(b); 116 return equal(*a, *b); 113 return equalCompatibiltyCaselessNonNull(a, b); 117 114 } 118 115 119 116 static unsigned hash(const RefPtr<StringImpl>& key) 120 117 { 121 return hash( key.get());118 return hash(*key); 122 119 } 123 120 … … 171 168 } 172 169 173 using WTF::ASCIICaseInsensitiveHash;174 170 using WTF::AlreadyHashed; 171 using WTF::CaseFoldingHash; 175 172 using WTF::StringHash; 176 173 -
trunk/Source/WTF/wtf/text/StringImpl.cpp
r195911 r195917 951 951 } 952 952 953 // Table is based on ftp://ftp.unicode.org/Public/UNIDATA/CaseFolding.txt 954 static const UChar latin1CaseFoldTable[256] = { 955 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f, 956 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x001f, 957 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f, 958 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f, 959 0x0040, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, 960 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x005b, 0x005c, 0x005d, 0x005e, 0x005f, 961 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, 962 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x007b, 0x007c, 0x007d, 0x007e, 0x007f, 963 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, 964 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, 965 0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, 0x00a8, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, 966 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x03bc, 0x00b6, 0x00b7, 0x00b8, 0x00b9, 0x00ba, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00bf, 967 0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, 968 0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00d7, 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00df, 969 0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, 970 0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7, 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00ff, 971 }; 972 973 static inline bool equalCompatibilityCaseless(const LChar* a, const LChar* b, unsigned length) 953 static inline bool equalCompatibiltyCaseless(const LChar* a, const LChar* b, unsigned length) 974 954 { 975 955 while (length--) { 976 if ( latin1CaseFoldTable[*a++] !=latin1CaseFoldTable[*b++])956 if (StringImpl::latin1CaseFoldTable[*a++] != StringImpl::latin1CaseFoldTable[*b++]) 977 957 return false; 978 958 } … … 980 960 } 981 961 982 static inline bool equalCompatibil ityCaseless(const UChar* a, const LChar* b, unsigned length)962 static inline bool equalCompatibiltyCaseless(const UChar* a, const LChar* b, unsigned length) 983 963 { 984 964 while (length--) { 985 if (u_foldCase(*a++, U_FOLD_CASE_DEFAULT) != latin1CaseFoldTable[*b++])965 if (u_foldCase(*a++, U_FOLD_CASE_DEFAULT) != StringImpl::latin1CaseFoldTable[*b++]) 986 966 return false; 987 967 } … … 989 969 } 990 970 991 static inline bool equalCompatibil ityCaseless(const LChar* a, const UChar* b, unsigned length)992 { 993 return equalCompatibil ityCaseless(b, a, length);994 } 995 996 static inline bool equalCompatibil ityCaseless(const UChar* a, const UChar* b, unsigned length)971 static inline bool equalCompatibiltyCaseless(const LChar* a, const UChar* b, unsigned length) 972 { 973 return equalCompatibiltyCaseless(b, a, length); 974 } 975 976 static inline bool equalCompatibiltyCaseless(const UChar* a, const UChar* b, unsigned length) 997 977 { 998 978 return !u_memcasecmp(a, b, length, U_FOLD_CASE_DEFAULT); … … 1103 1083 1104 1084 unsigned i = 0; 1105 while (!equalCompatibil ityCaseless(searchCharacters + i, matchString, matchLength)) {1085 while (!equalCompatibiltyCaseless(searchCharacters + i, matchString, matchLength)) { 1106 1086 if (i == delta) 1107 1087 return notFound; … … 1114 1094 1115 1095 unsigned i = 0; 1116 while (!equalCompatibil ityCaseless(searchCharacters + i, matchString, matchLength)) {1096 while (!equalCompatibiltyCaseless(searchCharacters + i, matchString, matchLength)) { 1117 1097 if (i == delta) 1118 1098 return notFound; … … 1178 1158 unsigned i = 0; 1179 1159 // keep looping until we match 1180 while (!equalCompatibil ityCaseless(searchCharacters + i, matchCharacters, matchLength)) {1160 while (!equalCompatibiltyCaseless(searchCharacters + i, matchCharacters, matchLength)) { 1181 1161 if (i == delta) 1182 1162 return notFound; … … 1319 1299 1320 1300 // keep looping until we match 1321 while (!equalCompatibil ityCaseless(searchCharacters + delta, matchCharacters, matchLength)) {1301 while (!equalCompatibiltyCaseless(searchCharacters + delta, matchCharacters, matchLength)) { 1322 1302 if (!delta) 1323 1303 return notFound; … … 1365 1345 } 1366 1346 if (stringImpl->is8Bit()) 1367 return equalCompatibil ityCaseless(stringImpl->characters8() + startOffset, reinterpret_cast<const LChar*>(matchString), matchLength);1368 return equalCompatibil ityCaseless(stringImpl->characters16() + startOffset, reinterpret_cast<const LChar*>(matchString), matchLength);1347 return equalCompatibiltyCaseless(stringImpl->characters8() + startOffset, reinterpret_cast<const LChar*>(matchString), matchLength); 1348 return equalCompatibiltyCaseless(stringImpl->characters16() + startOffset, reinterpret_cast<const LChar*>(matchString), matchLength); 1369 1349 } 1370 1350 … … 1939 1919 } 1940 1920 1921 bool equalCompatibiltyCaselessNonNull(const StringImpl* a, const StringImpl* b) 1922 { 1923 ASSERT(a); 1924 ASSERT(b); 1925 if (a == b) 1926 return true; 1927 1928 unsigned length = a->length(); 1929 if (length != b->length()) 1930 return false; 1931 1932 if (a->is8Bit()) { 1933 if (b->is8Bit()) 1934 return equalCompatibiltyCaseless(a->characters8(), b->characters8(), length); 1935 1936 return equalCompatibiltyCaseless(b->characters16(), a->characters8(), length); 1937 } 1938 1939 if (b->is8Bit()) 1940 return equalCompatibiltyCaseless(a->characters16(), b->characters8(), length); 1941 1942 return equalCompatibiltyCaseless(a->characters16(), b->characters16(), length); 1943 } 1944 1941 1945 bool equalIgnoringNullity(StringImpl* a, StringImpl* b) 1942 1946 { … … 2138 2142 } 2139 2143 2144 // Table is based on ftp://ftp.unicode.org/Public/UNIDATA/CaseFolding.txt 2145 const UChar StringImpl::latin1CaseFoldTable[256] = { 2146 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f, 2147 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x001f, 2148 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f, 2149 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f, 2150 0x0040, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, 2151 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x005b, 0x005c, 0x005d, 0x005e, 0x005f, 2152 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, 2153 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x007b, 0x007c, 0x007d, 0x007e, 0x007f, 2154 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, 2155 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, 2156 0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, 0x00a8, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, 2157 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x03bc, 0x00b6, 0x00b7, 0x00b8, 0x00b9, 0x00ba, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00bf, 2158 0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, 2159 0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00d7, 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00df, 2160 0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, 2161 0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7, 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00ff, 2162 }; 2163 2140 2164 bool equalIgnoringNullity(const UChar* a, size_t aLength, StringImpl* b) 2141 2165 { -
trunk/Source/WTF/wtf/text/StringImpl.h
r195911 r195917 763 763 #endif 764 764 765 WTF_EXPORT_STRING_API static const UChar latin1CaseFoldTable[256]; 766 765 767 Ref<StringImpl> extractFoldedStringInSymbol() 766 768 { … … 945 947 WTF_EXPORT_STRING_API bool equal(const StringImpl& a, const StringImpl& b); 946 948 949 // FIXME: Deprecated. Used only by CaseFoldingHash, which itself is soon to be deprecated and removed, replaced by ASCIICaseFoldingHash. 950 WTF_EXPORT_STRING_API bool equalCompatibiltyCaselessNonNull(const StringImpl*, const StringImpl*); 951 947 952 WTF_EXPORT_STRING_API bool equalIgnoringNullity(StringImpl*, StringImpl*); 948 953 WTF_EXPORT_STRING_API bool equalIgnoringNullity(const UChar*, size_t length, StringImpl*); -
trunk/Source/WebCore/ChangeLog
r195916 r195917 1 2016-01-30 Commit Queue <commit-queue@webkit.org> 2 3 Unreviewed, rolling out r195911. 4 https://bugs.webkit.org/show_bug.cgi?id=153723 5 6 Caused frequent assertion failures on bots (Requested by ap on 7 #webkit). 8 9 Reverted changeset: 10 11 "Replace CaseFoldingHash with ASCIICaseInsensitiveHash" 12 https://bugs.webkit.org/show_bug.cgi?id=153639 13 http://trac.webkit.org/changeset/195911 14 1 15 2016-01-30 Commit Queue <commit-queue@webkit.org> 2 16 -
trunk/Source/WebCore/Modules/webdatabase/DatabaseAuthorizer.h
r195911 r195917 118 118 const String m_databaseInfoTableName; 119 119 120 HashSet<String, ASCIICaseInsensitiveHash> m_whitelistedFunctions;120 HashSet<String, CaseFoldingHash> m_whitelistedFunctions; 121 121 }; 122 122 -
trunk/Source/WebCore/accessibility/AccessibilityObject.cpp
r195911 r195917 1989 1989 } 1990 1990 1991 typedef HashMap<String, AccessibilityRole, ASCIICaseInsensitiveHash> ARIARoleMap;1991 typedef HashMap<String, AccessibilityRole, CaseFoldingHash> ARIARoleMap; 1992 1992 typedef HashMap<AccessibilityRole, String, DefaultHash<int>::Hash, WTF::UnsignedWithZeroKeyHashTraits<int>> ARIAReverseRoleMap; 1993 1993 -
trunk/Source/WebCore/crypto/CryptoAlgorithmRegistry.h
r195911 r195917 66 66 void registerAlgorithm(const String& name, CryptoAlgorithmIdentifier, CryptoAlgorithmConstructor); 67 67 68 HashMap<String, CryptoAlgorithmIdentifier, ASCIICaseInsensitiveHash> m_nameToIdentifierMap;68 HashMap<String, CryptoAlgorithmIdentifier, CaseFoldingHash> m_nameToIdentifierMap; 69 69 HashMap<unsigned, String> m_identifierToNameMap; 70 70 HashMap<unsigned, CryptoAlgorithmConstructor> m_identifierToConstructorMap; -
trunk/Source/WebCore/css/CSSFontSelector.cpp
r195911 r195917 225 225 } 226 226 227 static void registerLocalFontFacesForFamily(const String& familyName, HashMap<String, Vector<Ref<CSSFontFace>>, ASCIICaseInsensitiveHash>& locallyInstalledFontFaces)227 static void registerLocalFontFacesForFamily(const String& familyName, HashMap<String, Vector<Ref<CSSFontFace>>, CaseFoldingHash>& locallyInstalledFontFaces) 228 228 { 229 229 ASSERT(!locallyInstalledFontFaces.contains(familyName)); -
trunk/Source/WebCore/css/CSSFontSelector.h
r195911 r195917 87 87 88 88 Document* m_document; 89 HashMap<String, Vector<Ref<CSSFontFace>>, ASCIICaseInsensitiveHash> m_fontFaces;90 HashMap<String, Vector<Ref<CSSFontFace>>, ASCIICaseInsensitiveHash> m_locallyInstalledFontFaces;91 HashMap<String, HashMap<unsigned, RefPtr<CSSSegmentedFontFace>>, ASCIICaseInsensitiveHash> m_fonts;89 HashMap<String, Vector<Ref<CSSFontFace>>, CaseFoldingHash> m_fontFaces; 90 HashMap<String, Vector<Ref<CSSFontFace>>, CaseFoldingHash> m_locallyInstalledFontFaces; 91 HashMap<String, HashMap<unsigned, RefPtr<CSSSegmentedFontFace>>, CaseFoldingHash> m_fonts; 92 92 HashSet<FontSelectorClient*> m_clients; 93 93 -
trunk/Source/WebCore/dom/DOMImplementation.cpp
r195911 r195917 65 65 using namespace HTMLNames; 66 66 67 typedef HashSet<String, ASCIICaseInsensitiveHash> FeatureSet;67 typedef HashSet<String, CaseFoldingHash> FeatureSet; 68 68 69 69 static void addString(FeatureSet& set, const char* string) -
trunk/Source/WebCore/dom/Document.h
r195911 r195917 1614 1614 #endif 1615 1615 1616 HashMap<StringImpl*, Element*, ASCIICaseInsensitiveHash> m_elementsByAccessKey;1616 HashMap<StringImpl*, Element*, CaseFoldingHash> m_elementsByAccessKey; 1617 1617 bool m_accessKeyMapValid; 1618 1618 -
trunk/Source/WebCore/dom/ScriptElement.cpp
r195911 r195917 119 119 120 120 // FIXME: This function is not HTML5 compliant. These belong in the MIME registry as "text/javascript<version>" entries. 121 typedef HashSet<String, ASCIICaseInsensitiveHash> LanguageSet;121 typedef HashSet<String, CaseFoldingHash> LanguageSet; 122 122 static NeverDestroyed<LanguageSet> languages; 123 123 if (languages.get().isEmpty()) { -
trunk/Source/WebCore/editing/EditorCommand.cpp
r195911 r195917 78 78 }; 79 79 80 typedef HashMap<String, const EditorInternalCommand*, ASCIICaseInsensitiveHash> CommandMap;80 typedef HashMap<String, const EditorInternalCommand*, CaseFoldingHash> CommandMap; 81 81 82 82 static const bool notTextInsertion = false; -
trunk/Source/WebCore/html/HTMLObjectElement.cpp
r195911 r195917 167 167 void HTMLObjectElement::parametersForPlugin(Vector<String>& paramNames, Vector<String>& paramValues, String& url, String& serviceType) 168 168 { 169 HashSet<StringImpl*, ASCIICaseInsensitiveHash> uniqueParamNames;169 HashSet<StringImpl*, CaseFoldingHash> uniqueParamNames; 170 170 String urlParameter; 171 171 -
trunk/Source/WebCore/html/InputType.cpp
r195911 r195917 87 87 typedef const AtomicString& (*InputTypeNameFunction)(); 88 88 typedef std::unique_ptr<InputType> (*InputTypeFactoryFunction)(HTMLInputElement&); 89 typedef HashMap<AtomicString, InputTypeFactoryFunction, ASCIICaseInsensitiveHash> InputTypeFactoryMap;89 typedef HashMap<AtomicString, InputTypeFactoryFunction, CaseFoldingHash> InputTypeFactoryMap; 90 90 91 91 template<class T> -
trunk/Source/WebCore/loader/CrossOriginAccessControl.h
r195911 r195917 35 35 namespace WebCore { 36 36 37 typedef HashSet<String, ASCIICaseInsensitiveHash> HTTPHeaderSet;37 typedef HashSet<String, CaseFoldingHash> HTTPHeaderSet; 38 38 39 39 class HTTPHeaderMap; -
trunk/Source/WebCore/loader/CrossOriginPreflightResultCache.h
r195911 r195917 60 60 StoredCredentials m_credentials; 61 61 HashSet<String> m_methods; 62 HashSet<String, ASCIICaseInsensitiveHash> m_headers;62 HashSet<String, CaseFoldingHash> m_headers; 63 63 }; 64 64 -
trunk/Source/WebCore/loader/archive/ArchiveFactory.cpp
r195911 r195917 48 48 49 49 typedef PassRefPtr<Archive> RawDataCreationFunction(const URL&, SharedBuffer*); 50 typedef HashMap<String, RawDataCreationFunction*, ASCIICaseInsensitiveHash> ArchiveMIMETypesMap;50 typedef HashMap<String, RawDataCreationFunction*, CaseFoldingHash> ArchiveMIMETypesMap; 51 51 52 52 // The create functions in the archive classes return PassRefPtr to concrete subclasses -
trunk/Source/WebCore/platform/MIMETypeRegistry.cpp
r195911 r195917 151 151 static HashSet<String>* unsupportedTextMIMETypes; 152 152 153 typedef HashMap<String, Vector<String>*, ASCIICaseInsensitiveHash> MediaMIMETypeMap;153 typedef HashMap<String, Vector<String>*, CaseFoldingHash> MediaMIMETypeMap; 154 154 155 155 static void initializeSupportedImageMIMETypes() -
trunk/Source/WebCore/platform/SchemeRegistry.h
r195911 r195917 33 33 namespace WebCore { 34 34 35 typedef HashSet<String, ASCIICaseInsensitiveHash> URLSchemesMap;35 typedef HashSet<String, CaseFoldingHash> URLSchemesMap; 36 36 37 37 class SchemeRegistry { -
trunk/Source/WebCore/platform/URL.cpp
r195911 r195917 1991 1991 } 1992 1992 1993 typedef HashMap<String, unsigned short, ASCIICaseInsensitiveHash> DefaultPortsMap;1993 typedef HashMap<String, unsigned short, CaseFoldingHash> DefaultPortsMap; 1994 1994 static const DefaultPortsMap& defaultPortsMap() 1995 1995 { -
trunk/Source/WebCore/platform/graphics/FontCache.cpp
r195911 r195917 98 98 99 99 struct FontPlatformDataCacheKey { 100 AtomicString family; 101 FontDescriptionKey description; 102 103 FontPlatformDataCacheKey() = default; 100 WTF_MAKE_FAST_ALLOCATED; 101 public: 102 FontPlatformDataCacheKey() { } 104 103 FontPlatformDataCacheKey(const AtomicString& family, const FontDescription& description) 105 : family(family), description(description) 106 { 107 } 108 109 explicit FontPlatformDataCacheKey(HashTableDeletedValueType) 110 : description(HashTableDeletedValue) 111 { 112 } 113 bool isHashTableDeletedValue() const 114 { 115 return description.isHashTableDeletedValue(); 116 } 104 : m_fontDescriptionKey(description) 105 , m_family(family) 106 { } 107 108 explicit FontPlatformDataCacheKey(HashTableDeletedValueType t) 109 : m_fontDescriptionKey(t) 110 { } 111 112 bool isHashTableDeletedValue() const { return m_fontDescriptionKey.isHashTableDeletedValue(); } 113 114 bool operator==(const FontPlatformDataCacheKey& other) const 115 { 116 if (m_fontDescriptionKey != other.m_fontDescriptionKey) 117 return false; 118 if (m_family.impl() == other.m_family.impl()) 119 return true; 120 if (m_family.isNull() || other.m_family.isNull()) 121 return false; 122 return CaseFoldingHash::equal(m_family, other.m_family); 123 } 124 125 FontDescriptionKey m_fontDescriptionKey; 126 AtomicString m_family; 117 127 }; 118 128 119 129 struct FontPlatformDataCacheKeyHash { 120 static unsigned hash(const FontPlatformDataCacheKey& key) 121 { 122 return pairIntHash(ASCIICaseInsensitiveHash::hash(key.family), key.description.computeHash()); 123 } 130 static unsigned hash(const FontPlatformDataCacheKey& fontKey) 131 { 132 return pairIntHash(CaseFoldingHash::hash(fontKey.m_family), fontKey.m_fontDescriptionKey.computeHash()); 133 } 134 124 135 static bool equal(const FontPlatformDataCacheKey& a, const FontPlatformDataCacheKey& b) 125 136 { 126 return a.description == b.description && equalIgnoringASCIICase(a.family, b.family); 127 } 137 return a == b; 138 } 139 128 140 static const bool safeToCompareToEmptyOrDeleted = true; 129 141 }; 130 142 131 struct FontPlatformDataCacheKeyTraits : SimpleClassHashTraits<FontPlatformDataCacheKey> { 132 static const bool hasIsEmptyValueFunction = true; 133 static bool isEmptyValue(const FontPlatformDataCacheKey& key) 134 { 135 return key.family.isNull(); 136 } 137 }; 138 139 typedef HashMap<FontPlatformDataCacheKey, std::unique_ptr<FontPlatformData>, FontPlatformDataCacheKeyHash, FontPlatformDataCacheKeyTraits> FontPlatformDataCache; 143 typedef HashMap<FontPlatformDataCacheKey, std::unique_ptr<FontPlatformData>, FontPlatformDataCacheKeyHash, WTF::SimpleClassHashTraits<FontPlatformDataCacheKey>> FontPlatformDataCache; 140 144 141 145 static FontPlatformDataCache& fontPlatformDataCache() … … 204 208 } 205 209 206 // FIXME: This function name should not have the word "get" in it for WebKit coding style. 207 // FIXME: The boolean here is poor coding style. Easy to factor this into two functions so we don't need it. 208 FontPlatformData* FontCache::getCachedFontPlatformData(const FontDescription& fontDescription, const AtomicString& passedFamilyName,bool checkingAlternateName)210 FontPlatformData* FontCache::getCachedFontPlatformData(const FontDescription& fontDescription, 211 const AtomicString& passedFamilyName, 212 bool checkingAlternateName) 209 213 { 210 214 #if PLATFORM(IOS) … … 215 219 // Leading "@" in the font name enables Windows vertical flow flag for the font. 216 220 // Because we do vertical flow by ourselves, we don't want to use the Windows feature. 217 // IE disregards "@" regardless of the orientat ion, so we follow the behavior.218 const AtomicString& familyName = passedFamilyName[0] != '@'219 ?passedFamilyName : AtomicString(passedFamilyName.impl()->substring(1));221 // IE disregards "@" regardless of the orientatoin, so we follow the behavior. 222 const AtomicString& familyName = (passedFamilyName.isEmpty() || passedFamilyName[0] != '@') ? 223 passedFamilyName : AtomicString(passedFamilyName.impl()->substring(1)); 220 224 #else 221 225 const AtomicString& familyName = passedFamilyName; … … 234 238 if (addResult.isNewEntry) { 235 239 it->value = createFontPlatformData(fontDescription, familyName); 240 236 241 if (!it->value && !checkingAlternateName) { 237 // We were unable to find a font. We have a small set of fonts that we alias to other names,238 // e.g., Arial/Helvetica, Courier/Courier New, etc. Try looking up the font under the aliased name.239 autoalternateName = alternateFamilyName(familyName);242 // We were unable to find a font. We have a small set of fonts that we alias to other names, 243 // e.g., Arial/Helvetica, Courier/Courier New, etc. Try looking up the font under the aliased name. 244 const AtomicString alternateName = alternateFamilyName(familyName); 240 245 if (!alternateName.isNull()) { 241 246 FontPlatformData* fontPlatformDataForAlternateName = getCachedFontPlatformData(fontDescription, alternateName, true); 242 // Look 247 // Lookup the key in the hash table again as the previous iterator may have 243 248 // been invalidated by the recursive call to getCachedFontPlatformData(). 244 249 it = fontPlatformDataCache().find(key); -
trunk/Source/WebCore/platform/graphics/FontCascade.cpp
r195911 r195917 191 191 }; 192 192 193 // FIXME: Should make hash traits for FontCascadeCacheKey instead of using a hash as the key (so we hash a hash).194 193 typedef HashMap<unsigned, std::unique_ptr<FontCascadeCacheEntry>, AlreadyHashed> FontCascadeCache; 195 194 196 static bool keysMatch(const FontCascadeCacheKey& a, const FontCascadeCacheKey& b)195 static bool operator==(const FontCascadeCacheKey& a, const FontCascadeCacheKey& b) 197 196 { 198 197 if (a.fontDescriptionKey != b.fontDescriptionKey) … … 200 199 if (a.fontSelectorId != b.fontSelectorId || a.fontSelectorVersion != b.fontSelectorVersion) 201 200 return false; 202 unsigned size = a.families.size(); 203 if (size != b.families.size()) 204 return false; 205 for (unsigned i = 0; i < size; ++i) { 206 if (!equalIgnoringASCIICase(a.families[i], b.families[i])) 201 if (a.families.size() != b.families.size()) 202 return false; 203 for (unsigned i = 0; i < a.families.size(); ++i) { 204 auto* aImpl = a.families[i].impl(); 205 auto* bImpl = b.families[i].impl(); 206 if (aImpl == bImpl) 207 continue; 208 if (!aImpl || !bImpl || !CaseFoldingHash::equal(aImpl, bImpl)) 207 209 return false; 208 210 } … … 231 233 FontCascadeCacheKey key; 232 234 key.fontDescriptionKey = FontDescriptionKey(description); 233 unsigned familyCount = description.familyCount(); 234 key.families.reserveInitialCapacity(familyCount); 235 for (unsigned i = 0; i < familyCount; ++i) 236 key.families.uncheckedAppend(description.familyAt(i)); 235 for (unsigned i = 0; i < description.familyCount(); ++i) 236 key.families.append(description.familyAt(i)); 237 237 key.fontSelectorId = fontSelector ? fontSelector->uniqueId() : 0; 238 238 key.fontSelectorVersion = fontSelector ? fontSelector->version() : 0; … … 240 240 } 241 241 242 // FIXME: Why can't we just teach HashMap about FontCascadeCacheKey instead of hashing a hash? 242 243 static unsigned computeFontCascadeCacheHash(const FontCascadeCacheKey& key) 243 244 { 244 // FIXME: Should hash the key and the family name characters rather than making a hash out of other hashes.245 IntegerHasher hasher;246 hasher.add(key.fontDescriptionKey.computeHash()); 247 hash er.add(key.fontSelectorId);248 hash er.add(key.fontSelectorVersion);249 for (unsigned i = 0; i < key.families.size(); ++i) {250 StringImpl* family = key.families[i].impl();251 hash er.add(family ? ASCIICaseInsensitiveHash::hash(family) : 0);252 } 253 return hasher.hash();245 Vector<unsigned, 7> hashCodes; 246 hashCodes.reserveInitialCapacity(4 + key.families.size()); 247 248 hashCodes.uncheckedAppend(key.fontDescriptionKey.computeHash()); 249 hashCodes.uncheckedAppend(key.fontSelectorId); 250 hashCodes.uncheckedAppend(key.fontSelectorVersion); 251 for (unsigned i = 0; i < key.families.size(); ++i) 252 hashCodes.uncheckedAppend(key.families[i].impl() ? CaseFoldingHash::hash(key.families[i]) : 0); 253 254 return StringHasher::hashMemory(hashCodes.data(), hashCodes.size() * sizeof(unsigned)); 254 255 } 255 256 … … 272 273 273 274 unsigned hash = computeFontCascadeCacheHash(key); 274 auto addResult = fontCascadeCache().add(hash, nullptr);275 if (!addResult.isNewEntry && keysMatch(addResult.iterator->value->key, key))275 auto addResult = fontCascadeCache().add(hash, std::unique_ptr<FontCascadeCacheEntry>()); 276 if (!addResult.isNewEntry && addResult.iterator->value->key == key) 276 277 return addResult.iterator->value->fonts.get(); 277 278 -
trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp
r195911 r195917 646 646 } 647 647 648 typedef HashSet<String, ASCIICaseInsensitiveHash> Whitelist;648 typedef HashSet<String, CaseFoldingHash> Whitelist; 649 649 static Whitelist& fontWhitelist() 650 650 { -
trunk/Source/WebCore/platform/network/HTTPHeaderMap.h
r195911 r195917 49 49 public: 50 50 typedef HashMap<HTTPHeaderName, String, WTF::IntHash<HTTPHeaderName>, WTF::StrongEnumHashTraits<HTTPHeaderName>> CommonHeadersHashMap; 51 typedef HashMap<String, String, ASCIICaseInsensitiveHash> UncommonHeadersHashMap;51 typedef HashMap<String, String, CaseFoldingHash> UncommonHeadersHashMap; 52 52 53 53 class HTTPHeaderMapConstIterator { -
trunk/Source/WebCore/rendering/style/RenderStyle.cpp
r195911 r195917 367 367 368 368 #if ENABLE(IOS_TEXT_AUTOSIZING) 369 370 static inline unsigned computeFontHash(const FontCascade& font) 371 {372 IntegerHasher hasher;373 hasher.add(ASCIICaseInsensitiveHash::hash(font.fontDescription().firstFamily()));374 hasher.add(font.fontDescription().specifiedSize());375 return hasher.hash();376 } 377 378 u nsignedRenderStyle::hashForTextAutosizing() const369 inline unsigned computeFontHash(const FontCascade& font) 370 { 371 unsigned hashCodes[2] = { 372 CaseFoldingHash::hash(font.fontDescription().firstFamily().impl()), 373 static_cast<unsigned>(font.fontDescription().specifiedSize()) 374 }; 375 return StringHasher::computeHash(reinterpret_cast<UChar*>(hashCodes), 2 * sizeof(unsigned) / sizeof(UChar)); 376 } 377 378 uint32_t RenderStyle::hashForTextAutosizing() const 379 379 { 380 380 // FIXME: Not a very smart hash. Could be improved upon. See <https://bugs.webkit.org/show_bug.cgi?id=121131>. 381 unsigned hash = rareNonInheritedData->m_appearance; 381 uint32_t hash = 0; 382 383 hash ^= rareNonInheritedData->m_appearance; 382 384 hash ^= rareNonInheritedData->marginBeforeCollapse; 383 385 hash ^= rareNonInheritedData->marginAfterCollapse; … … 420 422 && rareNonInheritedData->textOverflow == other->rareNonInheritedData->textOverflow; 421 423 } 422 423 424 #endif // ENABLE(IOS_TEXT_AUTOSIZING) 424 425 -
trunk/Source/WebKit/win/ChangeLog
r195916 r195917 1 2016-01-30 Commit Queue <commit-queue@webkit.org> 2 3 Unreviewed, rolling out r195911. 4 https://bugs.webkit.org/show_bug.cgi?id=153723 5 6 Caused frequent assertion failures on bots (Requested by ap on 7 #webkit). 8 9 Reverted changeset: 10 11 "Replace CaseFoldingHash with ASCIICaseInsensitiveHash" 12 https://bugs.webkit.org/show_bug.cgi?id=153639 13 http://trac.webkit.org/changeset/195911 14 1 15 2016-01-30 Commit Queue <commit-queue@webkit.org> 2 16 -
trunk/Source/WebKit/win/WebCoreStatistics.cpp
r195911 r195917 296 296 GlobalMemoryStatistics globalMemoryStats = globalMemoryStatistics(); 297 297 298 HashMap<String, unsigned long long, ASCIICaseInsensitiveHash> fields;298 HashMap<String, unsigned long long, CaseFoldingHash> fields; 299 299 fields.add("FastMallocReservedVMBytes", static_cast<unsigned long long>(fastMallocStatistics.reservedVMBytes)); 300 300 fields.add("FastMallocCommittedVMBytes", static_cast<unsigned long long>(fastMallocStatistics.committedVMBytes)); … … 305 305 fields.add("JavaScriptJITSize", static_cast<unsigned long long>(globalMemoryStats.JITBytes)); 306 306 307 *statistics = COMPropertyBag<unsigned long long, String, ASCIICaseInsensitiveHash>::adopt(fields);307 *statistics = COMPropertyBag<unsigned long long, String, CaseFoldingHash>::adopt(fields); 308 308 309 309 return S_OK; -
trunk/Source/WebKit/win/WebURLResponse.cpp
r195911 r195917 363 363 return E_POINTER; 364 364 365 HashMap<String, String, ASCIICaseInsensitiveHash> fields;365 HashMap<String, String, CaseFoldingHash> fields; 366 366 for (const auto& keyValuePair : m_response.httpHeaderFields()) 367 367 fields.add(keyValuePair.key, keyValuePair.value); 368 368 369 *headerFields = COMPropertyBag<String, String, ASCIICaseInsensitiveHash>::adopt(fields);369 *headerFields = COMPropertyBag<String, String, CaseFoldingHash>::adopt(fields); 370 370 return S_OK; 371 371 } -
trunk/Source/WebKit2/ChangeLog
r195914 r195917 1 2016-01-30 Commit Queue <commit-queue@webkit.org> 2 3 Unreviewed, rolling out r195911. 4 https://bugs.webkit.org/show_bug.cgi?id=153723 5 6 Caused frequent assertion failures on bots (Requested by ap on 7 #webkit). 8 9 Reverted changeset: 10 11 "Replace CaseFoldingHash with ASCIICaseInsensitiveHash" 12 https://bugs.webkit.org/show_bug.cgi?id=153639 13 http://trac.webkit.org/changeset/195911 14 1 15 2016-01-30 Dan Bernstein <mitz@apple.com> 2 16 -
trunk/Source/WebKit2/UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm
r195911 r195917 43 43 44 44 @implementation WKWebViewContentProviderRegistry { 45 HashMap<String, Class <WKWebViewContentProvider>, ASCIICaseInsensitiveHash> _contentProviderForMIMEType;45 HashMap<String, Class <WKWebViewContentProvider>, CaseFoldingHash> _contentProviderForMIMEType; 46 46 HashCountedSet<WebPageProxy*> _pages; 47 47 } -
trunk/Source/WebKit2/UIProcess/Plugins/PlugInAutoStartProvider.h
r195911 r195917 70 70 void setAutoStartOriginsTableWithItemsPassingTest(API::Dictionary&, std::function<bool(double expirationTimestamp)>); 71 71 72 typedef HashMap<String, PlugInAutoStartOriginMap, ASCIICaseInsensitiveHash> AutoStartTable;72 typedef HashMap<String, PlugInAutoStartOriginMap, CaseFoldingHash> AutoStartTable; 73 73 typedef HashMap<WebCore::SessionID, AutoStartTable> SessionAutoStartTable; 74 74 SessionAutoStartTable m_autoStartTable; -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h
r195911 r195917 1394 1394 #endif 1395 1395 1396 HashSet<String, ASCIICaseInsensitiveHash> m_mimeTypesWithCustomContentProviders;1396 HashSet<String, CaseFoldingHash> m_mimeTypesWithCustomContentProviders; 1397 1397 WebCore::Color m_backgroundColor; 1398 1398 -
trunk/Source/WebKit2/WebProcess/WebProcess.cpp
r195911 r195917 722 722 return; 723 723 if (string.is8Bit()) { 724 hasher.addCharacters<LChar, ASCIICaseInsensitiveHash::foldCase<LChar>>(string.characters8(), string.length());725 return; 726 } 727 hasher.addCharacters<UChar, ASCIICaseInsensitiveHash::foldCase<UChar>>(string.characters16(), string.length());724 hasher.addCharacters<LChar, CaseFoldingHash::foldCase<LChar>>(string.characters8(), string.length()); 725 return; 726 } 727 hasher.addCharacters<UChar, CaseFoldingHash::foldCase<UChar>>(string.characters16(), string.length()); 728 728 } 729 729 … … 731 731 { 732 732 // We want to avoid concatenating the strings and then taking the hash, since that could lead to an expensive conversion. 733 // We also want to avoid using the hash() function in StringImpl or ASCIICaseInsensitiveHash because that masks out bits for the use of flags.733 // We also want to avoid using the hash() function in StringImpl or CaseFoldingHash because that masks out bits for the use of flags. 734 734 StringHasher hasher; 735 735 addCaseFoldedCharacters(hasher, pageOrigin); -
trunk/Tools/ChangeLog
r195911 r195917 1 2016-01-30 Commit Queue <commit-queue@webkit.org> 2 3 Unreviewed, rolling out r195911. 4 https://bugs.webkit.org/show_bug.cgi?id=153723 5 6 Caused frequent assertion failures on bots (Requested by ap on 7 #webkit). 8 9 Reverted changeset: 10 11 "Replace CaseFoldingHash with ASCIICaseInsensitiveHash" 12 https://bugs.webkit.org/show_bug.cgi?id=153639 13 http://trac.webkit.org/changeset/195911 14 1 15 2016-01-30 Darin Adler <darin@apple.com> 2 16 -
trunk/Tools/Scripts/do-webcore-rename
r195911 r195917 99 99 my %renames = ( 100 100 # Renames go here in the form of: 101 " CaseFoldingHash" => "ASCIICaseInsensitiveHash",101 "deleteAllValues" => "deprecatedDeleteAllValues", 102 102 ); 103 103
Note: See TracChangeset
for help on using the changeset viewer.