diff options
author | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-23 22:36:37 +0000 |
---|---|---|
committer | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-23 22:36:37 +0000 |
commit | b8dd78ab4bfe90c98602b67835f310e0887509ee (patch) | |
tree | ce516487d50dcdf417becce8e106a4c8eaa3f528 /net/disk_cache | |
parent | c3ddb4e5921592c248d1cfa747ebf13e406ac466 (diff) | |
download | chromium_src-b8dd78ab4bfe90c98602b67835f310e0887509ee.zip chromium_src-b8dd78ab4bfe90c98602b67835f310e0887509ee.tar.gz chromium_src-b8dd78ab4bfe90c98602b67835f310e0887509ee.tar.bz2 |
Disk cache: Adjust the current experiment so that the cache
size is not limited by 1% of the disk space. Also, group four
was limited by the mask so it was effectively the same as
group 3.
Review URL: http://codereview.chromium.org/18727
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8589 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/disk_cache')
-rw-r--r-- | net/disk_cache/backend_impl.cc | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/net/disk_cache/backend_impl.cc b/net/disk_cache/backend_impl.cc index af35041..4698754 100644 --- a/net/disk_cache/backend_impl.cc +++ b/net/disk_cache/backend_impl.cc @@ -808,18 +808,20 @@ void BackendImpl::AdjustMaxCacheSize(int table_len) { // Let's not use more than the default size while we tune-up the performance // of bigger caches. TODO(rvargas): remove this limit. + // If we are creating the file, use 1 as the multiplier so the table size is + // the same for everybody. int multiplier = table_len ? data_->header.experiment : 1; DCHECK(multiplier > 0 && multiplier < 5); - if (max_size_ > kDefaultCacheSize * multiplier) - max_size_ = kDefaultCacheSize * multiplier; + max_size_ = kDefaultCacheSize * multiplier; if (!table_len) return; // If we already have a table, adjust the size to it. - int current_max_size = MaxStorageSizeForTable(table_len); - if (max_size_ > current_max_size) - max_size_= current_max_size; + // NOTE: Disabled for the experiment. + // int current_max_size = MaxStorageSizeForTable(table_len); + // if (max_size_ > current_max_size) + // max_size_= current_max_size; } void BackendImpl::RestartCache() { @@ -1079,18 +1081,19 @@ bool BackendImpl::CheckIndex() { return false; } - if (data_->header.table_len) { - if (current_size < GetIndexSize(data_->header.table_len) || - data_->header.table_len & (kBaseTableLen - 1)) { - LOG(ERROR) << "Corrupt Index file"; - return false; - } + if (!data_->header.table_len) { + LOG(ERROR) << "Invalid table size"; + return false; + } - AdjustMaxCacheSize(data_->header.table_len); - } else { - max_size_ = kDefaultCacheSize; + if (current_size < GetIndexSize(data_->header.table_len) || + data_->header.table_len & (kBaseTableLen - 1)) { + LOG(ERROR) << "Corrupt Index file"; + return false; } + AdjustMaxCacheSize(data_->header.table_len); + // We need to avoid integer overflows. DCHECK(max_size_ < kint32max - kint32max / 10); if (data_->header.num_bytes < 0 || @@ -1105,7 +1108,7 @@ bool BackendImpl::CheckIndex() { } if (!mask_) - mask_ = DesiredIndexTableLen(max_size_) - 1; + mask_ = data_->header.table_len - 1; return true; } |