diff options
Diffstat (limited to 'Source/WTF/wtf/text/AtomicStringHash.h')
-rw-r--r-- | Source/WTF/wtf/text/AtomicStringHash.h | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/Source/WTF/wtf/text/AtomicStringHash.h b/Source/WTF/wtf/text/AtomicStringHash.h index 6130d9493..417619350 100644 --- a/Source/WTF/wtf/text/AtomicStringHash.h +++ b/Source/WTF/wtf/text/AtomicStringHash.h @@ -10,7 +10,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * 3. Neither the name of Apple Inc. ("Apple") nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * @@ -48,11 +48,20 @@ namespace WTF { static const bool safeToCompareToEmptyOrDeleted = false; }; - // AtomicStringHash is the default hash for AtomicString - template<> struct HashTraits<WTF::AtomicString> : GenericHashTraits<WTF::AtomicString> { - static const bool emptyValueIsZero = true; - static void constructDeletedValue(WTF::AtomicString& slot) { new (NotNull, &slot) WTF::AtomicString(HashTableDeletedValue); } - static bool isDeletedValue(const WTF::AtomicString& slot) { return slot.isHashTableDeletedValue(); } + template<> struct HashTraits<WTF::AtomicString> : SimpleClassHashTraits<WTF::AtomicString> { + static const bool hasIsEmptyValueFunction = true; + static bool isEmptyValue(const AtomicString& value) + { + return value.isNull(); + } + + static void customDeleteBucket(AtomicString& value) + { + // See unique_ptr's customDeleteBucket() for an explanation. + ASSERT(!isDeletedValue(value)); + AtomicString valueToBeDestroyed = WTFMove(value); + constructDeletedValue(value); + } }; } |