Commit 8b5c3702 authored by csharrison's avatar csharrison Committed by Commit bot

[url] Reserve space for "scheme://host/" for SchemeHostPort serialization

BUG=348655

Review-Url: https://codereview.chromium.org/2560033002
Cr-Commit-Position: refs/heads/master@{#437523}
parent 1289bbe7
...@@ -202,6 +202,9 @@ std::string SchemeHostPort::SerializeInternal(url::Parsed* parsed) const { ...@@ -202,6 +202,9 @@ std::string SchemeHostPort::SerializeInternal(url::Parsed* parsed) const {
if (IsInvalid()) if (IsInvalid())
return result; return result;
// Reserve enough space for the "normal" case of scheme://host/.
result.reserve(scheme_.size() + host_.size() + 4);
if (!scheme_.empty()) { if (!scheme_.empty()) {
parsed->scheme = Component(0, scheme_.length()); parsed->scheme = Component(0, scheme_.length());
result.append(scheme_); result.append(scheme_);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment