Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(532)

Side by Side Diff: third_party/WebKit/Source/wtf/text/AtomicStringTable.cpp

Issue 2654033007: Migrate WTF::HashSet::add() to ::insert() [part 2 of N] (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/wtf/VectorTest.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/wtf/VectorTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698