summaryrefslogtreecommitdiffstats
path: root/net/disk_cache/cache_util.cc
diff options
context:
space:
mode:
Diffstat (limited to 'net/disk_cache/cache_util.cc')
-rw-r--r--net/disk_cache/cache_util.cc11
1 files changed, 4 insertions, 7 deletions
diff --git a/net/disk_cache/cache_util.cc b/net/disk_cache/cache_util.cc
index ea39df0..1671138 100644
--- a/net/disk_cache/cache_util.cc
+++ b/net/disk_cache/cache_util.cc
@@ -145,15 +145,12 @@ int PreferredCacheSize(int64 available) {
if (available < 0)
return kDefaultCacheSize;
- int64 max_size = PreferredCacheSizeInternal(available);
-
// Limit cache size to somewhat less than kint32max to avoid potential
// integer overflows in cache backend implementations.
- DCHECK(kDefaultCacheSize * 4 < kint32max);
- if (max_size > kDefaultCacheSize * 4)
- max_size = kDefaultCacheSize * 4;
-
- return implicit_cast<int32>(max_size);
+ DCHECK_LT(kDefaultCacheSize * 4, kint32max);
+ return static_cast<int32>(std::min(
+ PreferredCacheSizeInternal(available),
+ static_cast<int64>(kDefaultCacheSize * 4)));
}
} // namespace disk_cache