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

Unified Diff: third_party/WebKit/Source/core/css/parser/CSSParserString.h

Issue 2007103003: Expand WTF::StringView's API to be more like StringPiece. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove bad assert. 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/parser/HTMLSrcsetParser.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/css/parser/CSSParserString.h
diff --git a/third_party/WebKit/Source/core/css/parser/CSSParserString.h b/third_party/WebKit/Source/core/css/parser/CSSParserString.h
index 7b868fd9aee88e46c143b17e88e2ddc28e78bff4..58c12ed30a32903f7a5b4aeb15f5447809514b86 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSParserString.h
+++ b/third_party/WebKit/Source/core/css/parser/CSSParserString.h
@@ -23,6 +23,7 @@
#include "wtf/Allocator.h"
#include "wtf/text/AtomicString.h"
+#include "wtf/text/StringView.h"
#include "wtf/text/WTFString.h"
namespace blink {
@@ -89,9 +90,12 @@ struct CSSParserString {
return is8Bit() ? WTF::equalIgnoringASCIICase(characters8(), match, length()) : WTF::equalIgnoringASCIICase(characters16(), match, length());
}
+ // TODO(esprehn): Remove both of these implicit operators, they're very expensive.
operator String() const { return is8Bit() ? String(m_data.characters8, m_length) : StringImpl::create8BitIfPossible(m_data.characters16, m_length); }
operator AtomicString() const { return is8Bit() ? AtomicString(m_data.characters8, m_length) : AtomicString(m_data.characters16, m_length); }
+ operator StringView() const { return is8Bit() ? StringView(m_data.characters8, m_length) : StringView(m_data.characters16, m_length); }
+
union {
const LChar* characters8;
const UChar* characters16;
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/parser/HTMLSrcsetParser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698