| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "wtf/text/AtomicStringTable.h" | 5 #include "wtf/text/AtomicStringTable.h" |
| 6 | 6 |
| 7 #include "wtf/text/StringHash.h" | 7 #include "wtf/text/StringHash.h" |
| 8 #include "wtf/text/UTF8.h" | 8 #include "wtf/text/UTF8.h" |
| 9 | 9 |
| 10 namespace WTF { | 10 namespace WTF { |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 return StringImpl::empty(); | 181 return StringImpl::empty(); |
| 182 | 182 |
| 183 LCharBuffer buffer = {s, length}; | 183 LCharBuffer buffer = {s, length}; |
| 184 return addToStringTable<LCharBuffer, LCharBufferTranslator>(buffer); | 184 return addToStringTable<LCharBuffer, LCharBufferTranslator>(buffer); |
| 185 } | 185 } |
| 186 | 186 |
| 187 StringImpl* AtomicStringTable::add(StringImpl* string) { | 187 StringImpl* AtomicStringTable::add(StringImpl* string) { |
| 188 if (!string->length()) | 188 if (!string->length()) |
| 189 return StringImpl::empty(); | 189 return StringImpl::empty(); |
| 190 | 190 |
| 191 StringImpl* result = *m_table.add(string).storedValue; | 191 StringImpl* result = *m_table.insert(string).storedValue; |
| 192 | 192 |
| 193 if (!result->isAtomic()) | 193 if (!result->isAtomic()) |
| 194 result->setIsAtomic(true); | 194 result->setIsAtomic(true); |
| 195 | 195 |
| 196 DCHECK(!string->isStatic() || result->isStatic()); | 196 DCHECK(!string->isStatic() || result->isStatic()); |
| 197 return result; | 197 return result; |
| 198 } | 198 } |
| 199 | 199 |
| 200 PassRefPtr<StringImpl> AtomicStringTable::addUTF8(const char* charactersStart, | 200 PassRefPtr<StringImpl> AtomicStringTable::addUTF8(const char* charactersStart, |
| 201 const char* charactersEnd) { | 201 const char* charactersEnd) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 212 } | 212 } |
| 213 | 213 |
| 214 void AtomicStringTable::remove(StringImpl* string) { | 214 void AtomicStringTable::remove(StringImpl* string) { |
| 215 DCHECK(string->isAtomic()); | 215 DCHECK(string->isAtomic()); |
| 216 auto iterator = m_table.find(string); | 216 auto iterator = m_table.find(string); |
| 217 RELEASE_ASSERT(iterator != m_table.end()); | 217 RELEASE_ASSERT(iterator != m_table.end()); |
| 218 m_table.remove(iterator); | 218 m_table.remove(iterator); |
| 219 } | 219 } |
| 220 | 220 |
| 221 } // namespace WTF | 221 } // namespace WTF |
| OLD | NEW |