| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 { | 113 { |
| 114 ASSERT(!string.is8Bit()); | 114 ASSERT(!string.is8Bit()); |
| 115 } | 115 } |
| 116 | 116 |
| 117 explicit WebCoreStringResource16(const AtomicString& string) | 117 explicit WebCoreStringResource16(const AtomicString& string) |
| 118 : WebCoreStringResourceBase(string) | 118 : WebCoreStringResourceBase(string) |
| 119 { | 119 { |
| 120 ASSERT(!string.is8Bit()); | 120 ASSERT(!string.is8Bit()); |
| 121 } | 121 } |
| 122 | 122 |
| 123 virtual size_t length() const override { return m_plainString.impl()->length
(); } | 123 size_t length() const override { return m_plainString.impl()->length(); } |
| 124 virtual const uint16_t* data() const override | 124 const uint16_t* data() const override |
| 125 { | 125 { |
| 126 return reinterpret_cast<const uint16_t*>(m_plainString.impl()->character
s16()); | 126 return reinterpret_cast<const uint16_t*>(m_plainString.impl()->character
s16()); |
| 127 } | 127 } |
| 128 }; | 128 }; |
| 129 | 129 |
| 130 class WebCoreStringResource8 final : public WebCoreStringResourceBase, public v8
::String::ExternalOneByteStringResource { | 130 class WebCoreStringResource8 final : public WebCoreStringResourceBase, public v8
::String::ExternalOneByteStringResource { |
| 131 public: | 131 public: |
| 132 explicit WebCoreStringResource8(const String& string) | 132 explicit WebCoreStringResource8(const String& string) |
| 133 : WebCoreStringResourceBase(string) | 133 : WebCoreStringResourceBase(string) |
| 134 { | 134 { |
| 135 ASSERT(string.is8Bit()); | 135 ASSERT(string.is8Bit()); |
| 136 } | 136 } |
| 137 | 137 |
| 138 explicit WebCoreStringResource8(const AtomicString& string) | 138 explicit WebCoreStringResource8(const AtomicString& string) |
| 139 : WebCoreStringResourceBase(string) | 139 : WebCoreStringResourceBase(string) |
| 140 { | 140 { |
| 141 ASSERT(string.is8Bit()); | 141 ASSERT(string.is8Bit()); |
| 142 } | 142 } |
| 143 | 143 |
| 144 virtual size_t length() const override { return m_plainString.impl()->length
(); } | 144 size_t length() const override { return m_plainString.impl()->length(); } |
| 145 virtual const char* data() const override | 145 const char* data() const override |
| 146 { | 146 { |
| 147 return reinterpret_cast<const char*>(m_plainString.impl()->characters8()
); | 147 return reinterpret_cast<const char*>(m_plainString.impl()->characters8()
); |
| 148 } | 148 } |
| 149 }; | 149 }; |
| 150 | 150 |
| 151 enum ExternalMode { | 151 enum ExternalMode { |
| 152 Externalize, | 152 Externalize, |
| 153 DoNotExternalize | 153 DoNotExternalize |
| 154 }; | 154 }; |
| 155 | 155 |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 } | 314 } |
| 315 | 315 |
| 316 template<> inline String V8StringResource<TreatNullAndUndefinedAsNullString>::fa
llbackString() const | 316 template<> inline String V8StringResource<TreatNullAndUndefinedAsNullString>::fa
llbackString() const |
| 317 { | 317 { |
| 318 return String(); | 318 return String(); |
| 319 } | 319 } |
| 320 | 320 |
| 321 } // namespace blink | 321 } // namespace blink |
| 322 | 322 |
| 323 #endif // V8StringResource_h | 323 #endif // V8StringResource_h |
| OLD | NEW |