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

Unified Diff: url/gurl.cc

Issue 1360533002: Cleanup: Initialize GURL by moving std::string (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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
« url/gurl.h ('K') | « 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 c22236f89e533129d935f22f5f714b2109125fea..ca46798831fcc0390c28555e805c6a6ffc5c496a 100644
--- a/url/gurl.cc
+++ b/url/gurl.cc
@@ -98,10 +98,21 @@ GURL::GURL(const char* canonical_spec,
InitializeFromCanonicalSpec();
}
-GURL::GURL(std::string canonical_spec, const url::Parsed& parsed, bool is_valid)
- : is_valid_(is_valid),
+GURL::GURL(const std::string& canonical_spec,
+ const url::Parsed& parsed,
+ bool is_valid)
+ : spec_(canonical_spec),
+ is_valid_(is_valid),
+ parsed_(parsed) {
+ InitializeFromCanonicalSpec();
+}
+
+GURL::GURL(std::string&& canonical_spec,
+ const url::Parsed& parsed,
+ bool is_valid) noexcept
+ : spec_(std::move(canonical_spec)),
danakj 2016/04/29 02:17:54 Doing this instead of swap is cool.
ki.stfu 2016/05/25 16:53:33 I'm glad to make you happy! :)
+ is_valid_(is_valid),
parsed_(parsed) {
- spec_.swap(canonical_spec);
InitializeFromCanonicalSpec();
}
« url/gurl.h ('K') | « url/gurl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698