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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 | 268 |
269 PassRefPtr<StringImpl> AtomicString::add(const UChar* s, unsigned length, unsign
ed existingHash) | 269 PassRefPtr<StringImpl> AtomicString::add(const UChar* s, unsigned length, unsign
ed existingHash) |
270 { | 270 { |
271 ASSERT(s); | 271 ASSERT(s); |
272 ASSERT(existingHash); | 272 ASSERT(existingHash); |
273 | 273 |
274 if (!length) | 274 if (!length) |
275 return StringImpl::empty(); | 275 return StringImpl::empty(); |
276 | 276 |
277 HashAndCharacters<UChar> buffer = { existingHash, s, length }; | 277 HashAndCharacters<UChar> buffer = { existingHash, s, length }; |
278 return addToStringTable<HashAndCharacters<UChar>, HashAndCharactersTranslato
r<UChar> >(buffer); | 278 return addToStringTable<HashAndCharacters<UChar>, HashAndCharactersTranslato
r<UChar>>(buffer); |
279 } | 279 } |
280 | 280 |
281 PassRefPtr<StringImpl> AtomicString::add(const UChar* s) | 281 PassRefPtr<StringImpl> AtomicString::add(const UChar* s) |
282 { | 282 { |
283 if (!s) | 283 if (!s) |
284 return nullptr; | 284 return nullptr; |
285 | 285 |
286 unsigned length = 0; | 286 unsigned length = 0; |
287 while (s[length] != UChar(0)) | 287 while (s[length] != UChar(0)) |
288 ++length; | 288 ++length; |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 | 405 |
406 PassRefPtr<StringImpl> AtomicString::addSlowCase(StringImpl* string) | 406 PassRefPtr<StringImpl> AtomicString::addSlowCase(StringImpl* string) |
407 { | 407 { |
408 return atomicStringTable().addStringImpl(string); | 408 return atomicStringTable().addStringImpl(string); |
409 } | 409 } |
410 | 410 |
411 template<typename CharacterType> | 411 template<typename CharacterType> |
412 static inline HashSet<StringImpl*>::iterator findString(const StringImpl* string
Impl) | 412 static inline HashSet<StringImpl*>::iterator findString(const StringImpl* string
Impl) |
413 { | 413 { |
414 HashAndCharacters<CharacterType> buffer = { stringImpl->existingHash(), stri
ngImpl->getCharacters<CharacterType>(), stringImpl->length() }; | 414 HashAndCharacters<CharacterType> buffer = { stringImpl->existingHash(), stri
ngImpl->getCharacters<CharacterType>(), stringImpl->length() }; |
415 return atomicStrings().find<HashAndCharactersTranslator<CharacterType> >(buf
fer); | 415 return atomicStrings().find<HashAndCharactersTranslator<CharacterType>>(buff
er); |
416 } | 416 } |
417 | 417 |
418 StringImpl* AtomicString::find(const StringImpl* stringImpl) | 418 StringImpl* AtomicString::find(const StringImpl* stringImpl) |
419 { | 419 { |
420 ASSERT(stringImpl); | 420 ASSERT(stringImpl); |
421 ASSERT(stringImpl->existingHash()); | 421 ASSERT(stringImpl->existingHash()); |
422 | 422 |
423 if (!stringImpl->length()) | 423 if (!stringImpl->length()) |
424 return StringImpl::empty(); | 424 return StringImpl::empty(); |
425 | 425 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 } | 507 } |
508 | 508 |
509 #ifndef NDEBUG | 509 #ifndef NDEBUG |
510 void AtomicString::show() const | 510 void AtomicString::show() const |
511 { | 511 { |
512 m_string.show(); | 512 m_string.show(); |
513 } | 513 } |
514 #endif | 514 #endif |
515 | 515 |
516 } // namespace WTF | 516 } // namespace WTF |
OLD | NEW |