Chromium Code Reviews| 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..928534cb8dbcd163c12a74cd242ba1447fb08927 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,25 @@ void HttpNetworkSession::OnMemoryPressure( |
| } |
| } |
| +void HttpNetworkSession::OnMemoryStateChange(base::MemoryState state) { |
| + // TODO(hajimehoshi): As OnMemoryStateChange changes the state, we should |
| + // adjust the limitation to the amount of cache, HttpNetworkSession doesn't |
| + // have such limitation so far though. |
|
Ryan Sleevi
2016/09/26 15:15:59
I often link to https://groups.google.com/a/chromi
hajimehoshi
2016/09/27 11:39:29
Done.
hajimehoshi
2016/09/27 11:39:29
Done.
|
| + switch (state) { |
| + case base::MemoryState::NORMAL: |
| + break; |
| + case base::MemoryState::THROTTLED: |
| + // TOOD(hajimehoshi): We don't have throttling 'level' so far. When we |
| + // have such value, let's change the argument accroding to the value. |
|
Ryan Sleevi
2016/09/26 15:15:59
Typo: according
But I'm also uncertain what this
hajimehoshi
2016/09/27 11:39:29
Done (removed). IIRC we don't have any plan to add
|
| + CloseIdleConnections(); |
| + break; |
| + case base::MemoryState::SUSPENDED: |
| + // Note that SUSPENDED never occurs in the main browser process so far. |
|
Ryan Sleevi
2016/09/26 15:15:59
//net shouldn't talk about things like "main brows
hajimehoshi
2016/09/27 11:39:29
Done.
|
| + // Fall through. |
| + case base::MemoryState::UNKNOWN: |
| + NOTREACHED(); |
| + break; |
| + } |
| +} |
| + |
| } // namespace net |