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

Side by Side Diff: url/gurl.h

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, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | url/gurl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef URL_GURL_H_ 5 #ifndef URL_GURL_H_
6 #define URL_GURL_H_ 6 #define URL_GURL_H_
7 7
8 #include <iosfwd> 8 #include <iosfwd>
9 #include <string> 9 #include <string>
10 10
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 // from WebURL without copying the string. When we call this constructor 46 // from WebURL without copying the string. When we call this constructor
47 // we pass in a temporary std::string, which lets the compiler skip the 47 // we pass in a temporary std::string, which lets the compiler skip the
48 // copy and just move the std::string into the function argument. In the 48 // copy and just move the std::string into the function argument. In the
49 // implementation, we use swap to move the data into the GURL itself, 49 // implementation, we use swap to move the data into the GURL itself,
50 // which means we end up with zero copies. 50 // which means we end up with zero copies.
51 GURL(std::string canonical_spec, 51 GURL(std::string canonical_spec,
52 const url_parse::Parsed& parsed, bool is_valid); 52 const url_parse::Parsed& parsed, bool is_valid);
53 53
54 ~GURL(); 54 ~GURL();
55 55
56 GURL& operator=(const GURL& other); 56 GURL& operator=(GURL other);
57 57
58 // Returns true when this object represents a valid parsed URL. When not 58 // Returns true when this object represents a valid parsed URL. When not
59 // valid, other functions will still succeed, but you will not get canonical 59 // valid, other functions will still succeed, but you will not get canonical
60 // data out in the format you may be expecting. Instead, we keep something 60 // data out in the format you may be expecting. Instead, we keep something
61 // "reasonable looking" so that the user can see how it's busted if 61 // "reasonable looking" so that the user can see how it's busted if
62 // displayed to them. 62 // displayed to them.
63 bool is_valid() const { 63 bool is_valid() const {
64 return is_valid_; 64 return is_valid_;
65 } 65 }
66 66
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 // Used for nested schemes [currently only filesystem:]. 373 // Used for nested schemes [currently only filesystem:].
374 scoped_ptr<GURL> inner_url_; 374 scoped_ptr<GURL> inner_url_;
375 375
376 // TODO bug 684583: Add encoding for query params. 376 // TODO bug 684583: Add encoding for query params.
377 }; 377 };
378 378
379 // Stream operator so GURL can be used in assertion statements. 379 // Stream operator so GURL can be used in assertion statements.
380 URL_EXPORT std::ostream& operator<<(std::ostream& out, const GURL& url); 380 URL_EXPORT std::ostream& operator<<(std::ostream& out, const GURL& url);
381 381
382 #endif // URL_GURL_H_ 382 #endif // URL_GURL_H_
OLDNEW
« no previous file with comments | « no previous file | url/gurl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698