201 DeprecatedString AtomicString::deprecatedString() const |
204 DeprecatedString AtomicString::deprecatedString() const |
202 { |
205 { |
203 return m_string.deprecatedString(); |
206 return m_string.deprecatedString(); |
204 } |
207 } |
205 |
208 |
|
209 static const char *textAtomStr = "#text"; |
|
210 static const char *commentAtomStr = "#comment"; |
|
211 static const char *starAtomStr = "*"; |
|
212 |
206 DEFINE_GLOBAL(AtomicString, nullAtom) |
213 DEFINE_GLOBAL(AtomicString, nullAtom) |
207 DEFINE_GLOBAL(AtomicString, emptyAtom, "") |
214 DEFINE_GLOBAL(AtomicString, emptyAtom, "") |
208 DEFINE_GLOBAL(AtomicString, textAtom, "#text") |
215 DEFINE_GLOBAL(AtomicString, textAtom, textAtomStr) |
209 DEFINE_GLOBAL(AtomicString, commentAtom, "#comment") |
216 DEFINE_GLOBAL(AtomicString, commentAtom, commentAtomStr) |
210 DEFINE_GLOBAL(AtomicString, starAtom, "*") |
217 DEFINE_GLOBAL(AtomicString, starAtom, starAtomStr) |
211 |
218 |
212 void AtomicString::init() |
219 void AtomicString::init() |
213 { |
220 { |
214 static bool initialized; |
|
215 if (!initialized) { |
221 if (!initialized) { |
216 stringTable = new HashSet<StringImpl*>; |
222 stringTable = new HashSet<StringImpl*>; |
217 |
223 |
218 // Use placement new to initialize the globals. |
224 // Use placement new to initialize the globals. |
219 new ((void*)&nullAtom) AtomicString; |
225 new ((void*)&nullAtom) AtomicString; |
220 new ((void*)&emptyAtom) AtomicString(""); |
226 new ((void*)&emptyAtom) AtomicString(""); |
221 new ((void*)&textAtom) AtomicString("#text"); |
227 new ((void*)&textAtom) AtomicString(textAtomStr); |
222 new ((void*)&commentAtom) AtomicString("#comment"); |
228 new ((void*)&commentAtom) AtomicString(commentAtomStr); |
223 new ((void*)&starAtom) AtomicString("*"); |
229 new ((void*)&starAtom) AtomicString(starAtomStr); |
224 |
230 |
225 initialized = true; |
231 initialized = true; |
226 } |
232 } |
227 } |
233 } |
228 |
234 |
229 } |
235 void AtomicString::remove() |
|
236 { |
|
237 // Cleanup the string table array |
|
238 if( stringTable ) |
|
239 { |
|
240 stringTable->clear(); |
|
241 delete stringTable; |
|
242 stringTable = NULL; |
|
243 } |
|
244 textAtomStr = ""; |
|
245 commentAtomStr = ""; |
|
246 starAtomStr = ""; |
|
247 initialized = false; |
|
248 } |
|
249 |
|
250 } |