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

Unified Diff: net/ssl/ssl_client_session_cache.h

Issue 2480813002: Don't maintain a second level of timeouts. (Closed)
Patch Set: SimpleTestClock is broken. 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/socket/ssl_client_socket_impl.cc ('k') | net/ssl/ssl_client_session_cache.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/ssl/ssl_client_session_cache.h
diff --git a/net/ssl/ssl_client_session_cache.h b/net/ssl/ssl_client_session_cache.h
index b02e2ede55f3f6d22a714c405bc2b879b3f74722..cd668a2614def6cd59d343ca1bf2f16b38bf23bb 100644
--- a/net/ssl/ssl_client_session_cache.h
+++ b/net/ssl/ssl_client_session_cache.h
@@ -6,6 +6,7 @@
#define NET_SSL_SSL_CLIENT_SESSION_CACHE_H
#include <stddef.h>
+#include <time.h>
#include <memory>
#include <string>
@@ -34,8 +35,6 @@ class NET_EXPORT SSLClientSessionCache : public base::MemoryCoordinatorClient {
size_t max_entries = 1024;
// The number of calls to Lookup before a new check for expired sessions.
size_t expiration_check_count = 256;
- // How long each session should last.
- base::TimeDelta timeout = base::TimeDelta::FromHours(1);
};
explicit SSLClientSessionCache(const Config& config);
@@ -58,23 +57,11 @@ class NET_EXPORT SSLClientSessionCache : public base::MemoryCoordinatorClient {
void SetClockForTesting(std::unique_ptr<base::Clock> clock);
private:
- struct CacheEntry {
- CacheEntry();
- ~CacheEntry();
-
- bssl::UniquePtr<SSL_SESSION> session;
- // The time at which this entry was created.
- base::Time creation_time;
- };
-
- using CacheEntryMap =
- base::HashingMRUCache<std::string, std::unique_ptr<CacheEntry>>;
-
// base::MemoryCoordinatorClient implementation:
void OnMemoryStateChange(base::MemoryState state) override;
// Returns true if |entry| is expired as of |now|.
- bool IsExpired(CacheEntry* entry, const base::Time& now);
+ bool IsExpired(SSL_SESSION* session, time_t now);
// Removes all expired sessions from the cache.
void FlushExpiredSessions();
@@ -85,7 +72,7 @@ class NET_EXPORT SSLClientSessionCache : public base::MemoryCoordinatorClient {
std::unique_ptr<base::Clock> clock_;
Config config_;
- CacheEntryMap cache_;
+ base::HashingMRUCache<std::string, bssl::UniquePtr<SSL_SESSION>> cache_;
size_t lookups_since_flush_;
// TODO(davidben): After https://crbug.com/458365 is fixed, replace this with
« no previous file with comments | « net/socket/ssl_client_socket_impl.cc ('k') | net/ssl/ssl_client_session_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698