Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1545)

Unified Diff: Source/wtf/text/AtomicStringHash.h

Issue 102103002: Have HashMap<KeyType, AtomicString>::get() return a const reference (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Use AtomicString::ConstructFromLiteral Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/platform/network/ResourceResponse.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/wtf/text/AtomicStringHash.h
diff --git a/Source/wtf/text/AtomicStringHash.h b/Source/wtf/text/AtomicStringHash.h
index 96692067a3fcac249fb36ab625ac8471f81458cb..fb5e1e12a35dfafd59f4fdc5a0ff0a86d69993c8 100644
--- a/Source/wtf/text/AtomicStringHash.h
+++ b/Source/wtf/text/AtomicStringHash.h
@@ -50,6 +50,12 @@ namespace WTF {
// AtomicStringHash is the default hash for AtomicString
template<> struct HashTraits<WTF::AtomicString> : GenericHashTraits<WTF::AtomicString> {
+ // Unlike other types, we can return a const reference for AtomicString's empty value (nullAtom).
+ typedef const WTF::AtomicString& PeekType;
+
+ static const WTF::AtomicString& emptyValue() { return nullAtom; }
+ static PeekType peek(const WTF::AtomicString& value) { return value; }
+
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(); }
« no previous file with comments | « Source/platform/network/ResourceResponse.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698