Commit deec29ca authored by Daniel Bratell's avatar Daniel Bratell Committed by Commit Bot

Renamed some global cache size constants

There were several different k*Cache*Size variables controlling
different caches but with the same name. These collided in jumbo
builds but also made it harder to discuss them and their values
so renaming them seems like a good improvement.

Bug: 746953
Change-Id: I1e8dc4f687c7b1e3ca8a9f9a5e80409029f8c4b0
Reviewed-on: https://chromium-review.googlesource.com/721205Reviewed-by: default avatarMichael Nordman <michaeln@chromium.org>
Commit-Queue: Daniel Bratell <bratell@opera.com>
Cr-Commit-Position: refs/heads/master@{#509341}
parent 54deffc6
......@@ -43,8 +43,8 @@ namespace content {
// Hard coded default when not using quota management.
static const int kDefaultQuota = 5 * 1024 * 1024;
static const int kMaxDiskCacheSize = 250 * 1024 * 1024;
static const int kMaxMemDiskCacheSize = 10 * 1024 * 1024;
static const int kMaxAppCacheDiskCacheSize = 250 * 1024 * 1024;
static const int kMaxAppCacheMemDiskCacheSize = 10 * 1024 * 1024;
static const base::FilePath::CharType kDiskCacheDirectoryName[] =
FILE_PATH_LITERAL("Cache");
......@@ -1887,14 +1887,14 @@ AppCacheDiskCache* AppCacheStorageImpl::disk_cache() {
disk_cache_.reset(new AppCacheDiskCache);
if (is_incognito_) {
rv = disk_cache_->InitWithMemBackend(
kMaxMemDiskCacheSize,
kMaxAppCacheMemDiskCacheSize,
base::Bind(&AppCacheStorageImpl::OnDiskCacheInitialized,
base::Unretained(this)));
} else {
expecting_cleanup_complete_on_disable_ = true;
rv = disk_cache_->InitWithDiskBackend(
cache_directory_.Append(kDiskCacheDirectoryName), kMaxDiskCacheSize,
false,
cache_directory_.Append(kDiskCacheDirectoryName),
kMaxAppCacheDiskCacheSize, false,
base::BindOnce(&AppCacheStorageImpl::OnDiskCacheCleanupComplete,
weak_factory_.GetWeakPtr()),
base::Bind(&AppCacheStorageImpl::OnDiskCacheInitialized,
......
......@@ -43,10 +43,10 @@ namespace {
// are purged.
#if defined(OS_ANDROID)
const unsigned kMaxStorageAreaCount = 20;
const size_t kMaxCacheSize = 2 * 1024 * 1024;
const size_t kMaxStorageCacheSize = 2 * 1024 * 1024;
#else
const unsigned kMaxStorageAreaCount = 100;
const size_t kMaxCacheSize = 20 * 1024 * 1024;
const size_t kMaxStorageCacheSize = 20 * 1024 * 1024;
#endif
const int kSessionStoraceScavengingSeconds = 60;
......@@ -493,7 +493,7 @@ void DOMStorageContextImpl::PurgeMemory(PurgeOption purge_option) {
// Purging is done based on the cache sizes without including the database
// size since it can be expensive trying to estimate the sqlite usage for
// all databases. For low end devices purge all inactive areas.
if (initial_stats.total_cache_size > kMaxCacheSize)
if (initial_stats.total_cache_size > kMaxStorageCacheSize)
purge_reason = "SizeLimitExceeded";
else if (initial_stats.total_area_count > kMaxStorageAreaCount)
purge_reason = "AreaCountLimitExceeded";
......
......@@ -62,10 +62,10 @@ const int kCommitErrorThreshold = 8;
// are purged.
#if defined(OS_ANDROID)
const unsigned kMaxStorageAreaCount = 10;
const size_t kMaxCacheSize = 2 * 1024 * 1024;
const size_t kMaxLocalStorageCacheSize = 2 * 1024 * 1024;
#else
const unsigned kMaxStorageAreaCount = 50;
const size_t kMaxCacheSize = 20 * 1024 * 1024;
const size_t kMaxLocalStorageCacheSize = 20 * 1024 * 1024;
#endif
static const uint8_t kUTF16Format = 0;
......@@ -498,7 +498,7 @@ void LocalStorageContextMojo::PurgeUnusedWrappersIfNeeded() {
CachePurgeReason purge_reason = CachePurgeReason::NotNeeded;
if (total_cache_size > kMaxCacheSize)
if (total_cache_size > kMaxLocalStorageCacheSize)
purge_reason = CachePurgeReason::SizeLimitExceeded;
else if (level_db_wrappers_.size() > kMaxStorageAreaCount)
purge_reason = CachePurgeReason::AreaCountLimitExceeded;
......
......@@ -71,8 +71,8 @@ const base::FilePath::CharType kDatabaseName[] =
const base::FilePath::CharType kDiskCacheName[] =
FILE_PATH_LITERAL("ScriptCache");
const int kMaxMemDiskCacheSize = 10 * 1024 * 1024;
const int kMaxDiskCacheSize = 250 * 1024 * 1024;
const int kMaxServiceWorkerStorageMemDiskCacheSize = 10 * 1024 * 1024;
const int kMaxServiceWorkerStorageDiskCacheSize = 250 * 1024 * 1024;
ServiceWorkerStatusCode DatabaseStatusToStatusCode(
ServiceWorkerDatabase::Status status) {
......@@ -1488,8 +1488,8 @@ ServiceWorkerDiskCache* ServiceWorkerStorage::disk_cache() {
base::FilePath path = GetDiskCachePath();
if (path.empty()) {
int rv = disk_cache_->InitWithMemBackend(kMaxMemDiskCacheSize,
net::CompletionCallback());
int rv = disk_cache_->InitWithMemBackend(
kMaxServiceWorkerStorageMemDiskCacheSize, net::CompletionCallback());
DCHECK_EQ(net::OK, rv);
return disk_cache_.get();
}
......@@ -1502,7 +1502,7 @@ void ServiceWorkerStorage::InitializeDiskCache() {
disk_cache_->set_is_waiting_to_initialize(false);
expecting_done_with_disk_on_disable_ = true;
int rv = disk_cache_->InitWithDiskBackend(
GetDiskCachePath(), kMaxDiskCacheSize, false,
GetDiskCachePath(), kMaxServiceWorkerStorageDiskCacheSize, false,
base::BindOnce(&ServiceWorkerStorage::DiskCacheImplDoneWithDisk,
weak_factory_.GetWeakPtr()),
base::Bind(&ServiceWorkerStorage::OnDiskCacheInitialized,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment