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 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 return result; | 397 return result; |
398 } | 398 } |
399 | 399 |
400 template<typename CharacterType> | 400 template<typename CharacterType> |
401 static inline HashSet<StringImpl*>::iterator findString(const StringImpl* string
Impl) | 401 static inline HashSet<StringImpl*>::iterator findString(const StringImpl* string
Impl) |
402 { | 402 { |
403 HashAndCharacters<CharacterType> buffer = { stringImpl->existingHash(), stri
ngImpl->getCharacters<CharacterType>(), stringImpl->length() }; | 403 HashAndCharacters<CharacterType> buffer = { stringImpl->existingHash(), stri
ngImpl->getCharacters<CharacterType>(), stringImpl->length() }; |
404 return stringTable().find<HashAndCharactersTranslator<CharacterType> >(buffe
r); | 404 return stringTable().find<HashAndCharactersTranslator<CharacterType> >(buffe
r); |
405 } | 405 } |
406 | 406 |
407 AtomicStringImpl* AtomicString::find(const StringImpl* stringImpl) | 407 StringImpl* AtomicString::find(const StringImpl* stringImpl) |
408 { | 408 { |
409 ASSERT(stringImpl); | 409 ASSERT(stringImpl); |
410 ASSERT(stringImpl->existingHash()); | 410 ASSERT(stringImpl->existingHash()); |
411 | 411 |
412 if (!stringImpl->length()) | 412 if (!stringImpl->length()) |
413 return static_cast<AtomicStringImpl*>(StringImpl::empty()); | 413 return StringImpl::empty(); |
414 | 414 |
415 HashSet<StringImpl*>::iterator iterator; | 415 HashSet<StringImpl*>::iterator iterator; |
416 if (stringImpl->is8Bit()) | 416 if (stringImpl->is8Bit()) |
417 iterator = findString<LChar>(stringImpl); | 417 iterator = findString<LChar>(stringImpl); |
418 else | 418 else |
419 iterator = findString<UChar>(stringImpl); | 419 iterator = findString<UChar>(stringImpl); |
420 if (iterator == stringTable().end()) | 420 if (iterator == stringTable().end()) |
421 return 0; | 421 return 0; |
422 return static_cast<AtomicStringImpl*>(*iterator); | 422 return *iterator; |
423 } | 423 } |
424 | 424 |
425 void AtomicString::remove(StringImpl* r) | 425 void AtomicString::remove(StringImpl* r) |
426 { | 426 { |
427 HashSet<StringImpl*>::iterator iterator; | 427 HashSet<StringImpl*>::iterator iterator; |
428 if (r->is8Bit()) | 428 if (r->is8Bit()) |
429 iterator = findString<LChar>(r); | 429 iterator = findString<LChar>(r); |
430 else | 430 else |
431 iterator = findString<UChar>(r); | 431 iterator = findString<UChar>(r); |
432 RELEASE_ASSERT(iterator != stringTable().end()); | 432 RELEASE_ASSERT(iterator != stringTable().end()); |
(...skipping 27 matching lines...) Expand all Loading... |
460 } | 460 } |
461 | 461 |
462 #ifndef NDEBUG | 462 #ifndef NDEBUG |
463 void AtomicString::show() const | 463 void AtomicString::show() const |
464 { | 464 { |
465 m_string.show(); | 465 m_string.show(); |
466 } | 466 } |
467 #endif | 467 #endif |
468 | 468 |
469 } // namespace WTF | 469 } // namespace WTF |
OLD | NEW |