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

Side by Side Diff: Source/web/WebSearchableFormData.cpp

Issue 1338193002: Reduce allocation size of FormData::m_entries. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/html/FormDataTest.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 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 HTMLFormControlElement& control = toHTMLFormControlElement(*item); 209 HTMLFormControlElement& control = toHTMLFormControlElement(*item);
210 if (control.isDisabledFormControl() || control.name().isNull()) 210 if (control.isDisabledFormControl() || control.name().isNull())
211 continue; 211 continue;
212 212
213 FormData* formData = FormData::create(encoding); 213 FormData* formData = FormData::create(encoding);
214 control.appendToFormData(*formData, false); 214 control.appendToFormData(*formData, false);
215 215
216 for (const auto& entry : formData->entries()) { 216 for (const auto& entry : formData->entries()) {
217 if (!encodedString->isEmpty()) 217 if (!encodedString->isEmpty())
218 encodedString->append('&'); 218 encodedString->append('&');
219 FormDataEncoder::encodeStringAsFormData(*encodedString, entry.key()) ; 219 FormDataEncoder::encodeStringAsFormData(*encodedString, entry->key() );
220 encodedString->append('='); 220 encodedString->append('=');
221 if (&control == textElement) { 221 if (&control == textElement) {
222 encodedString->append("{searchTerms}", 13); 222 encodedString->append("{searchTerms}", 13);
223 isElementFound = true; 223 isElementFound = true;
224 } else { 224 } else {
225 FormDataEncoder::encodeStringAsFormData(*encodedString, entry.da ta()); 225 FormDataEncoder::encodeStringAsFormData(*encodedString, entry->d ata());
226 } 226 }
227 } 227 }
228 } 228 }
229 return isElementFound; 229 return isElementFound;
230 } 230 }
231 231
232 } // namespace 232 } // namespace
233 233
234 WebSearchableFormData::WebSearchableFormData(const WebFormElement& form, const W ebInputElement& selectedInputElement) 234 WebSearchableFormData::WebSearchableFormData(const WebFormElement& form, const W ebInputElement& selectedInputElement)
235 { 235 {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 281
282 String action(formElement->action()); 282 String action(formElement->action());
283 KURL url(formElement->document().completeURL(action.isNull() ? "" : action)) ; 283 KURL url(formElement->document().completeURL(action.isNull() ? "" : action)) ;
284 RefPtr<EncodedFormData> formData = EncodedFormData::create(encodedString); 284 RefPtr<EncodedFormData> formData = EncodedFormData::create(encodedString);
285 url.setQuery(formData->flattenToString()); 285 url.setQuery(formData->flattenToString());
286 m_url = url; 286 m_url = url;
287 m_encoding = String(encoding.name()); 287 m_encoding = String(encoding.name());
288 } 288 }
289 289
290 } // namespace blink 290 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/html/FormDataTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698