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

Unified Diff: net/http/http_request_headers.cc

Issue 14315009: Remove a few un-necessary string copies in net/ (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 8 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_request_headers.cc
diff --git a/net/http/http_request_headers.cc b/net/http/http_request_headers.cc
index 841d4df133fdaa78c94b7d0341e1ccadd7d114e8..298c5e4daaf9bb9e7d23fd61f0d1f5901aebdf5e 100644
--- a/net/http/http_request_headers.cc
+++ b/net/http/http_request_headers.cc
@@ -85,16 +85,16 @@ void HttpRequestHeaders::SetHeader(const base::StringPiece& key,
const base::StringPiece& value) {
HeaderVector::iterator it = FindHeader(key);
if (it != headers_.end())
- it->value = value.as_string();
+ it->value.assign(value.data(), value.size());
else
- headers_.push_back(HeaderKeyValuePair(key.as_string(), value.as_string()));
+ headers_.push_back(HeaderKeyValuePair(key, value));
}
void HttpRequestHeaders::SetHeaderIfMissing(const base::StringPiece& key,
const base::StringPiece& value) {
HeaderVector::iterator it = FindHeader(key);
if (it == headers_.end())
- headers_.push_back(HeaderKeyValuePair(key.as_string(), value.as_string()));
+ headers_.push_back(HeaderKeyValuePair(key, value));
}
void HttpRequestHeaders::RemoveHeader(const base::StringPiece& key) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698