diff options
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/cache_manager_host.cc | 6 | ||||
-rw-r--r-- | chrome/browser/cache_manager_host.h | 2 | ||||
-rw-r--r-- | chrome/browser/cache_manager_host_unittest.cc | 5 |
3 files changed, 5 insertions, 8 deletions
diff --git a/chrome/browser/cache_manager_host.cc b/chrome/browser/cache_manager_host.cc index c68cbaa8..cc0f2e3 100644 --- a/chrome/browser/cache_manager_host.cc +++ b/chrome/browser/cache_manager_host.cc @@ -23,10 +23,6 @@ static const unsigned int kReviseAllocationDelayMS = 200 /* milliseconds */; // The default size limit of the in-memory cache is 8 MB static const int kDefaultMemoryCacheSize = 8 * 1024 * 1024; -// The amount of idle time before we consider a tab to be "inactive" -const TimeDelta CacheManagerHost::kRendererInactiveThreshold = - TimeDelta::FromMinutes(5); - namespace { int GetDefaultCacheSize() { @@ -367,7 +363,7 @@ void CacheManagerHost::FindInactiveRenderers() { StatsMap::iterator elmt = stats_.find(*iter); DCHECK(elmt != stats_.end()); TimeDelta idle = Time::Now() - elmt->second.access; - if (idle >= kRendererInactiveThreshold) { + if (idle >= TimeDelta::FromMinutes(kRendererInactiveThresholdMinutes)) { // Moved to inactive status. This invalidates our iterator. inactive_renderers_.insert(*iter); active_renderers_.erase(*iter); diff --git a/chrome/browser/cache_manager_host.h b/chrome/browser/cache_manager_host.h index a67c345..5046624 100644 --- a/chrome/browser/cache_manager_host.h +++ b/chrome/browser/cache_manager_host.h @@ -68,7 +68,7 @@ class CacheManagerHost { protected: // The amount of idle time before we consider a tab to be "inactive" - static const base::TimeDelta kRendererInactiveThreshold; + static const int kRendererInactiveThresholdMinutes = 5; // Keep track of some renderer information. struct RendererInfo : CacheManager::UsageStats { diff --git a/chrome/browser/cache_manager_host_unittest.cc b/chrome/browser/cache_manager_host_unittest.cc index 5dc9684..fe35bb3 100644 --- a/chrome/browser/cache_manager_host_unittest.cc +++ b/chrome/browser/cache_manager_host_unittest.cc @@ -10,6 +10,7 @@ #include "webkit/glue/cache_manager.h" using base::Time; +using base::TimeDelta; class CacheManagerHostTest : public testing::Test { protected: @@ -28,8 +29,8 @@ class CacheManagerHostTest : public testing::Test { } static void SimulateInactivity(CacheManagerHost* h, int renderer_id) { - stats(h)[renderer_id].access = Time::Now() - - CacheManagerHost::kRendererInactiveThreshold; + stats(h)[renderer_id].access = Time::Now() - TimeDelta::FromMinutes( + CacheManagerHost::kRendererInactiveThresholdMinutes); h->FindInactiveRenderers(); } |