| 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 "chrome/browser/renderer_host/web_cache_manager.h" | 5 #include "chrome/browser/renderer_host/web_cache_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 | 46 |
| 47 UMA_HISTOGRAM_MEMORY_MB("Cache.MaxCacheSizeMB", | 47 UMA_HISTOGRAM_MEMORY_MB("Cache.MaxCacheSizeMB", |
| 48 default_cache_size / 1024 / 1024); | 48 default_cache_size / 1024 / 1024); |
| 49 | 49 |
| 50 return default_cache_size; | 50 return default_cache_size; |
| 51 } | 51 } |
| 52 | 52 |
| 53 } // anonymous namespace | 53 } // anonymous namespace |
| 54 | 54 |
| 55 // static | 55 // static |
| 56 void WebCacheManager::RegisterPrefs(PrefService* prefs) { | 56 void WebCacheManager::RegisterPrefs(PrefServiceSimple* prefs) { |
| 57 prefs->RegisterIntegerPref(prefs::kMemoryCacheSize, GetDefaultCacheSize()); | 57 prefs->RegisterIntegerPref(prefs::kMemoryCacheSize, GetDefaultCacheSize()); |
| 58 } | 58 } |
| 59 | 59 |
| 60 // static | 60 // static |
| 61 WebCacheManager* WebCacheManager::GetInstance() { | 61 WebCacheManager* WebCacheManager::GetInstance() { |
| 62 return Singleton<WebCacheManager>::get(); | 62 return Singleton<WebCacheManager>::get(); |
| 63 } | 63 } |
| 64 | 64 |
| 65 WebCacheManager::WebCacheManager() | 65 WebCacheManager::WebCacheManager() |
| 66 : global_size_limit_(GetDefaultGlobalSizeLimit()), | 66 : global_size_limit_(GetDefaultGlobalSizeLimit()), |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 if (idle >= TimeDelta::FromMinutes(kRendererInactiveThresholdMinutes)) { | 433 if (idle >= TimeDelta::FromMinutes(kRendererInactiveThresholdMinutes)) { |
| 434 // Moved to inactive status. This invalidates our iterator. | 434 // Moved to inactive status. This invalidates our iterator. |
| 435 inactive_renderers_.insert(*iter); | 435 inactive_renderers_.insert(*iter); |
| 436 active_renderers_.erase(*iter); | 436 active_renderers_.erase(*iter); |
| 437 iter = active_renderers_.begin(); | 437 iter = active_renderers_.begin(); |
| 438 continue; | 438 continue; |
| 439 } | 439 } |
| 440 ++iter; | 440 ++iter; |
| 441 } | 441 } |
| 442 } | 442 } |
| OLD | NEW |