OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2013 Apple Inc. All rights reserv
ed. | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2013 Apple Inc. All rights reserv
ed. |
3 * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com> | 3 * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com> |
4 * Copyright (C) 2012 Google Inc. All rights reserved. | 4 * Copyright (C) 2012 Google Inc. All rights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 return result; | 390 return result; |
391 } | 391 } |
392 | 392 |
393 template<typename CharacterType> | 393 template<typename CharacterType> |
394 static inline HashSet<StringImpl*>::iterator findString(const StringImpl* string
Impl) | 394 static inline HashSet<StringImpl*>::iterator findString(const StringImpl* string
Impl) |
395 { | 395 { |
396 HashAndCharacters<CharacterType> buffer = { stringImpl->existingHash(), stri
ngImpl->getCharacters<CharacterType>(), stringImpl->length() }; | 396 HashAndCharacters<CharacterType> buffer = { stringImpl->existingHash(), stri
ngImpl->getCharacters<CharacterType>(), stringImpl->length() }; |
397 return stringTable().find<HashAndCharactersTranslator<CharacterType> >(buffe
r); | 397 return stringTable().find<HashAndCharactersTranslator<CharacterType> >(buffe
r); |
398 } | 398 } |
399 | 399 |
400 AtomicStringImpl* AtomicString::find(const StringImpl* stringImpl) | 400 StringImpl* AtomicString::find(const StringImpl* stringImpl) |
401 { | 401 { |
402 ASSERT(stringImpl); | 402 ASSERT(stringImpl); |
403 ASSERT(stringImpl->existingHash()); | 403 ASSERT(stringImpl->existingHash()); |
404 | 404 |
405 if (!stringImpl->length()) | 405 if (!stringImpl->length()) |
406 return static_cast<AtomicStringImpl*>(StringImpl::empty()); | 406 return StringImpl::empty(); |
407 | 407 |
408 HashSet<StringImpl*>::iterator iterator; | 408 HashSet<StringImpl*>::iterator iterator; |
409 if (stringImpl->is8Bit()) | 409 if (stringImpl->is8Bit()) |
410 iterator = findString<LChar>(stringImpl); | 410 iterator = findString<LChar>(stringImpl); |
411 else | 411 else |
412 iterator = findString<UChar>(stringImpl); | 412 iterator = findString<UChar>(stringImpl); |
413 if (iterator == stringTable().end()) | 413 if (iterator == stringTable().end()) |
414 return 0; | 414 return 0; |
415 return static_cast<AtomicStringImpl*>(*iterator); | 415 return *iterator; |
416 } | 416 } |
417 | 417 |
418 void AtomicString::remove(StringImpl* r) | 418 void AtomicString::remove(StringImpl* r) |
419 { | 419 { |
420 HashSet<StringImpl*>::iterator iterator; | 420 HashSet<StringImpl*>::iterator iterator; |
421 if (r->is8Bit()) | 421 if (r->is8Bit()) |
422 iterator = findString<LChar>(r); | 422 iterator = findString<LChar>(r); |
423 else | 423 else |
424 iterator = findString<UChar>(r); | 424 iterator = findString<UChar>(r); |
425 RELEASE_ASSERT(iterator != stringTable().end()); | 425 RELEASE_ASSERT(iterator != stringTable().end()); |
(...skipping 27 matching lines...) Expand all Loading... |
453 } | 453 } |
454 | 454 |
455 #ifndef NDEBUG | 455 #ifndef NDEBUG |
456 void AtomicString::show() const | 456 void AtomicString::show() const |
457 { | 457 { |
458 m_string.show(); | 458 m_string.show(); |
459 } | 459 } |
460 #endif | 460 #endif |
461 | 461 |
462 } // namespace WTF | 462 } // namespace WTF |
OLD | NEW |