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

Unified Diff: net/ssl/ssl_client_session_cache.cc

Issue 2384703002: Make SSLClientSessionCache a client of memory coordinator (Closed)
Patch Set: Created 4 years, 3 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') | no next file » | 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 28a33da15ce6d64dc4d5dbca21faf87daf60d551..f1aa1d0e612a4a25fa3394acbe4b13fdefc473da 100644
--- a/net/ssl/ssl_client_session_cache.cc
+++ b/net/ssl/ssl_client_session_cache.cc
@@ -6,6 +6,7 @@
#include <utility>
+#include "base/memory/memory_coordinator_client_registry.h"
#include "base/time/clock.h"
#include "base/time/default_clock.h"
@@ -18,10 +19,12 @@ SSLClientSessionCache::SSLClientSessionCache(const Config& config)
lookups_since_flush_(0) {
memory_pressure_listener_.reset(new base::MemoryPressureListener(base::Bind(
&SSLClientSessionCache::OnMemoryPressure, base::Unretained(this))));
+ base::MemoryCoordinatorClientRegistry::GetInstance()->Register(this);
}
SSLClientSessionCache::~SSLClientSessionCache() {
Flush();
+ base::MemoryCoordinatorClientRegistry::GetInstance()->Unregister(this);
}
size_t SSLClientSessionCache::size() const {
@@ -112,4 +115,22 @@ void SSLClientSessionCache::OnMemoryPressure(
}
}
+void SSLClientSessionCache::OnMemoryStateChange(base::MemoryState state) {
+ // TODO(hajimehoshi): When the state changes, adjust the sizes of the caches
+ // to reduce the limits. SSLClientSessionCache doesn't have the ability to
+ // limit at present.
+ switch (state) {
+ case base::MemoryState::NORMAL:
+ break;
+ case base::MemoryState::THROTTLED:
+ Flush();
+ break;
+ case base::MemoryState::SUSPENDED:
+ // Note: Not supported at present. Fall through.
+ case base::MemoryState::UNKNOWN:
+ NOTREACHED();
+ break;
+ }
+}
+
} // namespace net
« no previous file with comments | « net/ssl/ssl_client_session_cache.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698