| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 data.m_atomicStringTableDestructor = AtomicStringTable::destroy; | 45 data.m_atomicStringTableDestructor = AtomicStringTable::destroy; |
| 46 data.m_atomicStringTable->addStaticStrings(); | 46 data.m_atomicStringTable->addStaticStrings(); |
| 47 return data.m_atomicStringTable; | 47 return data.m_atomicStringTable; |
| 48 } | 48 } |
| 49 | 49 |
| 50 StringImpl* addStringImpl(StringImpl* string) | 50 StringImpl* addStringImpl(StringImpl* string) |
| 51 { | 51 { |
| 52 if (!string->length()) | 52 if (!string->length()) |
| 53 return StringImpl::empty(); | 53 return StringImpl::empty(); |
| 54 | 54 |
| 55 StringImpl* result = *m_table.add(string).iterator; | 55 StringImpl* result = *m_table.add(string).storedValue; |
| 56 | 56 |
| 57 if (!result->isAtomic()) | 57 if (!result->isAtomic()) |
| 58 result->setIsAtomic(true); | 58 result->setIsAtomic(true); |
| 59 | 59 |
| 60 ASSERT(!string->isStatic() || result->isStatic()); | 60 ASSERT(!string->isStatic() || result->isStatic()); |
| 61 return result; | 61 return result; |
| 62 } | 62 } |
| 63 | 63 |
| 64 HashSet<StringImpl*>& table() | 64 HashSet<StringImpl*>& table() |
| 65 { | 65 { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 return atomicStringTable().table(); | 110 return atomicStringTable().table(); |
| 111 } | 111 } |
| 112 | 112 |
| 113 template<typename T, typename HashTranslator> | 113 template<typename T, typename HashTranslator> |
| 114 static inline PassRefPtr<StringImpl> addToStringTable(const T& value) | 114 static inline PassRefPtr<StringImpl> addToStringTable(const T& value) |
| 115 { | 115 { |
| 116 HashSet<StringImpl*>::AddResult addResult = atomicStrings().add<HashTranslat
or>(value); | 116 HashSet<StringImpl*>::AddResult addResult = atomicStrings().add<HashTranslat
or>(value); |
| 117 | 117 |
| 118 // If the string is newly-translated, then we need to adopt it. | 118 // If the string is newly-translated, then we need to adopt it. |
| 119 // The boolean in the pair tells us if that is so. | 119 // The boolean in the pair tells us if that is so. |
| 120 return addResult.isNewEntry ? adoptRef(*addResult.iterator) : *addResult.ite
rator; | 120 return addResult.isNewEntry ? adoptRef(*addResult.storedValue) : *addResult.
storedValue; |
| 121 } | 121 } |
| 122 | 122 |
| 123 struct CStringTranslator { | 123 struct CStringTranslator { |
| 124 static unsigned hash(const LChar* c) | 124 static unsigned hash(const LChar* c) |
| 125 { | 125 { |
| 126 return StringHasher::computeHashAndMaskTop8Bits(c); | 126 return StringHasher::computeHashAndMaskTop8Bits(c); |
| 127 } | 127 } |
| 128 | 128 |
| 129 static inline bool equal(StringImpl* r, const LChar* s) | 129 static inline bool equal(StringImpl* r, const LChar* s) |
| 130 { | 130 { |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 } | 526 } |
| 527 | 527 |
| 528 #ifndef NDEBUG | 528 #ifndef NDEBUG |
| 529 void AtomicString::show() const | 529 void AtomicString::show() const |
| 530 { | 530 { |
| 531 m_string.show(); | 531 m_string.show(); |
| 532 } | 532 } |
| 533 #endif | 533 #endif |
| 534 | 534 |
| 535 } // namespace WTF | 535 } // namespace WTF |
| OLD | NEW |