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

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

Issue 2033503002: Add StringView::toAtomicString(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add tests. Created 4 years, 7 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/StringView.cpp
diff --git a/third_party/WebKit/Source/wtf/text/StringView.cpp b/third_party/WebKit/Source/wtf/text/StringView.cpp
index 6135d8d258118808288766b95b247f8f5c0df942..8fc2238358b8962926da02415899ce2e60080681 100644
--- a/third_party/WebKit/Source/wtf/text/StringView.cpp
+++ b/third_party/WebKit/Source/wtf/text/StringView.cpp
@@ -35,6 +35,17 @@ String StringView::toString() const
return StringImpl::create8BitIfPossible(m_data.characters16, m_length);
}
+AtomicString StringView::toAtomicString() const
+{
+ if (isNull())
+ return nullAtom;
+ if (isEmpty())
+ return emptyAtom;
+ if (is8Bit())
+ return AtomicString(m_data.characters8, m_length);
+ return AtomicString(m_data.characters16, m_length);
+}
+
bool equalStringView(const StringView& a, const StringView& b)
{
if (a.isNull() || b.isNull())
« no previous file with comments | « third_party/WebKit/Source/wtf/text/StringView.h ('k') | third_party/WebKit/Source/wtf/text/StringViewTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698