| 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 40b0b94db853ac3594b537b74fae36ade0f6e816..b7bcb1a88a2e80f1dd8bade171e202668ac9c7c9 100644
|
| --- a/third_party/WebKit/Source/wtf/text/StringView.h
|
| +++ b/third_party/WebKit/Source/wtf/text/StringView.h
|
| @@ -37,72 +37,57 @@
|
| namespace WTF {
|
|
|
| class WTF_EXPORT StringView {
|
| - DISALLOW_NEW();
|
| -public:
|
| - StringView()
|
| - : m_offset(0)
|
| - , m_length(0)
|
| - {
|
| - }
|
| -
|
| - explicit StringView(PassRefPtr<StringImpl> impl)
|
| - : m_impl(impl)
|
| - , m_offset(0)
|
| - , m_length(m_impl->length())
|
| - {
|
| - }
|
| -
|
| - StringView(PassRefPtr<StringImpl> impl, unsigned offset, unsigned length)
|
| - : m_impl(impl)
|
| - , m_offset(offset)
|
| - , m_length(length)
|
| - {
|
| - ASSERT_WITH_SECURITY_IMPLICATION(offset + length <= m_impl->length());
|
| - }
|
| -
|
| - void narrow(unsigned offset, unsigned length)
|
| - {
|
| - ASSERT_WITH_SECURITY_IMPLICATION(offset + length <= m_length);
|
| - m_offset += offset;
|
| - m_length = length;
|
| - }
|
| -
|
| - bool isEmpty() const { return !m_length; }
|
| - unsigned length() const { return m_length; }
|
| -
|
| - bool is8Bit() const { return m_impl->is8Bit(); }
|
| -
|
| - const LChar* characters8() const
|
| - {
|
| - if (!m_impl)
|
| - return 0;
|
| - ASSERT(is8Bit());
|
| - return m_impl->characters8() + m_offset;
|
| - }
|
| -
|
| - const UChar* characters16() const
|
| - {
|
| - if (!m_impl)
|
| - return 0;
|
| - ASSERT(!is8Bit());
|
| - return m_impl->characters16() + m_offset;
|
| - }
|
| -
|
| - PassRefPtr<StringImpl> toString() const
|
| - {
|
| - if (!m_impl)
|
| - return m_impl;
|
| - if (m_impl->is8Bit())
|
| - return StringImpl::create(characters8(), m_length);
|
| - return StringImpl::create(characters16(), m_length);
|
| - }
|
| -
|
| -private:
|
| - RefPtr<StringImpl> m_impl;
|
| - unsigned m_offset;
|
| - unsigned m_length;
|
| + DISALLOW_NEW();
|
| +
|
| + public:
|
| + StringView() : m_offset(0), m_length(0) {}
|
| +
|
| + explicit StringView(PassRefPtr<StringImpl> impl)
|
| + : m_impl(impl), m_offset(0), m_length(m_impl->length()) {}
|
| +
|
| + StringView(PassRefPtr<StringImpl> impl, unsigned offset, unsigned length)
|
| + : m_impl(impl), m_offset(offset), m_length(length) {
|
| + ASSERT_WITH_SECURITY_IMPLICATION(offset + length <= m_impl->length());
|
| + }
|
| +
|
| + void narrow(unsigned offset, unsigned length) {
|
| + ASSERT_WITH_SECURITY_IMPLICATION(offset + length <= m_length);
|
| + m_offset += offset;
|
| + m_length = length;
|
| + }
|
| +
|
| + bool isEmpty() const { return !m_length; }
|
| + unsigned length() const { return m_length; }
|
| +
|
| + bool is8Bit() const { return m_impl->is8Bit(); }
|
| +
|
| + const LChar* characters8() const {
|
| + if (!m_impl)
|
| + return 0;
|
| + ASSERT(is8Bit());
|
| + return m_impl->characters8() + m_offset;
|
| + }
|
| +
|
| + const UChar* characters16() const {
|
| + if (!m_impl)
|
| + return 0;
|
| + ASSERT(!is8Bit());
|
| + return m_impl->characters16() + m_offset;
|
| + }
|
| +
|
| + PassRefPtr<StringImpl> toString() const {
|
| + if (!m_impl)
|
| + return m_impl;
|
| + if (m_impl->is8Bit())
|
| + return StringImpl::create(characters8(), m_length);
|
| + return StringImpl::create(characters16(), m_length);
|
| + }
|
| +
|
| + private:
|
| + RefPtr<StringImpl> m_impl;
|
| + unsigned m_offset;
|
| + unsigned m_length;
|
| };
|
| -
|
| }
|
|
|
| using WTF::StringView;
|
|
|