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

Unified Diff: net/ssl/ssl_client_session_cache.h

Issue 2625883002: SSLClientSessionCache: Log number of times Lookup is called per Session. (Closed)
Patch Set: log number of concurrent handshakes with the same session, not total number of times a session was … Created 3 years, 11 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/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 4a82010badda3722a6d318ff74951016a155bfc2..bb658c229c21fa176fc7be9795c54207c8483c8d 100644
--- a/net/ssl/ssl_client_session_cache.h
+++ b/net/ssl/ssl_client_session_cache.h
@@ -49,6 +49,12 @@ class NET_EXPORT SSLClientSessionCache : public base::MemoryCoordinatorClient {
// of the MRU list. Returns nullptr if there is none.
bssl::UniquePtr<SSL_SESSION> Lookup(const std::string& cache_key);
+ // If Lookup returns a non-null pointer, this method must be called once the
+ // TLS handshake done with the session from Lookup has completed. If
+ // |should_log| is true, the number of concurrent lookups will be logged to
+ // UMA once the count has reached 0.
+ void DecrementLookupCount(const std::string& cache_key, bool should_log);
+
// Inserts |session| into the cache at |cache_key|. If there is an existing
// one, it is released. Every |expiration_check_count| calls, the cache is
// checked for stale entries.
@@ -64,6 +70,18 @@ class NET_EXPORT SSLClientSessionCache : public base::MemoryCoordinatorClient {
void DumpMemoryStats(base::trace_event::ProcessMemoryDump* pmd);
private:
+ struct Entry {
+ public:
+ Entry();
+ Entry(Entry&&);
+ ~Entry();
+
+ size_t active_lookups;
+ size_t max_lookups;
+ bool should_log;
+ bssl::UniquePtr<SSL_SESSION> session;
+ };
+
// base::MemoryCoordinatorClient implementation:
void OnMemoryStateChange(base::MemoryState state) override;
@@ -79,7 +97,7 @@ class NET_EXPORT SSLClientSessionCache : public base::MemoryCoordinatorClient {
std::unique_ptr<base::Clock> clock_;
Config config_;
- base::HashingMRUCache<std::string, bssl::UniquePtr<SSL_SESSION>> cache_;
+ base::HashingMRUCache<std::string, Entry> cache_;
size_t lookups_since_flush_;
// TODO(davidben): After https://crbug.com/458365 is fixed, replace this with

Powered by Google App Engine
This is Rietveld 408576698