diff options
author | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-18 18:17:43 +0000 |
---|---|---|
committer | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-18 18:17:43 +0000 |
commit | d7fc83f78f47de82da3b67449cf7c742b45d3a00 (patch) | |
tree | ec6d4c9a072ddd3cd54055906684f6ea1c750bf8 /net/disk_cache | |
parent | 1d41c54675bc2ff32e6833f9109e8ac7446aa0e0 (diff) | |
download | chromium_src-d7fc83f78f47de82da3b67449cf7c742b45d3a00.zip chromium_src-d7fc83f78f47de82da3b67449cf7c742b45d3a00.tar.gz chromium_src-d7fc83f78f47de82da3b67449cf7c742b45d3a00.tar.bz2 |
Disk cache: Go back to regular evictions if we are falling behind.
If the cache is under load we try to avoid evictions, or at least reduce
the frequency of evictions. This CL alters that logic so that when the
size of the cache grows too much above the desired limit we go back to
non throttled evictions.
BUG=none
TEST=none
Review URL: https://codereview.chromium.org/11961008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@177708 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/disk_cache')
-rw-r--r-- | net/disk_cache/eviction.cc | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/net/disk_cache/eviction.cc b/net/disk_cache/eviction.cc index 1a4a0f1..2086bd3 100644 --- a/net/disk_cache/eviction.cc +++ b/net/disk_cache/eviction.cc @@ -57,6 +57,10 @@ int LowWaterAdjust(int high_water) { return high_water - kCleanUpMargin; } +bool FallingBehind(int current_size, int max_size) { + return current_size > max_size - kCleanUpMargin * 20; +} + } // namespace namespace disk_cache { @@ -219,8 +223,10 @@ void Eviction::DelayedTrim() { } bool Eviction::ShouldTrim() { - if (trim_delays_ < kMaxDelayedTrims && backend_->IsLoaded()) + if (!FallingBehind(header_->num_bytes, max_size_) && + trim_delays_ < kMaxDelayedTrims && backend_->IsLoaded()) { return false; + } UMA_HISTOGRAM_COUNTS("DiskCache.TrimDelays", trim_delays_); trim_delays_ = 0; |