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

Side by Side Diff: net/ssl/ssl_client_session_cache.h

Issue 2625883002: SSLClientSessionCache: Log number of times Lookup is called per Session. (Closed)
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « no previous file | net/ssl/ssl_client_session_cache.cc » ('j') | net/ssl/ssl_client_session_cache.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef NET_SSL_SSL_CLIENT_SESSION_CACHE_H_ 5 #ifndef NET_SSL_SSL_CLIENT_SESSION_CACHE_H_
6 #define NET_SSL_SSL_CLIENT_SESSION_CACHE_H_ 6 #define NET_SSL_SSL_CLIENT_SESSION_CACHE_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <time.h> 9 #include <time.h>
10 10
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 // Removes all entries from the cache. 57 // Removes all entries from the cache.
58 void Flush(); 58 void Flush();
59 59
60 void SetClockForTesting(std::unique_ptr<base::Clock> clock); 60 void SetClockForTesting(std::unique_ptr<base::Clock> clock);
61 61
62 // Dumps memory allocation stats. |pmd| is the ProcessMemoryDump of the 62 // Dumps memory allocation stats. |pmd| is the ProcessMemoryDump of the
63 // browser process. 63 // browser process.
64 void DumpMemoryStats(base::trace_event::ProcessMemoryDump* pmd); 64 void DumpMemoryStats(base::trace_event::ProcessMemoryDump* pmd);
65 65
66 private: 66 private:
67 struct Entry {
68 size_t lookup_count;
davidben 2017/01/11 16:47:50 If you just write size_t lookup_count = 0 here, I
nharper 2017/01/11 22:31:18 The chromium-style clang plugin complains that thi
69 bssl::UniquePtr<SSL_SESSION> session;
70
71 Entry();
72 ~Entry();
73 };
74
67 // base::MemoryCoordinatorClient implementation: 75 // base::MemoryCoordinatorClient implementation:
68 void OnMemoryStateChange(base::MemoryState state) override; 76 void OnMemoryStateChange(base::MemoryState state) override;
69 77
70 // Returns true if |entry| is expired as of |now|. 78 // Returns true if |entry| is expired as of |now|.
71 bool IsExpired(SSL_SESSION* session, time_t now); 79 bool IsExpired(SSL_SESSION* session, time_t now);
72 80
73 // Removes all expired sessions from the cache. 81 // Removes all expired sessions from the cache.
74 void FlushExpiredSessions(); 82 void FlushExpiredSessions();
75 83
76 // Clear cache on low memory notifications callback. 84 // Clear cache on low memory notifications callback.
77 void OnMemoryPressure( 85 void OnMemoryPressure(
78 base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level); 86 base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level);
79 87
80 std::unique_ptr<base::Clock> clock_; 88 std::unique_ptr<base::Clock> clock_;
81 Config config_; 89 Config config_;
82 base::HashingMRUCache<std::string, bssl::UniquePtr<SSL_SESSION>> cache_; 90 base::HashingMRUCache<std::string, std::unique_ptr<Entry>> cache_;
davidben 2017/01/11 16:47:50 Does it work to do base::HashingMRUCache<std::s
nharper 2017/01/11 22:31:18 I'd prefer to it to be base::HashingMRUCache<std::
83 size_t lookups_since_flush_; 91 size_t lookups_since_flush_;
84 92
85 // TODO(davidben): After https://crbug.com/458365 is fixed, replace this with 93 // TODO(davidben): After https://crbug.com/458365 is fixed, replace this with
86 // a ThreadChecker. The session cache should be single-threaded like other 94 // a ThreadChecker. The session cache should be single-threaded like other
87 // classes in net. 95 // classes in net.
88 base::Lock lock_; 96 base::Lock lock_;
89 97
90 std::unique_ptr<base::MemoryPressureListener> memory_pressure_listener_; 98 std::unique_ptr<base::MemoryPressureListener> memory_pressure_listener_;
91 99
92 DISALLOW_COPY_AND_ASSIGN(SSLClientSessionCache); 100 DISALLOW_COPY_AND_ASSIGN(SSLClientSessionCache);
93 }; 101 };
94 102
95 } // namespace net 103 } // namespace net
96 104
97 #endif // NET_SSL_SSL_CLIENT_SESSION_CACHE_H_ 105 #endif // NET_SSL_SSL_CLIENT_SESSION_CACHE_H_
OLDNEW
« no previous file with comments | « no previous file | net/ssl/ssl_client_session_cache.cc » ('j') | net/ssl/ssl_client_session_cache.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698