Index: third_party/WebKit/Source/wtf/text/StringView.h |
diff --git a/third_party/WebKit/Source/wtf/text/StringView.h b/third_party/WebKit/Source/wtf/text/StringView.h |
index b595bc980131b5f6f751edbe1a0b01fd9d0d8d93..94b33fd33eb6140b51bf2545de84af6f69e790a2 100644 |
--- a/third_party/WebKit/Source/wtf/text/StringView.h |
+++ b/third_party/WebKit/Source/wtf/text/StringView.h |
@@ -70,6 +70,14 @@ public: |
StringView(const UChar* chars); |
StringView(const UChar* chars, unsigned length); |
+ // From a byte pointer. |
+ StringView(const void* bytes, unsigned length, bool is8Bit) |
+ : m_length(length) |
+ , m_is8Bit(is8Bit) |
+ { |
+ m_data.bytes = bytes; |
+ } |
+ |
#if DCHECK_IS_ON() |
~StringView(); |
#endif |
@@ -83,6 +91,14 @@ public: |
void clear(); |
+ UChar operator[](unsigned i) const |
+ { |
+ SECURITY_DCHECK(i < length()); |
+ if (is8Bit()) |
+ return characters8()[i]; |
+ return characters16()[i]; |
+ } |
+ |
const LChar* characters8() const |
{ |
ASSERT(is8Bit()); |
@@ -95,6 +111,8 @@ public: |
return m_data.characters16; |
} |
+ const void* bytes() const { return m_data.bytes; } |
+ |
String toString() const; |
private: |
@@ -169,6 +187,8 @@ inline void StringView::set(StringImpl& impl, unsigned offset, unsigned length) |
m_data.characters16 = impl.characters16() + offset; |
} |
+WTF_EXPORT bool equalIgnoringASCIICase(const StringView& a, const StringView& b); |
+ |
// TODO(esprehn): Can't make this an overload of WTF::equal since that makes |
// calls to equal() that pass literal strings ambiguous. Figure out if we can |
// replace all the callers with equalStringView and then rename it to equal(). |