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

Unified Diff: Source/wtf/text/AtomicString.cpp

Issue 328453003: Refactor to remove unnecessary code from the string hashing functions (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix the unit tests Created 6 years, 6 months 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/wtf/StringHasherTest.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/AtomicString.cpp
diff --git a/Source/wtf/text/AtomicString.cpp b/Source/wtf/text/AtomicString.cpp
index 667f4e5b2df393b262f6dc950f4d3a4e59d72d11..76d99b714002f48c67d09c0e686bf2713d2d1940 100644
--- a/Source/wtf/text/AtomicString.cpp
+++ b/Source/wtf/text/AtomicString.cpp
@@ -120,25 +120,6 @@ static inline PassRefPtr<StringImpl> addToStringTable(const T& value)
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)
@@ -146,7 +127,7 @@ PassRefPtr<StringImpl> AtomicString::add(const LChar* c)
if (!*c)
return StringImpl::empty();
- return addToStringTable<const LChar*, CStringTranslator>(c);
+ return add(c, strlen(reinterpret_cast<const char*>(c)));
}
template<typename CharacterType>
« no previous file with comments | « Source/wtf/StringHasherTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698