summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authordeanm@chromium.org <deanm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-13 14:56:13 +0000
committerdeanm@chromium.org <deanm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-13 14:56:13 +0000
commit8b5ac3aa3be206660efb5ac4f95ab48c4dab117e (patch)
tree83a9d49fc92368b8fcafeb6f1e9a15df89951455 /chrome
parentfa1afe31ecd9b3d2720bb1b5eb35ebfebf9d5c64 (diff)
downloadchromium_src-8b5ac3aa3be206660efb5ac4f95ab48c4dab117e.zip
chromium_src-8b5ac3aa3be206660efb5ac4f95ab48c4dab117e.tar.gz
chromium_src-8b5ac3aa3be206660efb5ac4f95ab48c4dab117e.tar.bz2
Remove a static initializer for a TimeDelta constant.
Review URL: http://codereview.chromium.org/17631 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7927 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/cache_manager_host.cc6
-rw-r--r--chrome/browser/cache_manager_host.h2
-rw-r--r--chrome/browser/cache_manager_host_unittest.cc5
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();
}