| Index: net/http/http_network_session.cc
|
| diff --git a/net/http/http_network_session.cc b/net/http/http_network_session.cc
|
| index 66a4eab8b06649bcdb76d4f5142b6912c2fe0bdc..03392bb773c429cb9be704380ac180c0137b9059 100644
|
| --- a/net/http/http_network_session.cc
|
| +++ b/net/http/http_network_session.cc
|
| @@ -10,6 +10,7 @@
|
| #include "base/compiler_specific.h"
|
| #include "base/debug/stack_trace.h"
|
| #include "base/logging.h"
|
| +#include "base/memory/memory_coordinator_client_registry.h"
|
| #include "base/profiler/scoped_tracker.h"
|
| #include "base/stl_util.h"
|
| #include "base/strings/string_number_conversions.h"
|
| @@ -236,11 +237,13 @@ HttpNetworkSession::HttpNetworkSession(const Params& params)
|
|
|
| memory_pressure_listener_.reset(new base::MemoryPressureListener(base::Bind(
|
| &HttpNetworkSession::OnMemoryPressure, base::Unretained(this))));
|
| + base::MemoryCoordinatorClientRegistry::GetInstance()->Register(this);
|
| }
|
|
|
| HttpNetworkSession::~HttpNetworkSession() {
|
| base::STLDeleteElements(&response_drainers_);
|
| spdy_session_pool_.CloseAllSessions();
|
| + base::MemoryCoordinatorClientRegistry::GetInstance()->Unregister(this);
|
| }
|
|
|
| void HttpNetworkSession::AddResponseDrainer(HttpResponseBodyDrainer* drainer) {
|
| @@ -404,4 +407,22 @@ void HttpNetworkSession::OnMemoryPressure(
|
| }
|
| }
|
|
|
| +void HttpNetworkSession::OnMemoryStateChange(base::MemoryState state) {
|
| + // TODO(hajimehoshi): When the state changes, adjust the sizes of the caches
|
| + // to reduce the limits. HttpNetworkSession doesn't have the ability to limit
|
| + // at present.
|
| + switch (state) {
|
| + case base::MemoryState::NORMAL:
|
| + break;
|
| + case base::MemoryState::THROTTLED:
|
| + CloseIdleConnections();
|
| + break;
|
| + case base::MemoryState::SUSPENDED:
|
| + // Note: Not supported at present. Fall through.
|
| + case base::MemoryState::UNKNOWN:
|
| + NOTREACHED();
|
| + break;
|
| + }
|
| +}
|
| +
|
| } // namespace net
|
|
|