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

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

Issue 1844223002: Literal AtomicString construction can rely on strlen optimization. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
Index: third_party/WebKit/Source/wtf/text/AtomicString.cpp
diff --git a/third_party/WebKit/Source/wtf/text/AtomicString.cpp b/third_party/WebKit/Source/wtf/text/AtomicString.cpp
index 2885ad1be673344508dd790079d17c19905bf23c..c4f7d2cefa9270f2bd48b6e91621d1a0e66f07fb 100644
--- a/third_party/WebKit/Source/wtf/text/AtomicString.cpp
+++ b/third_party/WebKit/Source/wtf/text/AtomicString.cpp
@@ -125,16 +125,6 @@ static inline PassRefPtr<StringImpl> addToStringTable(const T& value)
return addResult.isNewEntry ? adoptRef(*addResult.storedValue) : *addResult.storedValue;
}
-PassRefPtr<StringImpl> AtomicString::add(const LChar* c)
-{
- if (!c)
- return nullptr;
- if (!*c)
- return StringImpl::empty();
-
- return add(c, strlen(reinterpret_cast<const char*>(c)));
-}
-
template<typename CharacterType>
struct HashTranslatorCharBuffer {
const CharacterType* s;
@@ -367,26 +357,6 @@ struct LCharBufferTranslator {
}
};
-typedef HashTranslatorCharBuffer<char> CharBuffer;
-struct CharBufferFromLiteralDataTranslator {
- static unsigned hash(const CharBuffer& buf)
- {
- return StringHasher::computeHashAndMaskTop8Bits(reinterpret_cast<const LChar*>(buf.s), buf.length);
- }
-
- static bool equal(StringImpl* const& str, const CharBuffer& buf)
- {
- return WTF::equal(str, buf.s, buf.length);
- }
-
- static void translate(StringImpl*& location, const CharBuffer& buf, unsigned hash)
- {
- location = StringImpl::create(buf.s, buf.length).leakRef();
- location->setHash(hash);
- location->setIsAtomic(true);
- }
-};
-
PassRefPtr<StringImpl> AtomicString::add(const LChar* s, unsigned length)
{
if (!s)
@@ -399,15 +369,6 @@ PassRefPtr<StringImpl> AtomicString::add(const LChar* s, unsigned length)
return addToStringTable<LCharBuffer, LCharBufferTranslator>(buffer);
}
-PassRefPtr<StringImpl> AtomicString::addFromLiteralData(const char* characters, unsigned length)
-{
- ASSERT(characters);
- ASSERT(length);
-
- CharBuffer buffer = { characters, length };
- return addToStringTable<CharBuffer, CharBufferFromLiteralDataTranslator>(buffer);
-}
-
PassRefPtr<StringImpl> AtomicString::addSlowCase(StringImpl* string)
{
return atomicStringTable().addStringImpl(string);

Powered by Google App Engine
This is Rietveld 408576698