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

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

Issue 2776203002: Migrate WTF::Vector::remove() to ::erase() (Closed)
Patch Set: rebase, repatch VectorTest Created 3 years, 8 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 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "core/dom/URLSearchParams.h" 5 #include "core/dom/URLSearchParams.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include "core/dom/DOMURL.h" 8 #include "core/dom/DOMURL.h"
9 #include "platform/network/FormDataEncoder.h" 9 #include "platform/network/FormDataEncoder.h"
10 #include "platform/weborigin/KURL.h" 10 #include "platform/weborigin/KURL.h"
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 } 159 }
160 160
161 void URLSearchParams::append(const String& name, const String& value) { 161 void URLSearchParams::append(const String& name, const String& value) {
162 appendWithoutUpdate(name, value); 162 appendWithoutUpdate(name, value);
163 runUpdateSteps(); 163 runUpdateSteps();
164 } 164 }
165 165
166 void URLSearchParams::deleteAllWithName(const String& name) { 166 void URLSearchParams::deleteAllWithName(const String& name) {
167 for (size_t i = 0; i < m_params.size();) { 167 for (size_t i = 0; i < m_params.size();) {
168 if (m_params[i].first == name) 168 if (m_params[i].first == name)
169 m_params.remove(i); 169 m_params.erase(i);
170 else 170 else
171 i++; 171 i++;
172 } 172 }
173 runUpdateSteps(); 173 runUpdateSteps();
174 } 174 }
175 175
176 String URLSearchParams::get(const String& name) const { 176 String URLSearchParams::get(const String& name) const {
177 for (const auto& param : m_params) { 177 for (const auto& param : m_params) {
178 if (param.first == name) 178 if (param.first == name)
179 return param.second; 179 return param.second;
(...skipping 22 matching lines...) Expand all
202 bool foundMatch = false; 202 bool foundMatch = false;
203 for (size_t i = 0; i < m_params.size();) { 203 for (size_t i = 0; i < m_params.size();) {
204 // If there are any name-value whose name is 'name', set 204 // If there are any name-value whose name is 'name', set
205 // the value of the first such name-value pair to 'value' 205 // the value of the first such name-value pair to 'value'
206 // and remove the others. 206 // and remove the others.
207 if (m_params[i].first == name) { 207 if (m_params[i].first == name) {
208 if (!foundMatch) { 208 if (!foundMatch) {
209 m_params[i++].second = value; 209 m_params[i++].second = value;
210 foundMatch = true; 210 foundMatch = true;
211 } else { 211 } else {
212 m_params.remove(i); 212 m_params.erase(i);
213 } 213 }
214 } else { 214 } else {
215 i++; 215 i++;
216 } 216 }
217 } 217 }
218 // Otherwise, append a new name-value pair to the list. 218 // Otherwise, append a new name-value pair to the list.
219 if (!foundMatch) 219 if (!foundMatch)
220 append(name, value); 220 append(name, value);
221 else 221 else
222 runUpdateSteps(); 222 runUpdateSteps();
(...skipping 12 matching lines...) Expand all
235 return EncodedFormData::create(encodedData.data(), encodedData.size()); 235 return EncodedFormData::create(encodedData.data(), encodedData.size());
236 } 236 }
237 237
238 PairIterable<String, String>::IterationSource* URLSearchParams::startIteration( 238 PairIterable<String, String>::IterationSource* URLSearchParams::startIteration(
239 ScriptState*, 239 ScriptState*,
240 ExceptionState&) { 240 ExceptionState&) {
241 return new URLSearchParamsIterationSource(m_params); 241 return new URLSearchParamsIterationSource(m_params);
242 } 242 }
243 243
244 } // namespace blink 244 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698