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

Unified Diff: net/http/http_auth_cache.cc

Issue 1151843002: DO NOT LAND Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More. Created 5 years, 7 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
Index: net/http/http_auth_cache.cc
diff --git a/net/http/http_auth_cache.cc b/net/http/http_auth_cache.cc
index 51f9035cb08e0b6e173357f1e18788428ea6f7a2..e4dda58316165c03d71b75883a6a44a00e48fcf2 100644
--- a/net/http/http_auth_cache.cc
+++ b/net/http/http_auth_cache.cc
@@ -41,12 +41,12 @@ bool IsEnclosingPath(const std::string& container, const std::string& path) {
}
// Debug helper to check that |origin| arguments are properly formed.
-void CheckOriginIsValid(const GURL& origin) {
- DCHECK(origin.is_valid());
- // Note that the scheme may be FTP when we're using a HTTP proxy.
- DCHECK(origin.SchemeIsHTTPOrHTTPS() || origin.SchemeIs("ftp") ||
- origin.SchemeIsWSOrWSS());
- DCHECK(origin.GetOrigin() == origin);
+void CheckOriginIsValid(const url::Origin& origin) {
+ DCHECK(!origin.unique());
+ DCHECK(origin.SchemeIs("http") || origin.SchemeIs("https") ||
+ // Note that the scheme may be FTP when we're using a HTTP proxy.
+ origin.SchemeIs("ftp") || origin.SchemeIs("ws") ||
+ origin.SchemeIs("wss"));
Ryan Sleevi 2015/05/22 02:50:03 These all make me sad, because they all are strict
}
// Functor used by remove_if.
@@ -77,7 +77,7 @@ HttpAuthCache::~HttpAuthCache() {
}
// Performance: O(n), where n is the number of realm entries.
-HttpAuthCache::Entry* HttpAuthCache::Lookup(const GURL& origin,
+HttpAuthCache::Entry* HttpAuthCache::Lookup(const url::Origin& origin,
const std::string& realm,
HttpAuth::Scheme scheme) {
CheckOriginIsValid(origin);
@@ -100,7 +100,7 @@ HttpAuthCache::Entry* HttpAuthCache::Lookup(const GURL& origin,
// Performance: O(n*m), where n is the number of realm entries, m is the number
// of path entries per realm. Both n amd m are expected to be small; m is
// kept small because AddPath() only keeps the shallowest entry.
-HttpAuthCache::Entry* HttpAuthCache::LookupByPath(const GURL& origin,
+HttpAuthCache::Entry* HttpAuthCache::LookupByPath(const url::Origin& origin,
const std::string& path) {
HttpAuthCache::Entry* best_match = NULL;
size_t best_match_length = 0;
@@ -132,7 +132,7 @@ HttpAuthCache::Entry* HttpAuthCache::LookupByPath(const GURL& origin,
return best_match;
}
-HttpAuthCache::Entry* HttpAuthCache::Add(const GURL& origin,
+HttpAuthCache::Entry* HttpAuthCache::Add(const url::Origin& origin,
const std::string& realm,
HttpAuth::Scheme scheme,
const std::string& auth_challenge,
@@ -202,7 +202,7 @@ void HttpAuthCache::Entry::AddPath(const std::string& path) {
bool evicted = false;
// Failsafe to prevent unbounded memory growth of the cache.
if (paths_.size() >= kMaxNumPathsPerRealmEntry) {
- LOG(WARNING) << "Num path entries for " << origin()
+ LOG(WARNING) << "Num path entries for " << origin().string()
<< " has grown too large -- evicting";
paths_.pop_back();
evicted = true;
@@ -232,7 +232,7 @@ bool HttpAuthCache::Entry::HasEnclosingPath(const std::string& dir,
return false;
}
-bool HttpAuthCache::Remove(const GURL& origin,
+bool HttpAuthCache::Remove(const url::Origin& origin,
const std::string& realm,
HttpAuth::Scheme scheme,
const AuthCredentials& credentials) {
@@ -253,7 +253,7 @@ void HttpAuthCache::Clear() {
entries_.clear();
}
-bool HttpAuthCache::UpdateStaleChallenge(const GURL& origin,
+bool HttpAuthCache::UpdateStaleChallenge(const url::Origin& origin,
const std::string& realm,
HttpAuth::Scheme scheme,
const std::string& auth_challenge) {

Powered by Google App Engine
This is Rietveld 408576698