| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/http/http_network_session.h" | 5 #include "net/http/http_network_session.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/atomic_sequence_num.h" | 9 #include "base/atomic_sequence_num.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 switch (memory_pressure_level) { | 475 switch (memory_pressure_level) { |
| 476 case base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_NONE: | 476 case base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_NONE: |
| 477 break; | 477 break; |
| 478 case base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_MODERATE: | 478 case base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_MODERATE: |
| 479 case base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_CRITICAL: | 479 case base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_CRITICAL: |
| 480 CloseIdleConnections(); | 480 CloseIdleConnections(); |
| 481 break; | 481 break; |
| 482 } | 482 } |
| 483 } | 483 } |
| 484 | 484 |
| 485 void HttpNetworkSession::OnMemoryStateChange(base::MemoryState state) { | 485 void HttpNetworkSession::OnPurgeMemory() { |
| 486 // TODO(hajimehoshi): When the state changes, adjust the sizes of the caches | 486 CloseIdleConnections(); |
| 487 // to reduce the limits. HttpNetworkSession doesn't have the ability to limit | |
| 488 // at present. | |
| 489 switch (state) { | |
| 490 case base::MemoryState::NORMAL: | |
| 491 break; | |
| 492 case base::MemoryState::THROTTLED: | |
| 493 CloseIdleConnections(); | |
| 494 break; | |
| 495 case base::MemoryState::SUSPENDED: | |
| 496 // Note: Not supported at present. Fall through. | |
| 497 case base::MemoryState::UNKNOWN: | |
| 498 NOTREACHED(); | |
| 499 break; | |
| 500 } | |
| 501 } | 487 } |
| 502 | 488 |
| 503 } // namespace net | 489 } // namespace net |
| OLD | NEW |