Commit e89c48a3 authored by Josh Karlin's avatar Josh Karlin Committed by Commit Bot

[CacheStorageCache] Increase padding size

Bug: 617963
Change-Id: I5c9dcd156dfb9a6cb1b950be1f7f1d1bf77380fb
Reviewed-on: https://chromium-review.googlesource.com/663398Reviewed-by: default avatarChris Mumford <cmumford@chromium.org>
Commit-Queue: Josh Karlin <jkarlin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#501287}
parent e96e7e2e
...@@ -56,6 +56,19 @@ const size_t kMaxQueryCacheResultBytes = ...@@ -56,6 +56,19 @@ const size_t kMaxQueryCacheResultBytes =
const char kRecordBytesLabel[] = "DiskCache.CacheStorage"; const char kRecordBytesLabel[] = "DiskCache.CacheStorage";
// The range of the padding added to response sizes for opaque resources.
// Increment padding version if changed.
const uint64_t kPaddingRange = 14431 * 1024;
// If the way that a cache's padding is calculated changes increment this
// version.
//
// History:
//
// 1: Uniform random 400K.
// 2: Uniform random 14,431K.
const int32_t kCachePaddingAlgorithmVersion = 2;
// This class ensures that the cache and the entry have a lifetime as long as // This class ensures that the cache and the entry have a lifetime as long as
// the blob that is created to contain them. // the blob that is created to contain them.
class CacheStorageCacheDataHandle class CacheStorageCacheDataHandle
...@@ -291,20 +304,10 @@ bool ShouldPadResourceSize(const ServiceWorkerResponse* response) { ...@@ -291,20 +304,10 @@ bool ShouldPadResourceSize(const ServiceWorkerResponse* response) {
!response->url_list.empty()); !response->url_list.empty());
} }
// If the way that a cache's padding is calculated changes increment this
// version.
//
// History:
//
// 1: Uniform random 400K.
const int32_t kCachePaddingAlgorithmVersion = 1;
int64_t CalculateResponsePaddingInternal( int64_t CalculateResponsePaddingInternal(
const std::string& response_url, const std::string& response_url,
const crypto::SymmetricKey* padding_key, const crypto::SymmetricKey* padding_key,
int side_data_size) { int side_data_size) {
const uint64_t kPaddingRange = 400 * 1024; // Increment version if changed.
DCHECK(!response_url.empty()); DCHECK(!response_url.empty());
crypto::HMAC hmac(crypto::HMAC::SHA256); crypto::HMAC hmac(crypto::HMAC::SHA256);
......
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