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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 private: | 104 private: |
105 static int memoryConsumption(const String& string) | 105 static int memoryConsumption(const String& string) |
106 { | 106 { |
107 return string.length() * (string.is8Bit() ? sizeof(LChar) : sizeof(UChar
)); | 107 return string.length() * (string.is8Bit() ? sizeof(LChar) : sizeof(UChar
)); |
108 } | 108 } |
109 #ifndef NDEBUG | 109 #ifndef NDEBUG |
110 WTF::ThreadIdentifier m_threadId; | 110 WTF::ThreadIdentifier m_threadId; |
111 #endif | 111 #endif |
112 }; | 112 }; |
113 | 113 |
114 class WebCoreStringResource16 : public WebCoreStringResourceBase, public v8::Str
ing::ExternalStringResource { | 114 class WebCoreStringResource16 FINAL : public WebCoreStringResourceBase, public v
8::String::ExternalStringResource { |
115 public: | 115 public: |
116 explicit WebCoreStringResource16(const String& string) | 116 explicit WebCoreStringResource16(const String& string) |
117 : WebCoreStringResourceBase(string) | 117 : WebCoreStringResourceBase(string) |
118 { | 118 { |
119 ASSERT(!string.is8Bit()); | 119 ASSERT(!string.is8Bit()); |
120 } | 120 } |
121 | 121 |
122 explicit WebCoreStringResource16(const AtomicString& string) | 122 explicit WebCoreStringResource16(const AtomicString& string) |
123 : WebCoreStringResourceBase(string) | 123 : WebCoreStringResourceBase(string) |
124 { | 124 { |
125 ASSERT(!string.is8Bit()); | 125 ASSERT(!string.is8Bit()); |
126 } | 126 } |
127 | 127 |
128 virtual size_t length() const OVERRIDE { return m_plainString.impl()->length
(); } | 128 virtual size_t length() const OVERRIDE { return m_plainString.impl()->length
(); } |
129 virtual const uint16_t* data() const OVERRIDE | 129 virtual const uint16_t* data() const OVERRIDE |
130 { | 130 { |
131 return reinterpret_cast<const uint16_t*>(m_plainString.impl()->character
s16()); | 131 return reinterpret_cast<const uint16_t*>(m_plainString.impl()->character
s16()); |
132 } | 132 } |
133 }; | 133 }; |
134 | 134 |
135 class WebCoreStringResource8 : public WebCoreStringResourceBase, public v8::Stri
ng::ExternalAsciiStringResource { | 135 class WebCoreStringResource8 FINAL : public WebCoreStringResourceBase, public v8
::String::ExternalAsciiStringResource { |
136 public: | 136 public: |
137 explicit WebCoreStringResource8(const String& string) | 137 explicit WebCoreStringResource8(const String& string) |
138 : WebCoreStringResourceBase(string) | 138 : WebCoreStringResourceBase(string) |
139 { | 139 { |
140 ASSERT(string.is8Bit()); | 140 ASSERT(string.is8Bit()); |
141 } | 141 } |
142 | 142 |
143 explicit WebCoreStringResource8(const AtomicString& string) | 143 explicit WebCoreStringResource8(const AtomicString& string) |
144 : WebCoreStringResourceBase(string) | 144 : WebCoreStringResourceBase(string) |
145 { | 145 { |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 if (m_v8Object.IsEmpty() || m_v8Object->IsNull() || m_v8Object->IsUndefined(
)) { | 248 if (m_v8Object.IsEmpty() || m_v8Object->IsNull() || m_v8Object->IsUndefined(
)) { |
249 setString(String()); | 249 setString(String()); |
250 return true; | 250 return true; |
251 } | 251 } |
252 return prepareBase(); | 252 return prepareBase(); |
253 } | 253 } |
254 | 254 |
255 } // namespace WebCore | 255 } // namespace WebCore |
256 | 256 |
257 #endif // V8StringResource_h | 257 #endif // V8StringResource_h |
OLD | NEW |