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

Unified Diff: net/http/http_network_session.cc

Issue 2132313002: [HttpNetworkSession] Flush socket pools on low memory notification. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mmenke's comments and rebasing 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/http/http_network_session.h ('k') | net/http/http_network_transaction_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_network_session.cc
diff --git a/net/http/http_network_session.cc b/net/http/http_network_session.cc
index 06651e967542d13ac5d4fbbb8b2516fe49712447..0f4a2519776962cb0312764c8e263fd6c3863e05 100644
--- a/net/http/http_network_session.cc
+++ b/net/http/http_network_session.cc
@@ -240,6 +240,9 @@ HttpNetworkSession::HttpNetworkSession(const Params& params)
http_server_properties_->SetMaxServerConfigsStoredInProperties(
params.quic_max_server_configs_stored_in_properties);
+
+ memory_pressure_listener_.reset(new base::MemoryPressureListener(base::Bind(
+ &HttpNetworkSession::OnMemoryPressure, base::Unretained(this))));
}
HttpNetworkSession::~HttpNetworkSession() {
@@ -402,4 +405,16 @@ ClientSocketPoolManager* HttpNetworkSession::GetSocketPoolManager(
return NULL;
}
+void HttpNetworkSession::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:
+ case base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_CRITICAL:
+ CloseIdleConnections();
+ break;
+ }
+}
+
} // namespace net
« no previous file with comments | « net/http/http_network_session.h ('k') | net/http/http_network_transaction_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698