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_); |