Changeset 195917 in webkit


Ignore:
Timestamp:
Jan 30, 2016 4:53:20 PM (8 years ago)
Author:
commit-queue@webkit.org
Message:

Unreviewed, rolling out r195911.
https://bugs.webkit.org/show_bug.cgi?id=153723

Caused frequent assertion failures on bots (Requested by ap on
#webkit).

Reverted changeset:

"Replace CaseFoldingHash with ASCIICaseInsensitiveHash"
https://bugs.webkit.org/show_bug.cgi?id=153639
http://trac.webkit.org/changeset/195911

Location:
trunk
Files:
37 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r195911 r195917  
     12016-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
    1152016-01-30  Darin Adler  <darin@apple.com>
    216
  • trunk/Source/WTF/wtf/text/StringHash.h

    r195911 r195917  
    11/*
    2  * Copyright (C) 2006-2008, 2012-2013, 2016 Apple Inc. All rights reserved
     2 * Copyright (C) 2006, 2007, 2008, 2012, 2013 Apple Inc. All rights reserved
    33 * Copyright (C) Research In Motion Limited 2009. All rights reserved.
    44 *
     
    3434    }
    3535
    36     // The hash() functions on StringHash and ASCIICaseInsensitiveHash do not support
     36    // The hash() functions on StringHash and CaseFoldingHash do not support
    3737    // null strings. get(), contains(), and add() on HashMap<String,..., StringHash>
    3838    // cause a null-pointer dereference when passed null strings.
     
    7272    };
    7373
    74     class ASCIICaseInsensitiveHash {
     74    class CaseFoldingHash {
    7575    public:
    7676        template<typename T> static inline UChar foldCase(T character)
    7777        {
    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);
    7982        }
    8083
     
    103106        static inline unsigned hash(const char* data, unsigned length)
    104107        {
    105             return hash(reinterpret_cast<const LChar*>(data), length);
     108            return CaseFoldingHash::hash(reinterpret_cast<const LChar*>(data), length);
    106109        }
    107110       
    108         static inline bool equal(const StringImpl& a, const StringImpl& b)
    109         {
    110             return equalIgnoringASCIICase(a, b);
    111         }
    112111        static inline bool equal(const StringImpl* a, const StringImpl* b)
    113112        {
    114             ASSERT(a);
    115             ASSERT(b);
    116             return equal(*a, *b);
     113            return equalCompatibiltyCaselessNonNull(a, b);
    117114        }
    118115
    119116        static unsigned hash(const RefPtr<StringImpl>& key)
    120117        {
    121             return hash(key.get());
     118            return hash(*key);
    122119        }
    123120
     
    171168}
    172169
    173 using WTF::ASCIICaseInsensitiveHash;
    174170using WTF::AlreadyHashed;
     171using WTF::CaseFoldingHash;
    175172using WTF::StringHash;
    176173
  • trunk/Source/WTF/wtf/text/StringImpl.cpp

    r195911 r195917  
    951951}
    952952
    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)
     953static inline bool equalCompatibiltyCaseless(const LChar* a, const LChar* b, unsigned length)
    974954{
    975955    while (length--) {
    976         if (latin1CaseFoldTable[*a++] != latin1CaseFoldTable[*b++])
     956        if (StringImpl::latin1CaseFoldTable[*a++] != StringImpl::latin1CaseFoldTable[*b++])
    977957            return false;
    978958    }
     
    980960}
    981961
    982 static inline bool equalCompatibilityCaseless(const UChar* a, const LChar* b, unsigned length)
     962static inline bool equalCompatibiltyCaseless(const UChar* a, const LChar* b, unsigned length)
    983963{
    984964    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++])
    986966            return false;
    987967    }
     
    989969}
    990970
    991 static inline bool equalCompatibilityCaseless(const LChar* a, const UChar* b, unsigned length)
    992 {
    993     return equalCompatibilityCaseless(b, a, length);
    994 }
    995 
    996 static inline bool equalCompatibilityCaseless(const UChar* a, const UChar* b, unsigned length)
     971static inline bool equalCompatibiltyCaseless(const LChar* a, const UChar* b, unsigned length)
     972{
     973    return equalCompatibiltyCaseless(b, a, length);
     974}
     975
     976static inline bool equalCompatibiltyCaseless(const UChar* a, const UChar* b, unsigned length)
    997977{
    998978    return !u_memcasecmp(a, b, length, U_FOLD_CASE_DEFAULT);
     
    11031083
    11041084        unsigned i = 0;
    1105         while (!equalCompatibilityCaseless(searchCharacters + i, matchString, matchLength)) {
     1085        while (!equalCompatibiltyCaseless(searchCharacters + i, matchString, matchLength)) {
    11061086            if (i == delta)
    11071087                return notFound;
     
    11141094
    11151095    unsigned i = 0;
    1116     while (!equalCompatibilityCaseless(searchCharacters + i, matchString, matchLength)) {
     1096    while (!equalCompatibiltyCaseless(searchCharacters + i, matchString, matchLength)) {
    11171097        if (i == delta)
    11181098            return notFound;
     
    11781158    unsigned i = 0;
    11791159    // keep looping until we match
    1180     while (!equalCompatibilityCaseless(searchCharacters + i, matchCharacters, matchLength)) {
     1160    while (!equalCompatibiltyCaseless(searchCharacters + i, matchCharacters, matchLength)) {
    11811161        if (i == delta)
    11821162            return notFound;
     
    13191299
    13201300    // keep looping until we match
    1321     while (!equalCompatibilityCaseless(searchCharacters + delta, matchCharacters, matchLength)) {
     1301    while (!equalCompatibiltyCaseless(searchCharacters + delta, matchCharacters, matchLength)) {
    13221302        if (!delta)
    13231303            return notFound;
     
    13651345    }
    13661346    if (stringImpl->is8Bit())
    1367         return equalCompatibilityCaseless(stringImpl->characters8() + startOffset, reinterpret_cast<const LChar*>(matchString), matchLength);
    1368     return equalCompatibilityCaseless(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);
    13691349}
    13701350
     
    19391919}
    19401920
     1921bool 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
    19411945bool equalIgnoringNullity(StringImpl* a, StringImpl* b)
    19421946{
     
    21382142}
    21392143
     2144// Table is based on ftp://ftp.unicode.org/Public/UNIDATA/CaseFolding.txt
     2145const 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
    21402164bool equalIgnoringNullity(const UChar* a, size_t aLength, StringImpl* b)
    21412165{
  • trunk/Source/WTF/wtf/text/StringImpl.h

    r195911 r195917  
    763763#endif
    764764
     765    WTF_EXPORT_STRING_API static const UChar latin1CaseFoldTable[256];
     766
    765767    Ref<StringImpl> extractFoldedStringInSymbol()
    766768    {
     
    945947WTF_EXPORT_STRING_API bool equal(const StringImpl& a, const StringImpl& b);
    946948
     949// FIXME: Deprecated. Used only by CaseFoldingHash, which itself is soon to be deprecated and removed, replaced by ASCIICaseFoldingHash.
     950WTF_EXPORT_STRING_API bool equalCompatibiltyCaselessNonNull(const StringImpl*, const StringImpl*);
     951
    947952WTF_EXPORT_STRING_API bool equalIgnoringNullity(StringImpl*, StringImpl*);
    948953WTF_EXPORT_STRING_API bool equalIgnoringNullity(const UChar*, size_t length, StringImpl*);
  • trunk/Source/WebCore/ChangeLog

    r195916 r195917  
     12016-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
    1152016-01-30  Commit Queue  <commit-queue@webkit.org>
    216
  • trunk/Source/WebCore/Modules/webdatabase/DatabaseAuthorizer.h

    r195911 r195917  
    118118    const String m_databaseInfoTableName;
    119119
    120     HashSet<String, ASCIICaseInsensitiveHash> m_whitelistedFunctions;
     120    HashSet<String, CaseFoldingHash> m_whitelistedFunctions;
    121121};
    122122
  • trunk/Source/WebCore/accessibility/AccessibilityObject.cpp

    r195911 r195917  
    19891989}
    19901990
    1991 typedef HashMap<String, AccessibilityRole, ASCIICaseInsensitiveHash> ARIARoleMap;
     1991typedef HashMap<String, AccessibilityRole, CaseFoldingHash> ARIARoleMap;
    19921992typedef HashMap<AccessibilityRole, String, DefaultHash<int>::Hash, WTF::UnsignedWithZeroKeyHashTraits<int>> ARIAReverseRoleMap;
    19931993
  • trunk/Source/WebCore/crypto/CryptoAlgorithmRegistry.h

    r195911 r195917  
    6666    void registerAlgorithm(const String& name, CryptoAlgorithmIdentifier, CryptoAlgorithmConstructor);
    6767
    68     HashMap<String, CryptoAlgorithmIdentifier, ASCIICaseInsensitiveHash> m_nameToIdentifierMap;
     68    HashMap<String, CryptoAlgorithmIdentifier, CaseFoldingHash> m_nameToIdentifierMap;
    6969    HashMap<unsigned, String> m_identifierToNameMap;
    7070    HashMap<unsigned, CryptoAlgorithmConstructor> m_identifierToConstructorMap;
  • trunk/Source/WebCore/css/CSSFontSelector.cpp

    r195911 r195917  
    225225}
    226226
    227 static void registerLocalFontFacesForFamily(const String& familyName, HashMap<String, Vector<Ref<CSSFontFace>>, ASCIICaseInsensitiveHash>& locallyInstalledFontFaces)
     227static void registerLocalFontFacesForFamily(const String& familyName, HashMap<String, Vector<Ref<CSSFontFace>>, CaseFoldingHash>& locallyInstalledFontFaces)
    228228{
    229229    ASSERT(!locallyInstalledFontFaces.contains(familyName));
  • trunk/Source/WebCore/css/CSSFontSelector.h

    r195911 r195917  
    8787
    8888    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;
    9292    HashSet<FontSelectorClient*> m_clients;
    9393
  • trunk/Source/WebCore/dom/DOMImplementation.cpp

    r195911 r195917  
    6565using namespace HTMLNames;
    6666
    67 typedef HashSet<String, ASCIICaseInsensitiveHash> FeatureSet;
     67typedef HashSet<String, CaseFoldingHash> FeatureSet;
    6868
    6969static void addString(FeatureSet& set, const char* string)
  • trunk/Source/WebCore/dom/Document.h

    r195911 r195917  
    16141614#endif
    16151615
    1616     HashMap<StringImpl*, Element*, ASCIICaseInsensitiveHash> m_elementsByAccessKey;
     1616    HashMap<StringImpl*, Element*, CaseFoldingHash> m_elementsByAccessKey;
    16171617    bool m_accessKeyMapValid;
    16181618
  • trunk/Source/WebCore/dom/ScriptElement.cpp

    r195911 r195917  
    119119
    120120    // 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;
    122122    static NeverDestroyed<LanguageSet> languages;
    123123    if (languages.get().isEmpty()) {
  • trunk/Source/WebCore/editing/EditorCommand.cpp

    r195911 r195917  
    7878};
    7979
    80 typedef HashMap<String, const EditorInternalCommand*, ASCIICaseInsensitiveHash> CommandMap;
     80typedef HashMap<String, const EditorInternalCommand*, CaseFoldingHash> CommandMap;
    8181
    8282static const bool notTextInsertion = false;
  • trunk/Source/WebCore/html/HTMLObjectElement.cpp

    r195911 r195917  
    167167void HTMLObjectElement::parametersForPlugin(Vector<String>& paramNames, Vector<String>& paramValues, String& url, String& serviceType)
    168168{
    169     HashSet<StringImpl*, ASCIICaseInsensitiveHash> uniqueParamNames;
     169    HashSet<StringImpl*, CaseFoldingHash> uniqueParamNames;
    170170    String urlParameter;
    171171   
  • trunk/Source/WebCore/html/InputType.cpp

    r195911 r195917  
    8787typedef const AtomicString& (*InputTypeNameFunction)();
    8888typedef std::unique_ptr<InputType> (*InputTypeFactoryFunction)(HTMLInputElement&);
    89 typedef HashMap<AtomicString, InputTypeFactoryFunction, ASCIICaseInsensitiveHash> InputTypeFactoryMap;
     89typedef HashMap<AtomicString, InputTypeFactoryFunction, CaseFoldingHash> InputTypeFactoryMap;
    9090
    9191template<class T>
  • trunk/Source/WebCore/loader/CrossOriginAccessControl.h

    r195911 r195917  
    3535namespace WebCore {
    3636
    37 typedef HashSet<String, ASCIICaseInsensitiveHash> HTTPHeaderSet;
     37typedef HashSet<String, CaseFoldingHash> HTTPHeaderSet;
    3838
    3939class HTTPHeaderMap;
  • trunk/Source/WebCore/loader/CrossOriginPreflightResultCache.h

    r195911 r195917  
    6060    StoredCredentials m_credentials;
    6161    HashSet<String> m_methods;
    62     HashSet<String, ASCIICaseInsensitiveHash> m_headers;
     62    HashSet<String, CaseFoldingHash> m_headers;
    6363};
    6464
  • trunk/Source/WebCore/loader/archive/ArchiveFactory.cpp

    r195911 r195917  
    4848
    4949typedef PassRefPtr<Archive> RawDataCreationFunction(const URL&, SharedBuffer*);
    50 typedef HashMap<String, RawDataCreationFunction*, ASCIICaseInsensitiveHash> ArchiveMIMETypesMap;
     50typedef HashMap<String, RawDataCreationFunction*, CaseFoldingHash> ArchiveMIMETypesMap;
    5151
    5252// The create functions in the archive classes return PassRefPtr to concrete subclasses
  • trunk/Source/WebCore/platform/MIMETypeRegistry.cpp

    r195911 r195917  
    151151static HashSet<String>* unsupportedTextMIMETypes;
    152152
    153 typedef HashMap<String, Vector<String>*, ASCIICaseInsensitiveHash> MediaMIMETypeMap;
     153typedef HashMap<String, Vector<String>*, CaseFoldingHash> MediaMIMETypeMap;
    154154   
    155155static void initializeSupportedImageMIMETypes()
  • trunk/Source/WebCore/platform/SchemeRegistry.h

    r195911 r195917  
    3333namespace WebCore {
    3434
    35 typedef HashSet<String, ASCIICaseInsensitiveHash> URLSchemesMap;
     35typedef HashSet<String, CaseFoldingHash> URLSchemesMap;
    3636
    3737class SchemeRegistry {
  • trunk/Source/WebCore/platform/URL.cpp

    r195911 r195917  
    19911991}
    19921992
    1993 typedef HashMap<String, unsigned short, ASCIICaseInsensitiveHash> DefaultPortsMap;
     1993typedef HashMap<String, unsigned short, CaseFoldingHash> DefaultPortsMap;
    19941994static const DefaultPortsMap& defaultPortsMap()
    19951995{
  • trunk/Source/WebCore/platform/graphics/FontCache.cpp

    r195911 r195917  
    9898
    9999struct FontPlatformDataCacheKey {
    100     AtomicString family;
    101     FontDescriptionKey description;
    102 
    103     FontPlatformDataCacheKey() = default;
     100    WTF_MAKE_FAST_ALLOCATED;
     101public:
     102    FontPlatformDataCacheKey() { }
    104103    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;
    117127};
    118128
    119129struct 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         
    124135    static bool equal(const FontPlatformDataCacheKey& a, const FontPlatformDataCacheKey& b)
    125136    {
    126         return a.description == b.description && equalIgnoringASCIICase(a.family, b.family);
    127     }
     137        return a == b;
     138    }
     139
    128140    static const bool safeToCompareToEmptyOrDeleted = true;
    129141};
    130142
    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;
     143typedef HashMap<FontPlatformDataCacheKey, std::unique_ptr<FontPlatformData>, FontPlatformDataCacheKeyHash, WTF::SimpleClassHashTraits<FontPlatformDataCacheKey>> FontPlatformDataCache;
    140144
    141145static FontPlatformDataCache& fontPlatformDataCache()
     
    204208}
    205209
    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)
     210FontPlatformData* FontCache::getCachedFontPlatformData(const FontDescription& fontDescription,
     211                                                       const AtomicString& passedFamilyName,
     212                                                      bool checkingAlternateName)
    209213{
    210214#if PLATFORM(IOS)
     
    215219    // Leading "@" in the font name enables Windows vertical flow flag for the font.
    216220    // Because we do vertical flow by ourselves, we don't want to use the Windows feature.
    217     // IE disregards "@" regardless of the orientation, 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));
    220224#else
    221225    const AtomicString& familyName = passedFamilyName;
     
    234238    if (addResult.isNewEntry) {
    235239        it->value = createFontPlatformData(fontDescription, familyName);
     240
    236241        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             auto alternateName = 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);
    240245            if (!alternateName.isNull()) {
    241246                FontPlatformData* fontPlatformDataForAlternateName = getCachedFontPlatformData(fontDescription, alternateName, true);
    242                 // Look up the key in the hash table again as the previous iterator may have
     247                // Lookup the key in the hash table again as the previous iterator may have
    243248                // been invalidated by the recursive call to getCachedFontPlatformData().
    244249                it = fontPlatformDataCache().find(key);
  • trunk/Source/WebCore/platform/graphics/FontCascade.cpp

    r195911 r195917  
    191191};
    192192
    193 // FIXME: Should make hash traits for FontCascadeCacheKey instead of using a hash as the key (so we hash a hash).
    194193typedef HashMap<unsigned, std::unique_ptr<FontCascadeCacheEntry>, AlreadyHashed> FontCascadeCache;
    195194
    196 static bool keysMatch(const FontCascadeCacheKey& a, const FontCascadeCacheKey& b)
     195static bool operator==(const FontCascadeCacheKey& a, const FontCascadeCacheKey& b)
    197196{
    198197    if (a.fontDescriptionKey != b.fontDescriptionKey)
     
    200199    if (a.fontSelectorId != b.fontSelectorId || a.fontSelectorVersion != b.fontSelectorVersion)
    201200        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))
    207209            return false;
    208210    }
     
    231233    FontCascadeCacheKey key;
    232234    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));
    237237    key.fontSelectorId = fontSelector ? fontSelector->uniqueId() : 0;
    238238    key.fontSelectorVersion = fontSelector ? fontSelector->version() : 0;
     
    240240}
    241241
     242// FIXME: Why can't we just teach HashMap about FontCascadeCacheKey instead of hashing a hash?
    242243static unsigned computeFontCascadeCacheHash(const FontCascadeCacheKey& key)
    243244{
    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     hasher.add(key.fontSelectorId);
    248     hasher.add(key.fontSelectorVersion);
    249     for (unsigned i = 0; i < key.families.size(); ++i) {
    250         StringImpl* family = key.families[i].impl();
    251         hasher.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));
    254255}
    255256
     
    272273
    273274    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)
    276277        return addResult.iterator->value->fonts.get();
    277278
  • trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp

    r195911 r195917  
    646646}
    647647
    648 typedef HashSet<String, ASCIICaseInsensitiveHash> Whitelist;
     648typedef HashSet<String, CaseFoldingHash> Whitelist;
    649649static Whitelist& fontWhitelist()
    650650{
  • trunk/Source/WebCore/platform/network/HTTPHeaderMap.h

    r195911 r195917  
    4949public:
    5050    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;
    5252
    5353    class HTTPHeaderMapConstIterator {
  • trunk/Source/WebCore/rendering/style/RenderStyle.cpp

    r195911 r195917  
    367367
    368368#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 unsigned RenderStyle::hashForTextAutosizing() const
     369inline 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
     378uint32_t RenderStyle::hashForTextAutosizing() const
    379379{
    380380    // 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;
    382384    hash ^= rareNonInheritedData->marginBeforeCollapse;
    383385    hash ^= rareNonInheritedData->marginAfterCollapse;
     
    420422        && rareNonInheritedData->textOverflow == other->rareNonInheritedData->textOverflow;
    421423}
    422 
    423424#endif // ENABLE(IOS_TEXT_AUTOSIZING)
    424425
  • trunk/Source/WebKit/win/ChangeLog

    r195916 r195917  
     12016-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
    1152016-01-30  Commit Queue  <commit-queue@webkit.org>
    216
  • trunk/Source/WebKit/win/WebCoreStatistics.cpp

    r195911 r195917  
    296296    GlobalMemoryStatistics globalMemoryStats = globalMemoryStatistics();
    297297
    298     HashMap<String, unsigned long long, ASCIICaseInsensitiveHash> fields;
     298    HashMap<String, unsigned long long, CaseFoldingHash> fields;
    299299    fields.add("FastMallocReservedVMBytes", static_cast<unsigned long long>(fastMallocStatistics.reservedVMBytes));
    300300    fields.add("FastMallocCommittedVMBytes", static_cast<unsigned long long>(fastMallocStatistics.committedVMBytes));
     
    305305    fields.add("JavaScriptJITSize", static_cast<unsigned long long>(globalMemoryStats.JITBytes));
    306306
    307     *statistics = COMPropertyBag<unsigned long long, String, ASCIICaseInsensitiveHash>::adopt(fields);
     307    *statistics = COMPropertyBag<unsigned long long, String, CaseFoldingHash>::adopt(fields);
    308308
    309309    return S_OK;
  • trunk/Source/WebKit/win/WebURLResponse.cpp

    r195911 r195917  
    363363        return E_POINTER;
    364364
    365     HashMap<String, String, ASCIICaseInsensitiveHash> fields;
     365    HashMap<String, String, CaseFoldingHash> fields;
    366366    for (const auto& keyValuePair : m_response.httpHeaderFields())
    367367        fields.add(keyValuePair.key, keyValuePair.value);
    368368
    369     *headerFields = COMPropertyBag<String, String, ASCIICaseInsensitiveHash>::adopt(fields);
     369    *headerFields = COMPropertyBag<String, String, CaseFoldingHash>::adopt(fields);
    370370    return S_OK;
    371371}
  • trunk/Source/WebKit2/ChangeLog

    r195914 r195917  
     12016-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
    1152016-01-30  Dan Bernstein  <mitz@apple.com>
    216
  • trunk/Source/WebKit2/UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm

    r195911 r195917  
    4343
    4444@implementation WKWebViewContentProviderRegistry {
    45     HashMap<String, Class <WKWebViewContentProvider>, ASCIICaseInsensitiveHash> _contentProviderForMIMEType;
     45    HashMap<String, Class <WKWebViewContentProvider>, CaseFoldingHash> _contentProviderForMIMEType;
    4646    HashCountedSet<WebPageProxy*> _pages;
    4747}
  • trunk/Source/WebKit2/UIProcess/Plugins/PlugInAutoStartProvider.h

    r195911 r195917  
    7070    void setAutoStartOriginsTableWithItemsPassingTest(API::Dictionary&, std::function<bool(double expirationTimestamp)>);
    7171
    72     typedef HashMap<String, PlugInAutoStartOriginMap, ASCIICaseInsensitiveHash> AutoStartTable;
     72    typedef HashMap<String, PlugInAutoStartOriginMap, CaseFoldingHash> AutoStartTable;
    7373    typedef HashMap<WebCore::SessionID, AutoStartTable> SessionAutoStartTable;
    7474    SessionAutoStartTable m_autoStartTable;
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h

    r195911 r195917  
    13941394#endif
    13951395
    1396     HashSet<String, ASCIICaseInsensitiveHash> m_mimeTypesWithCustomContentProviders;
     1396    HashSet<String, CaseFoldingHash> m_mimeTypesWithCustomContentProviders;
    13971397    WebCore::Color m_backgroundColor;
    13981398
  • trunk/Source/WebKit2/WebProcess/WebProcess.cpp

    r195911 r195917  
    722722        return;
    723723    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());
    728728}
    729729
     
    731731{
    732732    // 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.
    734734    StringHasher hasher;
    735735    addCaseFoldedCharacters(hasher, pageOrigin);
  • trunk/Tools/ChangeLog

    r195911 r195917  
     12016-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
    1152016-01-30  Darin Adler  <darin@apple.com>
    216
  • trunk/Tools/Scripts/do-webcore-rename

    r195911 r195917  
    9999my %renames = (
    100100    # Renames go here in the form of:
    101     "CaseFoldingHash" => "ASCIICaseInsensitiveHash",
     101    "deleteAllValues" => "deprecatedDeleteAllValues",
    102102);
    103103
Note: See TracChangeset for help on using the changeset viewer.