diff options
Diffstat (limited to 'chromium/net/http/http_auth_cache.h')
-rw-r--r-- | chromium/net/http/http_auth_cache.h | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/chromium/net/http/http_auth_cache.h b/chromium/net/http/http_auth_cache.h index 8698fb780e5..63b54e6f103 100644 --- a/chromium/net/http/http_auth_cache.h +++ b/chromium/net/http/http_auth_cache.h @@ -62,6 +62,10 @@ class NET_EXPORT HttpAuthCache { void UpdateStaleChallenge(const std::string& auth_challenge); + bool IsEqualForTesting(const Entry& other) const; + + bool operator==(const Entry& other) const = delete; + private: friend class HttpAuthCache; FRIEND_TEST_ALL_PREFIXES(HttpAuthCacheTest, AddPath); @@ -77,9 +81,12 @@ class NET_EXPORT HttpAuthCache { // Returns true if |dir| is contained within the realm's protection // space. |*path_len| is set to the length of the enclosing path if - // such a path exists and |path_len| is non-NULL. If no enclosing + // such a path exists and |path_len| is non-nullptr. If no enclosing // path is found, |*path_len| is left unmodified. // + // If an enclosing path is found, moves it up by one place in the paths list + // so that more frequently used paths migrate to the front of the list. + // // Note that proxy auth cache entries are associated with empty // paths. Therefore it is possible for HasEnclosingPath() to return // true and set |*path_len| to 0. @@ -117,22 +124,26 @@ class NET_EXPORT HttpAuthCache { ~HttpAuthCache(); // Find the realm entry on server |origin| for realm |realm| and - // scheme |scheme|. + // scheme |scheme|. If a matching entry is found, move it up by one place + // in the entries list, so that more frequently used entries migrate to the + // front of the list. // |origin| - the {scheme, host, port} of the server. // |realm| - case sensitive realm string. // |scheme| - the authentication scheme (i.e. basic, negotiate). - // returns - the matched entry or NULL. + // returns - the matched entry or nullptr. Entry* Lookup(const GURL& origin, const std::string& realm, HttpAuth::Scheme scheme); // Find the entry on server |origin| whose protection space includes // |path|. This uses the assumption in RFC 2617 section 2 that deeper - // paths lie in the same protection space. + // paths lie in the same protection space. If a matching entry is found, move + // it up by one place in the entries list, so that more frequently used + // entries migrate to the front of the list. // |origin| - the {scheme, host, port} of the server. // |path| - absolute path of the resource, or empty string in case of // proxy auth (which does not use the concept of paths). - // returns - the matched entry or NULL. + // returns - the matched entry or nullptr. Entry* LookupByPath(const GURL& origin, const std::string& path); // Add an entry on server |origin| for realm |handler->realm()| and @@ -197,6 +208,12 @@ class NET_EXPORT HttpAuthCache { const base::TickClock* tick_clock_ = base::DefaultTickClock::GetInstance(); const base::Clock* clock_ = base::DefaultClock::GetInstance(); + + // Moves an entry towards the beginning of the entry list by one place, if it + // is not already at the beginning. This makes the more frequently accessed + // entries migrate towards the beginning of the list. + // Returns: the given entry, after possible move. + Entry* MoveEntryTowardsBeginning(EntryList::iterator entry_it); }; // An authentication realm entry. |