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

Unified Diff: net/cookies/canonical_cookie.cc

Issue 2481923002: [WIP] make GURL::path() return a StringPiece (Closed)
Patch Set: thanks asan Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/cookies/canonical_cookie.h ('k') | net/ftp/ftp_network_transaction.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cookies/canonical_cookie.cc
diff --git a/net/cookies/canonical_cookie.cc b/net/cookies/canonical_cookie.cc
index de2fbbe6c65f03826722b05646936e95ad0ae536..649937ce1b8163a9191c71408cc9b82dcd41604e 100644
--- a/net/cookies/canonical_cookie.cc
+++ b/net/cookies/canonical_cookie.cc
@@ -92,7 +92,7 @@ std::string CanonPathWithString(const GURL& url,
// Set-Cookie response, up to, but not including, the
// right-most /."""
// How would this work for a cookie on /? We will include it then.
- const std::string& url_path = url.path();
+ base::StringPiece url_path = url.path();
size_t idx = url_path.find_last_of('/');
@@ -101,7 +101,7 @@ std::string CanonPathWithString(const GURL& url,
return std::string("/");
// Return up to the rightmost '/'.
- return url_path.substr(0, idx);
+ return url_path.as_string().substr(0, idx);
}
// Compares cookies using name, domain and path, so that "equivalent" cookies
@@ -310,8 +310,7 @@ bool CanonicalCookie::IsEquivalentForSecureCookieMatching(
ecc.IsOnPath(Path()));
}
-bool CanonicalCookie::IsOnPath(const std::string& url_path) const {
-
+bool CanonicalCookie::IsOnPath(const base::StringPiece& url_path) const {
// A zero length would be unsafe for our trailing '/' checks, and
// would also make no sense for our prefix match. The code that
// creates a CanonicalCookie should make sure the path is never zero length,
« no previous file with comments | « net/cookies/canonical_cookie.h ('k') | net/ftp/ftp_network_transaction.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698