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

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

Issue 178803006: Turn MQ classes into thread safe (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Removed StringImpl comparison atomic check Created 6 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
« no previous file with comments | « Source/core/css/MediaQueryExp.cpp ('k') | Source/core/html/parser/HTMLParserIdioms.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/parser/HTMLParserIdioms.h
diff --git a/Source/core/html/parser/HTMLParserIdioms.h b/Source/core/html/parser/HTMLParserIdioms.h
index 49dbed3ba6c6639e80eff7daa5847e36dc3b8b1c..4cfb3d4f62d69b7ebf059be6875da0930f412000 100644
--- a/Source/core/html/parser/HTMLParserIdioms.h
+++ b/Source/core/html/parser/HTMLParserIdioms.h
@@ -107,29 +107,29 @@ inline bool isNotHTMLSpace(CharType character)
bool threadSafeMatch(const QualifiedName&, const QualifiedName&);
bool threadSafeMatch(const String&, const QualifiedName&);
-StringImpl* findStringIfStatic(const UChar* characters, unsigned length);
-
enum CharacterWidth {
Likely8Bit,
Force8Bit,
Force16Bit
};
+String attemptStaticStringCreation(const LChar*, size_t);
+
+String attemptStaticStringCreation(const UChar*, size_t, CharacterWidth);
+
template<size_t inlineCapacity>
-static String attemptStaticStringCreation(const Vector<UChar, inlineCapacity>& vector, CharacterWidth width)
+inline static String attemptStaticStringCreation(const Vector<UChar, inlineCapacity>& vector, CharacterWidth width)
{
- String string(findStringIfStatic(vector.data(), vector.size()));
- if (string.impl())
- return string;
- if (width == Likely8Bit)
- string = StringImpl::create8BitIfPossible(vector);
- else if (width == Force8Bit)
- string = String::make8BitFrom16BitSource(vector);
- else
- string = String(vector);
-
- return string;
+ return attemptStaticStringCreation(vector.data(), vector.size(), width);
}
+inline static String attemptStaticStringCreation(const String str)
+{
+ if (!str.is8Bit())
+ return attemptStaticStringCreation(str.characters16(), str.length(), Force16Bit);
+ return attemptStaticStringCreation(str.characters8(), str.length());
+}
+
+
}
#endif
« no previous file with comments | « Source/core/css/MediaQueryExp.cpp ('k') | Source/core/html/parser/HTMLParserIdioms.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698