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

Unified Diff: url/url_util.cc

Issue 2641823004: [url] Reserve size in a smarter way to account for pre-allocated buffers (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « url/url_canon_stdstring.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: url/url_util.cc
diff --git a/url/url_util.cc b/url/url_util.cc
index 867754ffd1dd22c82270ea8e3862630658d09d6a..760f326c4c8b84fbd0b91c8463e543d49455c0e6 100644
--- a/url/url_util.cc
+++ b/url/url_util.cc
@@ -192,9 +192,7 @@ bool DoCanonicalize(const CHAR* spec,
CharsetConverter* charset_converter,
CanonOutput* output,
Parsed* output_parsed) {
- // Reserve enough room in the output for the input, plus some extra so that
- // we have room if we have to escape a few things without reallocating.
- output->ReserveSizeIfNeeded(spec_len + 8);
+ output->ReserveSizeIfNeeded(spec_len);
// Remove any whitespace from the middle of the relative URL if necessary.
// Possibly this will result in copying to the new buffer.
@@ -414,7 +412,7 @@ bool DoReplaceComponents(const char* spec,
// in callers below, and the code checks to see which components are being
// replaced, and with what length. If this ends up being a hot spot it should
// be changed.
- output->ReserveSizeIfNeeded(spec_len + 8);
+ output->ReserveSizeIfNeeded(spec_len);
// If we get here, then we know the scheme doesn't need to be replaced, so can
// just key off the scheme in the spec to know how to do the replacements.
« no previous file with comments | « url/url_canon_stdstring.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698