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

Side by Side Diff: third_party/WebKit/Source/core/dom/SpaceSplitString.cpp

Issue 2673543003: Migrate WTF::HashMap::remove() to ::erase() (Closed)
Patch Set: Created 3 years, 10 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007 David Smith (catfish.man@gmail.com) 2 * Copyright (C) 2007 David Smith (catfish.man@gmail.com)
3 * Copyright (C) 2007, 2008, 2011, 2012 Apple Inc. All rights reserved. 3 * Copyright (C) 2007, 2008, 2011, 2012 Apple Inc. All rights reserved.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 String string(inputString.getString()); 155 String string(inputString.getString());
156 string = string.foldCase(); 156 string = string.foldCase();
157 m_data = Data::create(AtomicString(string)); 157 m_data = Data::create(AtomicString(string));
158 } else { 158 } else {
159 m_data = Data::create(inputString); 159 m_data = Data::create(inputString);
160 } 160 }
161 } 161 }
162 162
163 SpaceSplitString::Data::~Data() { 163 SpaceSplitString::Data::~Data() {
164 if (!m_keyString.isNull()) 164 if (!m_keyString.isNull())
165 sharedDataMap().remove(m_keyString); 165 sharedDataMap().erase(m_keyString);
166 } 166 }
167 167
168 PassRefPtr<SpaceSplitString::Data> SpaceSplitString::Data::create( 168 PassRefPtr<SpaceSplitString::Data> SpaceSplitString::Data::create(
169 const AtomicString& string) { 169 const AtomicString& string) {
170 Data*& data = sharedDataMap().add(string, nullptr).storedValue->value; 170 Data*& data = sharedDataMap().add(string, nullptr).storedValue->value;
171 if (!data) { 171 if (!data) {
172 data = new Data(string); 172 data = new Data(string);
173 return adoptRef(data); 173 return adoptRef(data);
174 } 174 }
175 return data; 175 return data;
176 } 176 }
177 177
178 PassRefPtr<SpaceSplitString::Data> SpaceSplitString::Data::createUnique( 178 PassRefPtr<SpaceSplitString::Data> SpaceSplitString::Data::createUnique(
179 const Data& other) { 179 const Data& other) {
180 return adoptRef(new SpaceSplitString::Data(other)); 180 return adoptRef(new SpaceSplitString::Data(other));
181 } 181 }
182 182
183 SpaceSplitString::Data::Data(const AtomicString& string) : m_keyString(string) { 183 SpaceSplitString::Data::Data(const AtomicString& string) : m_keyString(string) {
184 DCHECK(!string.isNull()); 184 DCHECK(!string.isNull());
185 createVector(string); 185 createVector(string);
186 } 186 }
187 187
188 SpaceSplitString::Data::Data(const SpaceSplitString::Data& other) 188 SpaceSplitString::Data::Data(const SpaceSplitString::Data& other)
189 : RefCounted<Data>(), m_vector(other.m_vector) { 189 : RefCounted<Data>(), m_vector(other.m_vector) {
190 // Note that we don't copy m_keyString to indicate to the destructor that 190 // Note that we don't copy m_keyString to indicate to the destructor that
191 // there's nothing to be removed from the sharedDataMap(). 191 // there's nothing to be removed from the sharedDataMap().
192 } 192 }
193 193
194 } // namespace blink 194 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/ScriptedIdleTaskController.cpp ('k') | third_party/WebKit/Source/core/dom/StyleEngine.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698