| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 UMA_HISTOGRAM_MEMORY_MB("Cache.MaxCacheSizeMB", | 44 UMA_HISTOGRAM_MEMORY_MB("Cache.MaxCacheSizeMB", |
| 45 default_cache_size / 1024 / 1024); | 45 default_cache_size / 1024 / 1024); |
| 46 | 46 |
| 47 return default_cache_size; | 47 return default_cache_size; |
| 48 } | 48 } |
| 49 | 49 |
| 50 } // anonymous namespace | 50 } // anonymous namespace |
| 51 | 51 |
| 52 // static | 52 // static |
| 53 void WebCacheManager::RegisterPrefs(PrefService* prefs) { | 53 void WebCacheManager::RegisterPrefs(PrefService* prefs) { |
| 54 prefs->RegisterIntegerPref(prefs::kMemoryCacheSize, GetDefaultCacheSize()); | 54 prefs->RegisterIntegerPref(prefs::kMemoryCacheSize, |
| 55 GetDefaultCacheSize(), |
| 56 false /* don't sync pref */); |
| 55 } | 57 } |
| 56 | 58 |
| 57 // static | 59 // static |
| 58 WebCacheManager* WebCacheManager::GetInstance() { | 60 WebCacheManager* WebCacheManager::GetInstance() { |
| 59 return Singleton<WebCacheManager>::get(); | 61 return Singleton<WebCacheManager>::get(); |
| 60 } | 62 } |
| 61 | 63 |
| 62 WebCacheManager::WebCacheManager() | 64 WebCacheManager::WebCacheManager() |
| 63 : global_size_limit_(GetDefaultGlobalSizeLimit()), | 65 : global_size_limit_(GetDefaultGlobalSizeLimit()), |
| 64 ALLOW_THIS_IN_INITIALIZER_LIST(revise_allocation_factory_(this)) { | 66 ALLOW_THIS_IN_INITIALIZER_LIST(revise_allocation_factory_(this)) { |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 if (idle >= TimeDelta::FromMinutes(kRendererInactiveThresholdMinutes)) { | 403 if (idle >= TimeDelta::FromMinutes(kRendererInactiveThresholdMinutes)) { |
| 402 // Moved to inactive status. This invalidates our iterator. | 404 // Moved to inactive status. This invalidates our iterator. |
| 403 inactive_renderers_.insert(*iter); | 405 inactive_renderers_.insert(*iter); |
| 404 active_renderers_.erase(*iter); | 406 active_renderers_.erase(*iter); |
| 405 iter = active_renderers_.begin(); | 407 iter = active_renderers_.begin(); |
| 406 continue; | 408 continue; |
| 407 } | 409 } |
| 408 ++iter; | 410 ++iter; |
| 409 } | 411 } |
| 410 } | 412 } |
| OLD | NEW |