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

Unified Diff: url/gurl.cc

Issue 1568073002: Reduce string copies in GURL creation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 | « url/gurl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: url/gurl.cc
diff --git a/url/gurl.cc b/url/gurl.cc
index b75bb4fd35528bedeaa06f35d222da4ed5968c2c..db8b277da98c839b2978c9b6279bb399d1e55c97 100644
--- a/url/gurl.cc
+++ b/url/gurl.cc
@@ -78,16 +78,16 @@ GURL::GURL(const GURL& other)
DCHECK(!is_valid_ || !SchemeIsFileSystem() || inner_url_);
}
-GURL::GURL(const std::string& url_string) {
+GURL::GURL(base::StringPiece url_string) {
InitCanonical(url_string, true);
}
-GURL::GURL(const base::string16& url_string) {
+GURL::GURL(base::StringPiece16 url_string) {
InitCanonical(url_string, true);
}
GURL::GURL(const std::string& url_string, RetainWhiteSpaceSelector) {
- InitCanonical(url_string, false);
+ InitCanonical(base::StringPiece(url_string), false);
}
GURL::GURL(const char* canonical_spec,
@@ -108,7 +108,8 @@ GURL::GURL(std::string canonical_spec, const url::Parsed& parsed, bool is_valid)
}
template<typename STR>
-void GURL::InitCanonical(const STR& input_spec, bool trim_path_end) {
+void GURL::InitCanonical(base::BasicStringPiece<STR> input_spec,
+ bool trim_path_end) {
// Reserve enough room in the output for the input, plus some extra so that
// we have room if we have to escape a few things without reallocating.
spec_.reserve(input_spec.size() + 32);
« no previous file with comments | « url/gurl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698