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

Unified Diff: Source/core/html/parser/HTMLIdentifier.h

Issue 110843004: Replaced HTMLIdentifier with an atomized string factory function (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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
Index: Source/core/html/parser/HTMLIdentifier.h
diff --git a/Source/core/html/parser/HTMLIdentifier.h b/Source/core/html/parser/HTMLIdentifier.h
index 003401314234ae5f0dfa3c35500594457900f15d..eda25ad8c5a907a3c4b18c69438d4308ff3fd058 100644
--- a/Source/core/html/parser/HTMLIdentifier.h
+++ b/Source/core/html/parser/HTMLIdentifier.h
@@ -40,34 +40,25 @@ enum CharacterWidth {
class HTMLIdentifier {
public:
- HTMLIdentifier() { }
template<size_t inlineCapacity>
- HTMLIdentifier(const Vector<UChar, inlineCapacity>& vector, CharacterWidth width)
- : m_string(findIfKnown(vector.data(), vector.size()))
+ static String create(const Vector<UChar, inlineCapacity>& vector, CharacterWidth width)
{
- if (m_string.impl())
- return;
+ String string(findIfKnown(vector.data(), vector.size()));
+ if (string.impl())
+ return string;
if (width == Likely8Bit)
- m_string = StringImpl::create8BitIfPossible(vector);
+ string = StringImpl::create8BitIfPossible(vector);
else if (width == Force8Bit)
- m_string = String::make8BitFrom16BitSource(vector);
+ string = String::make8BitFrom16BitSource(vector);
else
- m_string = String(vector);
- }
+ string = String(vector);
- // asString should only be used on the main thread.
- const String& asString() const;
- // asStringImpl() is safe to call from any thread.
- const StringImpl* asStringImpl() const;
+ return string;
+ }
abarth-chromium 2013/12/10 01:22:52 It seems like we don't need this class anymore. W
static void init();
- bool isSafeToSendToAnotherThread() const { return m_string.isSafeToSendToAnotherThread(); }
-
-#ifndef NDEBUG
- static bool isKnown(const StringImpl*);
-#endif
private:
static unsigned maxNameLength;

Powered by Google App Engine
This is Rietveld 408576698