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

Unified Diff: net/ssl/ssl_client_session_cache.h

Issue 2625883002: SSLClientSessionCache: Log number of times Lookup is called per Session. (Closed)
Patch Set: reply to comments 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
« 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 4a82010badda3722a6d318ff74951016a155bfc2..0cfefc31e75ad63756d04e25ba1a1fde53631571 100644
--- a/net/ssl/ssl_client_session_cache.h
+++ b/net/ssl/ssl_client_session_cache.h
@@ -46,8 +46,14 @@ class NET_EXPORT SSLClientSessionCache : public base::MemoryCoordinatorClient {
size_t size() const;
// Returns the session associated with |cache_key| and moves it to the front
- // of the MRU list. Returns nullptr if there is none.
- bssl::UniquePtr<SSL_SESSION> Lookup(const std::string& cache_key);
+ // of the MRU list. Returns nullptr if there is none. If |count| is non-null,
+ // |*count| will contain the number of times this session has been looked up
+ // (including this call).
+ bssl::UniquePtr<SSL_SESSION> Lookup(const std::string& cache_key, int* count);
+
+ // Resets the count returned by Lookup to 0 for the session associated with
+ // |cache_key|.
+ void ResetLookupCount(const std::string& cache_key);
// 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
@@ -64,6 +70,15 @@ class NET_EXPORT SSLClientSessionCache : public base::MemoryCoordinatorClient {
void DumpMemoryStats(base::trace_event::ProcessMemoryDump* pmd);
private:
+ struct Entry {
+ Entry();
+ Entry(Entry&&);
+ ~Entry();
+
+ int lookups;
+ bssl::UniquePtr<SSL_SESSION> session;
+ };
+
// base::MemoryCoordinatorClient implementation:
void OnMemoryStateChange(base::MemoryState state) override;
@@ -79,7 +94,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
« 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