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

Unified Diff: url/scheme_host_port.cc

Issue 2561363002: Add std::string constructors for Origin/SchemeHostPort to reduce copies (Closed)
Patch Set: fix content_unittests Created 4 years 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 | « url/scheme_host_port.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: url/scheme_host_port.cc
diff --git a/url/scheme_host_port.cc b/url/scheme_host_port.cc
index 0fe87c50f9862c86f7d1af4bd9bec53ddb65ef8d..6c03101e25fabb8e8ef27e5bc9a16d50d6d0c908 100644
--- a/url/scheme_host_port.cc
+++ b/url/scheme_host_port.cc
@@ -116,24 +116,24 @@ bool IsValidInput(const base::StringPiece& scheme,
SchemeHostPort::SchemeHostPort() : port_(0) {
}
-SchemeHostPort::SchemeHostPort(base::StringPiece scheme,
- base::StringPiece host,
+SchemeHostPort::SchemeHostPort(std::string scheme,
+ std::string host,
uint16_t port,
ConstructPolicy policy)
: port_(0) {
if (!IsValidInput(scheme, host, port, policy))
return;
- scheme.CopyToString(&scheme_);
- host.CopyToString(&host_);
+ scheme_ = std::move(scheme);
+ host_ = std::move(host);
port_ = port;
}
SchemeHostPort::SchemeHostPort(base::StringPiece scheme,
base::StringPiece host,
uint16_t port)
- : SchemeHostPort(scheme,
- host,
+ : SchemeHostPort(scheme.as_string(),
+ host.as_string(),
port,
ConstructPolicy::CHECK_CANONICALIZATION) {}
« no previous file with comments | « url/scheme_host_port.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698