| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/ssl/ssl_client_session_cache.h" | 5 #include "net/ssl/ssl_client_session_cache.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/memory/memory_coordinator_client_registry.h" | 9 #include "base/memory/memory_coordinator_client_registry.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 break; | 170 break; |
| 171 case base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_MODERATE: | 171 case base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_MODERATE: |
| 172 FlushExpiredSessions(); | 172 FlushExpiredSessions(); |
| 173 break; | 173 break; |
| 174 case base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_CRITICAL: | 174 case base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_CRITICAL: |
| 175 Flush(); | 175 Flush(); |
| 176 break; | 176 break; |
| 177 } | 177 } |
| 178 } | 178 } |
| 179 | 179 |
| 180 void SSLClientSessionCache::OnMemoryStateChange(base::MemoryState state) { | 180 void SSLClientSessionCache::OnPurgeMemory() { |
| 181 // TODO(hajimehoshi): When the state changes, adjust the sizes of the caches | 181 Flush(); |
| 182 // to reduce the limits. SSLClientSessionCache doesn't have the ability to | |
| 183 // limit at present. | |
| 184 switch (state) { | |
| 185 case base::MemoryState::NORMAL: | |
| 186 break; | |
| 187 case base::MemoryState::THROTTLED: | |
| 188 Flush(); | |
| 189 break; | |
| 190 case base::MemoryState::SUSPENDED: | |
| 191 // Note: Not supported at present. Fall through. | |
| 192 case base::MemoryState::UNKNOWN: | |
| 193 NOTREACHED(); | |
| 194 break; | |
| 195 } | |
| 196 } | 182 } |
| 197 | 183 |
| 198 } // namespace net | 184 } // namespace net |
| OLD | NEW |