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

Unified Diff: net/spdy/spdy_framer.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
« no previous file with comments | « no previous file | net/spdy/spdy_http_utils.cc » ('j') | net/spdy/spdy_http_utils.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/spdy_framer.cc
diff --git a/net/spdy/spdy_framer.cc b/net/spdy/spdy_framer.cc
index a02cb2e30ece9b31838a60eced37929a2a33592d..d8023491882df2d5150b347ea163cd2b8b9083f5 100644
--- a/net/spdy/spdy_framer.cc
+++ b/net/spdy/spdy_framer.cc
@@ -1339,15 +1339,11 @@ void SpdyFramer::WriteHeaderBlockToZ(const SpdyHeaderBlock* headers,
// is currently last (and so doesn't have a trailing semicolon) won't
// match if it's later in a non-final position. The same is true of
// the first cookie.
- if (i == 0 && cookie_values.size() == 1) {
- cookie = cookie_values[i].as_string();
- } else if (i == 0) {
- cookie = cookie_values[i].as_string() + ";";
- } else if (i < cookie_values.size() - 1) {
- cookie = " " + cookie_values[i].as_string() + ";";
- } else {
- cookie = " " + cookie_values[i].as_string();
- }
+ if (i > 0)
+ cookie.append(" ");
+ cookie.append(cookie_values[i].as_string());
+ if (i < cookie_values.size() - 1)
+ cookie.append(";");
mmenke 2015/03/09 20:21:58 Isn't this the same as: if (i > 0) cookie.appen
WriteZ(cookie, kZCookieData, z);
}
} else if (it->first == "accept" ||
« no previous file with comments | « no previous file | net/spdy/spdy_http_utils.cc » ('j') | net/spdy/spdy_http_utils.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698