| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef WTF_StringView_h | 5 #ifndef WTF_StringView_h |
| 6 #define WTF_StringView_h | 6 #define WTF_StringView_h |
| 7 | 7 |
| 8 #include "wtf/Allocator.h" | 8 #include "wtf/Allocator.h" |
| 9 #if DCHECK_IS_ON() | 9 #if DCHECK_IS_ON() |
| 10 #include "wtf/RefPtr.h" | 10 #include "wtf/RefPtr.h" |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 | 107 |
| 108 const UChar* characters16() const | 108 const UChar* characters16() const |
| 109 { | 109 { |
| 110 ASSERT(!is8Bit()); | 110 ASSERT(!is8Bit()); |
| 111 return m_data.characters16; | 111 return m_data.characters16; |
| 112 } | 112 } |
| 113 | 113 |
| 114 const void* bytes() const { return m_data.bytes; } | 114 const void* bytes() const { return m_data.bytes; } |
| 115 | 115 |
| 116 String toString() const; | 116 String toString() const; |
| 117 AtomicString toAtomicString() const; |
| 117 | 118 |
| 118 private: | 119 private: |
| 119 void set(StringImpl&, unsigned offset, unsigned length); | 120 void set(StringImpl&, unsigned offset, unsigned length); |
| 120 | 121 |
| 121 #if DCHECK_IS_ON() | 122 #if DCHECK_IS_ON() |
| 122 RefPtr<StringImpl> m_impl; | 123 RefPtr<StringImpl> m_impl; |
| 123 #endif | 124 #endif |
| 124 union DataUnion { | 125 union DataUnion { |
| 125 const LChar* characters8; | 126 const LChar* characters8; |
| 126 const UChar* characters16; | 127 const UChar* characters16; |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 inline bool operator!=(const StringView& a, const StringView& b) | 203 inline bool operator!=(const StringView& a, const StringView& b) |
| 203 { | 204 { |
| 204 return !(a == b); | 205 return !(a == b); |
| 205 } | 206 } |
| 206 | 207 |
| 207 } // namespace WTF | 208 } // namespace WTF |
| 208 | 209 |
| 209 using WTF::StringView; | 210 using WTF::StringView; |
| 210 | 211 |
| 211 #endif | 212 #endif |
| OLD | NEW |