Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(746)

Unified Diff: net/disk_cache/backend_impl.cc

Issue 7765006: Disk cache: Don't evict anything for the first five (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/disk_cache/backend_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/backend_impl.cc
===================================================================
--- net/disk_cache/backend_impl.cc (revision 97896)
+++ net/disk_cache/backend_impl.cc (working copy)
@@ -47,6 +47,9 @@
const int kBaseTableLen = 64 * 1024;
const int kDefaultCacheSize = 80 * 1024 * 1024;
+// Avoid trimming the cache for the first 5 minutes (10 timer ticks).
+const int kTrimDelay = 10;
+
int DesiredIndexTableLen(int32 storage_size) {
if (storage_size <= k64kEntriesStore)
return kBaseTableLen;
@@ -366,7 +369,7 @@
block_files_(path),
mask_(0),
max_size_(0),
- io_delay_(0),
+ up_ticks_(0),
cache_type_(net::DISK_CACHE),
uma_report_(0),
user_flags_(0),
@@ -392,7 +395,7 @@
block_files_(path),
mask_(mask),
max_size_(0),
- io_delay_(0),
+ up_ticks_(0),
cache_type_(net::DISK_CACHE),
uma_report_(0),
user_flags_(kMask),
@@ -975,7 +978,8 @@
void BackendImpl::OnEntryDestroyEnd() {
DecreaseNumRefs();
- if (data_->header.num_bytes > max_size_ && !read_only_)
+ if (data_->header.num_bytes > max_size_ && !read_only_ &&
+ (up_ticks_ > kTrimDelay || user_flags_ & disk_cache::kNoRandom))
eviction_.TrimCache(false);
}
@@ -1190,6 +1194,7 @@
CACHE_UMA(COUNTS, "ByteIORate", 0, byte_count_ / 1024);
entry_count_ = 0;
byte_count_ = 0;
+ up_ticks_++;
if (!data_)
first_timer_ = false;
« no previous file with comments | « net/disk_cache/backend_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698