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

Unified Diff: url/scheme_host_port.cc

Issue 2560033002: [url] Reserve space for "scheme://host/" for SchemeHostPort serialization (Closed)
Patch Set: Created 4 years 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: url/scheme_host_port.cc
diff --git a/url/scheme_host_port.cc b/url/scheme_host_port.cc
index 5b359a76aa4508d3783bec421110113482fe68e0..0fe87c50f9862c86f7d1af4bd9bec53ddb65ef8d 100644
--- a/url/scheme_host_port.cc
+++ b/url/scheme_host_port.cc
@@ -202,6 +202,9 @@ std::string SchemeHostPort::SerializeInternal(url::Parsed* parsed) const {
if (IsInvalid())
return result;
+ // Reserve enough space for the "normal" case of scheme://host/.
+ result.reserve(scheme_.size() + host_.size() + 4);
+
if (!scheme_.empty()) {
parsed->scheme = Component(0, scheme_.length());
result.append(scheme_);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698