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

Unified Diff: net/spdy/spdy_http_utils.cc

Issue 965773002: Optimize chained string concatenation in SPDY code. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
Index: net/spdy/spdy_http_utils.cc
diff --git a/net/spdy/spdy_http_utils.cc b/net/spdy/spdy_http_utils.cc
index c604880473c7c41666bf79e5b8a87e52033ceaf1..cfb24371d3850d0248100df4fb75af579fd102ea 100644
--- a/net/spdy/spdy_http_utils.cc
+++ b/net/spdy/spdy_http_utils.cc
@@ -202,9 +202,12 @@ GURL GetUrlFromHeaderBlock(const SpdyHeaderBlock& headers,
if (it != headers.end())
path = it->second;
- std::string url = (scheme.empty() || host_port.empty() || path.empty())
- ? std::string()
- : scheme + "://" + host_port + path;
+ std::string url = scheme;
Bence 2015/03/09 19:53:46 You don't seem to be conserving behavior here: In
+ if (!scheme.empty() && !host_port.empty() && path.empty()) {
+ url += "://";
+ url += host_port;
+ url += path;
+ }
return GURL(url);
}

Powered by Google App Engine
This is Rietveld 408576698