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

Side by Side Diff: third_party/WebKit/Source/core/html/FormData.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 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 UseCounter::FormDataAppendNull); 110 UseCounter::FormDataAppendNull);
111 } 111 }
112 append(name, blob, filename); 112 append(name, blob, filename);
113 } 113 }
114 114
115 void FormData::deleteEntry(const String& name) { 115 void FormData::deleteEntry(const String& name) {
116 const CString encodedName = encodeAndNormalize(name); 116 const CString encodedName = encodeAndNormalize(name);
117 size_t i = 0; 117 size_t i = 0;
118 while (i < m_entries.size()) { 118 while (i < m_entries.size()) {
119 if (m_entries[i]->name() == encodedName) { 119 if (m_entries[i]->name() == encodedName) {
120 m_entries.remove(i); 120 m_entries.erase(i);
121 } else { 121 } else {
122 ++i; 122 ++i;
123 } 123 }
124 } 124 }
125 } 125 }
126 126
127 void FormData::get(const String& name, FormDataEntryValue& result) { 127 void FormData::get(const String& name, FormDataEntryValue& result) {
128 const CString encodedName = encodeAndNormalize(name); 128 const CString encodedName = encodeAndNormalize(name);
129 for (const auto& entry : entries()) { 129 for (const auto& entry : entries()) {
130 if (entry->name() == encodedName) { 130 if (entry->name() == encodedName) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 177
178 void FormData::setEntry(const Entry* entry) { 178 void FormData::setEntry(const Entry* entry) {
179 DCHECK(entry); 179 DCHECK(entry);
180 const CString encodedName = entry->name(); 180 const CString encodedName = entry->name();
181 bool found = false; 181 bool found = false;
182 size_t i = 0; 182 size_t i = 0;
183 while (i < m_entries.size()) { 183 while (i < m_entries.size()) {
184 if (m_entries[i]->name() != encodedName) { 184 if (m_entries[i]->name() != encodedName) {
185 ++i; 185 ++i;
186 } else if (found) { 186 } else if (found) {
187 m_entries.remove(i); 187 m_entries.erase(i);
188 } else { 188 } else {
189 found = true; 189 found = true;
190 m_entries[i] = entry; 190 m_entries[i] = entry;
191 ++i; 191 ++i;
192 } 192 }
193 } 193 }
194 if (!found) 194 if (!found)
195 m_entries.push_back(entry); 195 m_entries.push_back(entry);
196 } 196 }
197 197
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 return file->clone(filename()); 328 return file->clone(filename());
329 } 329 }
330 330
331 String filename = m_filename; 331 String filename = m_filename;
332 if (filename.isNull()) 332 if (filename.isNull())
333 filename = "blob"; 333 filename = "blob";
334 return File::create(filename, currentTimeMS(), blob()->blobDataHandle()); 334 return File::create(filename, currentTimeMS(), blob()->blobDataHandle());
335 } 335 }
336 336
337 } // namespace blink 337 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/events/GenericEventQueue.cpp ('k') | third_party/WebKit/Source/core/html/HTMLMediaElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698