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

Unified Diff: url/gurl.cc

Issue 30693010: Use copy-swap idiom for GURL::operator= (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 2 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') | url/gurl_unittest.cc » ('j') | 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 559b386f5050346b027e86931e057d7e4101c43b..42edb5eab3f8866723238ab5d930c275130c609f 100644
--- a/url/gurl.cc
+++ b/url/gurl.cc
@@ -167,18 +167,8 @@ void GURL::InitializeFromCanonicalSpec() {
GURL::~GURL() {
}
-GURL& GURL::operator=(const GURL& other) {
- if (&other == this)
- return *this;
-
- spec_ = other.spec_;
- is_valid_ = other.is_valid_;
- parsed_ = other.parsed_;
- inner_url_.reset(NULL);
- if (other.inner_url_)
- inner_url_.reset(new GURL(*other.inner_url_));
- // Valid filesystem urls should always have an inner_url_.
- DCHECK(!is_valid_ || !SchemeIsFileSystem() || inner_url_);
+GURL& GURL::operator=(GURL other) {
+ Swap(&other);
return *this;
}
« no previous file with comments | « url/gurl.h ('k') | url/gurl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698