Chromium Code Reviews| Index: url/gurl.cc |
| diff --git a/url/gurl.cc b/url/gurl.cc |
| index 7997d2230ddf96665be10b490a9bca8c0f452cb8..f4d8e56383ee97c20b939532531ae90e80a2aca2 100644 |
| --- a/url/gurl.cc |
| +++ b/url/gurl.cc |
| @@ -169,18 +169,8 @@ GURL::~GURL() { |
| } |
| GURL& GURL::operator=(const GURL& other) { |
| - if (&other == this) |
| - return *this; |
| - |
| - spec_ = other.spec_; |
| - is_valid_ = other.is_valid_; |
| - parsed_ = other.parsed_; |
| - delete inner_url_; |
| - inner_url_ = NULL; |
| - if (other.inner_url_) |
| - inner_url_ = new GURL(*other.inner_url_); |
| - // Valid filesystem urls should always have an inner_url_. |
| - DCHECK(!is_valid_ || !SchemeIsFileSystem() || inner_url_); |
| + GURL copy(other); |
|
cjhopman
2013/10/22 17:14:01
This is less subtle than taking the thing by value
akalin
2013/10/22 17:56:41
http://gotw.ca/gotw/059.htm uses your way so I'm i
Jeffrey Yasskin
2013/10/22 18:02:54
Taking GURL by value saves a copy when the argumen
cjhopman
2013/10/22 19:03:44
Done.
|
| + Swap(©); |
| return *this; |
| } |