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

Side by Side 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, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/spdy/spdy_http_utils.h" 5 #include "net/spdy/spdy_http_utils.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 it = headers.find(scheme_header); 195 it = headers.find(scheme_header);
196 if (it != headers.end()) 196 if (it != headers.end())
197 scheme = it->second; 197 scheme = it->second;
198 it = headers.find(host_header); 198 it = headers.find(host_header);
199 if (it != headers.end()) 199 if (it != headers.end())
200 host_port = it->second; 200 host_port = it->second;
201 it = headers.find(path_header); 201 it = headers.find(path_header);
202 if (it != headers.end()) 202 if (it != headers.end())
203 path = it->second; 203 path = it->second;
204 204
205 std::string url = (scheme.empty() || host_port.empty() || path.empty()) 205 std::string url = scheme;
Bence 2015/03/09 19:53:46 You don't seem to be conserving behavior here: In
206 ? std::string() 206 if (!scheme.empty() && !host_port.empty() && path.empty()) {
207 : scheme + "://" + host_port + path; 207 url += "://";
208 url += host_port;
209 url += path;
210 }
208 return GURL(url); 211 return GURL(url);
209 } 212 }
210 213
211 } // namespace net 214 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698