diff options
Diffstat (limited to 'chromium/third_party/WebKit/Source/wtf/text/AtomicString.cpp')
-rw-r--r-- | chromium/third_party/WebKit/Source/wtf/text/AtomicString.cpp | 35 |
1 files changed, 8 insertions, 27 deletions
diff --git a/chromium/third_party/WebKit/Source/wtf/text/AtomicString.cpp b/chromium/third_party/WebKit/Source/wtf/text/AtomicString.cpp index 8ba6875953c..76d99b71400 100644 --- a/chromium/third_party/WebKit/Source/wtf/text/AtomicString.cpp +++ b/chromium/third_party/WebKit/Source/wtf/text/AtomicString.cpp @@ -52,7 +52,7 @@ public: if (!string->length()) return StringImpl::empty(); - StringImpl* result = *m_table.add(string).iterator; + StringImpl* result = *m_table.add(string).storedValue; if (!result->isAtomic()) result->setIsAtomic(true); @@ -117,36 +117,17 @@ static inline PassRefPtr<StringImpl> addToStringTable(const T& value) // If the string is newly-translated, then we need to adopt it. // The boolean in the pair tells us if that is so. - return addResult.isNewEntry ? adoptRef(*addResult.iterator) : *addResult.iterator; + return addResult.isNewEntry ? adoptRef(*addResult.storedValue) : *addResult.storedValue; } -struct CStringTranslator { - static unsigned hash(const LChar* c) - { - return StringHasher::computeHashAndMaskTop8Bits(c); - } - - static inline bool equal(StringImpl* r, const LChar* s) - { - return WTF::equal(r, s); - } - - static void translate(StringImpl*& location, const LChar* const& c, unsigned hash) - { - location = StringImpl::create(c).leakRef(); - location->setHash(hash); - location->setIsAtomic(true); - } -}; - PassRefPtr<StringImpl> AtomicString::add(const LChar* c) { if (!c) - return 0; + return nullptr; if (!*c) return StringImpl::empty(); - return addToStringTable<const LChar*, CStringTranslator>(c); + return add(c, strlen(reinterpret_cast<const char*>(c))); } template<typename CharacterType> @@ -276,7 +257,7 @@ struct HashAndUTF8CharactersTranslator { PassRefPtr<StringImpl> AtomicString::add(const UChar* s, unsigned length) { if (!s) - return 0; + return nullptr; if (!length) return StringImpl::empty(); @@ -300,7 +281,7 @@ PassRefPtr<StringImpl> AtomicString::add(const UChar* s, unsigned length, unsign PassRefPtr<StringImpl> AtomicString::add(const UChar* s) { if (!s) - return 0; + return nullptr; unsigned length = 0; while (s[length] != UChar(0)) @@ -345,7 +326,7 @@ struct SubstringTranslator { PassRefPtr<StringImpl> AtomicString::add(StringImpl* baseString, unsigned start, unsigned length) { if (!baseString) - return 0; + return nullptr; if (!length || start >= baseString->length()) return StringImpl::empty(); @@ -404,7 +385,7 @@ struct CharBufferFromLiteralDataTranslator { PassRefPtr<StringImpl> AtomicString::add(const LChar* s, unsigned length) { if (!s) - return 0; + return nullptr; if (!length) return StringImpl::empty(); |