Chromium Code Reviews| Index: Source/wtf/text/StringView.h |
| diff --git a/Source/wtf/text/StringView.h b/Source/wtf/text/StringView.h |
| index 40d1866cf1dc4c277cd3fe51ebafe7358251efae..dc92fa346564c06b3dc7901ad4ab7fa211222e83 100644 |
| --- a/Source/wtf/text/StringView.h |
| +++ b/Source/wtf/text/StringView.h |
| @@ -86,6 +86,15 @@ public: |
| 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); |
|
abarth-chromium
2013/09/20 21:13:34
We should probably add an optimization when m_offs
|
| + } |
| + |
| private: |
| RefPtr<StringImpl> m_impl; |
| unsigned m_offset; |