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

Unified Diff: net/ssl/ssl_client_session_cache.cc

Issue 2131883002: Clear SSLClientSessionCache on low memory notifications. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased + removed not used method Created 4 years, 5 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/ssl/ssl_client_session_cache.h ('k') | net/ssl/ssl_client_session_cache_unittest.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.cc
diff --git a/net/ssl/ssl_client_session_cache.cc b/net/ssl/ssl_client_session_cache.cc
index 82526a5ae4d1a022b0fdbd47c981b592a814cf0a..650d98948a2cacd2093d5fd49faef46fd62a6744 100644
--- a/net/ssl/ssl_client_session_cache.cc
+++ b/net/ssl/ssl_client_session_cache.cc
@@ -15,7 +15,10 @@ SSLClientSessionCache::SSLClientSessionCache(const Config& config)
: clock_(new base::DefaultClock),
config_(config),
cache_(config.max_entries),
- lookups_since_flush_(0) {}
+ lookups_since_flush_(0) {
+ memory_pressure_listener_.reset(new base::MemoryPressureListener(base::Bind(
+ &SSLClientSessionCache::OnMemoryPressure, base::Unretained(this))));
+}
SSLClientSessionCache::~SSLClientSessionCache() {
Flush();
@@ -91,4 +94,18 @@ void SSLClientSessionCache::FlushExpiredSessions() {
}
}
+void SSLClientSessionCache::OnMemoryPressure(
+ base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level) {
+ switch (memory_pressure_level) {
+ case base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_NONE:
+ break;
+ case base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_MODERATE:
+ FlushExpiredSessions();
+ break;
+ case base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_CRITICAL:
+ Flush();
+ break;
+ }
+}
+
} // namespace net
« no previous file with comments | « net/ssl/ssl_client_session_cache.h ('k') | net/ssl/ssl_client_session_cache_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698