Commit e773216e authored by Victor Costan's avatar Victor Costan Committed by Commit Bot

url: Have GURL::Resolve() take StringPiece instead of string const-ref.

This way, callers that have a base::StringPiece[16] can avoid copying
the data into an {std::string, base::String16} just to call
GURL::Resolve().

Change-Id: I0c7d73ac55d102bc0bc39afe36efccc33e938e14
Reviewed-on: https://chromium-review.googlesource.com/1195740Reviewed-by: default avatarChris Palmer <palmer@chromium.org>
Commit-Queue: Victor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#587673}
parent a58d1798
...@@ -176,7 +176,7 @@ bool GURL::operator>(const GURL& other) const { ...@@ -176,7 +176,7 @@ bool GURL::operator>(const GURL& other) const {
} }
// Note: code duplicated below (it's inconvenient to use a template here). // Note: code duplicated below (it's inconvenient to use a template here).
GURL GURL::Resolve(const std::string& relative) const { GURL GURL::Resolve(base::StringPiece relative) const {
// Not allowed for invalid URLs. // Not allowed for invalid URLs.
if (!is_valid_) if (!is_valid_)
return GURL(); return GURL();
...@@ -202,7 +202,7 @@ GURL GURL::Resolve(const std::string& relative) const { ...@@ -202,7 +202,7 @@ GURL GURL::Resolve(const std::string& relative) const {
} }
// Note: code duplicated above (it's inconvenient to use a template here). // Note: code duplicated above (it's inconvenient to use a template here).
GURL GURL::Resolve(const base::string16& relative) const { GURL GURL::Resolve(base::StringPiece16 relative) const {
// Not allowed for invalid URLs. // Not allowed for invalid URLs.
if (!is_valid_) if (!is_valid_)
return GURL(); return GURL();
......
...@@ -151,8 +151,8 @@ class URL_EXPORT GURL { ...@@ -151,8 +151,8 @@ class URL_EXPORT GURL {
// //
// It is an error to resolve a URL relative to an invalid URL. The result // It is an error to resolve a URL relative to an invalid URL. The result
// will be the empty URL. // will be the empty URL.
GURL Resolve(const std::string& relative) const; GURL Resolve(base::StringPiece relative) const;
GURL Resolve(const base::string16& relative) const; GURL Resolve(base::StringPiece16 relative) const;
// Creates a new GURL by replacing the current URL's components with the // Creates a new GURL by replacing the current URL's components with the
// supplied versions. See the Replacements class in url_canon.h for more. // supplied versions. See the Replacements class in url_canon.h for more.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment