| 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 private: | 98 private: |
| 99 static int memoryConsumption(const String& string) | 99 static int memoryConsumption(const String& string) |
| 100 { | 100 { |
| 101 return string.length() * (string.is8Bit() ? sizeof(LChar) : sizeof(UChar
)); | 101 return string.length() * (string.is8Bit() ? sizeof(LChar) : sizeof(UChar
)); |
| 102 } | 102 } |
| 103 #if ENABLE(ASSERT) | 103 #if ENABLE(ASSERT) |
| 104 WTF::ThreadIdentifier m_threadId; | 104 WTF::ThreadIdentifier m_threadId; |
| 105 #endif | 105 #endif |
| 106 }; | 106 }; |
| 107 | 107 |
| 108 class WebCoreStringResource16 FINAL : public WebCoreStringResourceBase, public v
8::String::ExternalStringResource { | 108 class WebCoreStringResource16 final : public WebCoreStringResourceBase, public v
8::String::ExternalStringResource { |
| 109 public: | 109 public: |
| 110 explicit WebCoreStringResource16(const String& string) | 110 explicit WebCoreStringResource16(const String& string) |
| 111 : WebCoreStringResourceBase(string) | 111 : WebCoreStringResourceBase(string) |
| 112 { | 112 { |
| 113 ASSERT(!string.is8Bit()); | 113 ASSERT(!string.is8Bit()); |
| 114 } | 114 } |
| 115 | 115 |
| 116 explicit WebCoreStringResource16(const AtomicString& string) | 116 explicit WebCoreStringResource16(const AtomicString& string) |
| 117 : WebCoreStringResourceBase(string) | 117 : WebCoreStringResourceBase(string) |
| 118 { | 118 { |
| 119 ASSERT(!string.is8Bit()); | 119 ASSERT(!string.is8Bit()); |
| 120 } | 120 } |
| 121 | 121 |
| 122 virtual size_t length() const OVERRIDE { return m_plainString.impl()->length
(); } | 122 virtual size_t length() const override { return m_plainString.impl()->length
(); } |
| 123 virtual const uint16_t* data() const OVERRIDE | 123 virtual const uint16_t* data() const override |
| 124 { | 124 { |
| 125 return reinterpret_cast<const uint16_t*>(m_plainString.impl()->character
s16()); | 125 return reinterpret_cast<const uint16_t*>(m_plainString.impl()->character
s16()); |
| 126 } | 126 } |
| 127 }; | 127 }; |
| 128 | 128 |
| 129 class WebCoreStringResource8 FINAL : public WebCoreStringResourceBase, public v8
::String::ExternalAsciiStringResource { | 129 class WebCoreStringResource8 final : public WebCoreStringResourceBase, public v8
::String::ExternalAsciiStringResource { |
| 130 public: | 130 public: |
| 131 explicit WebCoreStringResource8(const String& string) | 131 explicit WebCoreStringResource8(const String& string) |
| 132 : WebCoreStringResourceBase(string) | 132 : WebCoreStringResourceBase(string) |
| 133 { | 133 { |
| 134 ASSERT(string.is8Bit()); | 134 ASSERT(string.is8Bit()); |
| 135 } | 135 } |
| 136 | 136 |
| 137 explicit WebCoreStringResource8(const AtomicString& string) | 137 explicit WebCoreStringResource8(const AtomicString& string) |
| 138 : WebCoreStringResourceBase(string) | 138 : WebCoreStringResourceBase(string) |
| 139 { | 139 { |
| 140 ASSERT(string.is8Bit()); | 140 ASSERT(string.is8Bit()); |
| 141 } | 141 } |
| 142 | 142 |
| 143 virtual size_t length() const OVERRIDE { return m_plainString.impl()->length
(); } | 143 virtual size_t length() const override { return m_plainString.impl()->length
(); } |
| 144 virtual const char* data() const OVERRIDE | 144 virtual const char* data() const override |
| 145 { | 145 { |
| 146 return reinterpret_cast<const char*>(m_plainString.impl()->characters8()
); | 146 return reinterpret_cast<const char*>(m_plainString.impl()->characters8()
); |
| 147 } | 147 } |
| 148 }; | 148 }; |
| 149 | 149 |
| 150 enum ExternalMode { | 150 enum ExternalMode { |
| 151 Externalize, | 151 Externalize, |
| 152 DoNotExternalize | 152 DoNotExternalize |
| 153 }; | 153 }; |
| 154 | 154 |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 } | 307 } |
| 308 | 308 |
| 309 template<> inline String V8StringResource<TreatNullAndUndefinedAsNullString>::fa
llbackString() const | 309 template<> inline String V8StringResource<TreatNullAndUndefinedAsNullString>::fa
llbackString() const |
| 310 { | 310 { |
| 311 return String(); | 311 return String(); |
| 312 } | 312 } |
| 313 | 313 |
| 314 } // namespace blink | 314 } // namespace blink |
| 315 | 315 |
| 316 #endif // V8StringResource_h | 316 #endif // V8StringResource_h |
| OLD | NEW |