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

Unified Diff: content/browser/cache_storage/cache_storage_cache.h

Issue 3002693002: Revert of [CacheStorage] Pad and bin opaque resource sizes. (Closed)
Patch Set: Created 3 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
Index: content/browser/cache_storage/cache_storage_cache.h
diff --git a/content/browser/cache_storage/cache_storage_cache.h b/content/browser/cache_storage/cache_storage_cache.h
index 2feda21a7daf3ed6792dbff95e7bdba0329cdad3..46ea4f07fbe08ddf1be537a63624c6601e7b3619 100644
--- a/content/browser/cache_storage/cache_storage_cache.h
+++ b/content/browser/cache_storage/cache_storage_cache.h
@@ -22,10 +22,6 @@
#include "net/disk_cache/disk_cache.h"
#include "storage/common/quota/quota_status_code.h"
-namespace crypto {
-class SymmetricKey;
-}
-
namespace net {
class URLRequestContextGetter;
}
@@ -46,7 +42,6 @@
namespace proto {
class CacheMetadata;
-class CacheResponse;
}
// Represents a ServiceWorker Cache as seen in
@@ -70,7 +65,6 @@
using RequestsCallback =
base::OnceCallback<void(CacheStorageError, std::unique_ptr<Requests>)>;
using SizeCallback = base::OnceCallback<void(int64_t)>;
- using SizePaddingCallback = base::OnceCallback<void(int64_t, int64_t)>;
enum EntryIndex { INDEX_HEADERS = 0, INDEX_RESPONSE_BODY, INDEX_SIDE_DATA };
@@ -80,8 +74,7 @@
CacheStorage* cache_storage,
scoped_refptr<net::URLRequestContextGetter> request_context_getter,
scoped_refptr<storage::QuotaManagerProxy> quota_manager_proxy,
- base::WeakPtr<storage::BlobStorageContext> blob_context,
- std::unique_ptr<crypto::SymmetricKey> cache_padding_key);
+ base::WeakPtr<storage::BlobStorageContext> blob_context);
static std::unique_ptr<CacheStorageCache> CreatePersistentCache(
const GURL& origin,
const std::string& cache_name,
@@ -90,14 +83,7 @@
scoped_refptr<net::URLRequestContextGetter> request_context_getter,
scoped_refptr<storage::QuotaManagerProxy> quota_manager_proxy,
base::WeakPtr<storage::BlobStorageContext> blob_context,
- int64_t cache_size,
- int64_t cache_padding,
- std::unique_ptr<crypto::SymmetricKey> cache_padding_key);
- static int64_t CalculateResponsePadding(
- const ServiceWorkerResponse& response,
- const crypto::SymmetricKey* padding_key,
- int side_data_size);
- static int32_t GetResponsePaddingVersion();
+ int64_t cache_size);
// Returns ERROR_TYPE_NOT_FOUND if not found.
void Match(std::unique_ptr<ServiceWorkerFetchRequest> request,
@@ -179,16 +165,6 @@
int64_t cache_size() const { return cache_size_; }
- int64_t cache_padding() const { return cache_padding_; }
-
- const crypto::SymmetricKey* cache_padding_key() const {
- return cache_padding_key_.get();
- }
-
- // Return the total cache size (actual size + padding). If either is unknown
- // then CacheStorage::kSizeUnknown is returned.
- int64_t PaddedCacheSize() const;
-
// Set the one observer that will be notified of changes to this cache.
// Note: Either the observer must have a lifetime longer than this instance
// or call SetObserver(nullptr) to stop receiving notification of changes.
@@ -197,13 +173,7 @@
base::WeakPtr<CacheStorageCache> AsWeakPtr();
private:
- // QueryCache types:
- enum QueryCacheFlags {
- QUERY_CACHE_REQUESTS = 0x1,
- QUERY_CACHE_RESPONSES_WITH_BODIES = 0x2,
- QUERY_CACHE_RESPONSES_NO_BODIES = 0x4,
- QUERY_CACHE_ENTRIES = 0x8,
- };
+ enum class QueryCacheType { REQUESTS, REQUESTS_AND_RESPONSES, CACHE_ENTRIES };
// The backend progresses from uninitialized, to open, to closed, and cannot
// reverse direction. The open step may be skipped.
@@ -221,7 +191,6 @@
struct QueryCacheContext;
struct QueryCacheResult;
- using QueryTypes = int32_t;
using QueryCacheResults = std::vector<QueryCacheResult>;
using QueryCacheCallback =
base::OnceCallback<void(CacheStorageError,
@@ -239,9 +208,7 @@
scoped_refptr<net::URLRequestContextGetter> request_context_getter,
scoped_refptr<storage::QuotaManagerProxy> quota_manager_proxy,
base::WeakPtr<storage::BlobStorageContext> blob_context,
- int64_t cache_size,
- int64_t cache_padding,
- std::unique_ptr<crypto::SymmetricKey> cache_padding_key);
+ int64_t cache_size);
// Runs |callback| with matching requests/response data. The data provided
// in the QueryCacheResults depends on the |query_type|. If |query_type| is
@@ -251,7 +218,7 @@
// out_blob_data_handles are valid.
void QueryCache(std::unique_ptr<ServiceWorkerFetchRequest> request,
const CacheStorageCacheQueryParams& options,
- QueryTypes query_types,
+ QueryCacheType query_type,
QueryCacheCallback callback);
void QueryCacheDidOpenFastPath(
std::unique_ptr<QueryCacheContext> query_cache_context,
@@ -322,21 +289,17 @@
int buf_len,
disk_cache::ScopedEntryPtr entry,
std::unique_ptr<proto::CacheMetadata> headers);
- void WriteSideDataDidWrite(
- ErrorCallback callback,
- disk_cache::ScopedEntryPtr entry,
- int expected_bytes,
- std::unique_ptr<content::proto::CacheResponse> response,
- int side_data_size_before_write,
- int rv);
+ void WriteSideDataDidWrite(ErrorCallback callback,
+ disk_cache::ScopedEntryPtr entry,
+ int expected_bytes,
+ int rv);
// Puts the request and response object in the cache. The response body (if
// present) is stored in the cache, but not the request body. Returns OK on
// success.
void Put(const CacheStorageBatchOperation& operation, ErrorCallback callback);
void PutImpl(std::unique_ptr<PutContext> put_context);
- void PutDidDeleteEntry(std::unique_ptr<PutContext> put_context,
- CacheStorageError error);
+ void PutDidDoomEntry(std::unique_ptr<PutContext> put_context, int rv);
void PutDidGetUsageAndQuota(std::unique_ptr<PutContext> put_context,
storage::QuotaStatusCode status_code,
int64_t usage,
@@ -393,29 +356,12 @@
std::unique_ptr<ScopedBackendPtr> backend_ptr,
int rv);
- // Calculate the size and padding of the cache.
- void CalculateCacheSizePadding(SizePaddingCallback callback);
- void CalculateCacheSizePaddingGotSize(SizePaddingCallback callback,
- int cache_size);
- void PaddingDidQueryCache(
- SizePaddingCallback callback,
- int cache_size,
- CacheStorageError error,
- std::unique_ptr<QueryCacheResults> query_cache_results);
-
- // Calculate the size (but not padding) of the cache.
- void CalculateCacheSize(const net::CompletionCallback& callback);
-
void InitBackend();
void InitDidCreateBackend(base::OnceClosure callback,
CacheStorageError cache_create_error);
void InitGotCacheSize(base::OnceClosure callback,
CacheStorageError cache_create_error,
int cache_size);
- void InitGotCacheSizeAndPadding(base::OnceClosure callback,
- CacheStorageError cache_create_error,
- int64_t cache_size,
- int64_t cache_padding);
void DeleteBackendCompletedIO();
std::unique_ptr<storage::BlobDataHandle> PopulateResponseBody(
@@ -441,11 +387,7 @@
BackendState backend_state_ = BACKEND_UNINITIALIZED;
std::unique_ptr<CacheStorageScheduler> scheduler_;
bool initializing_ = false;
- // The actual cache size (not including padding).
int64_t cache_size_;
- int64_t cache_padding_ = 0;
- std::unique_ptr<crypto::SymmetricKey> cache_padding_key_;
- int64_t last_reported_size_ = 0;
size_t max_query_size_bytes_;
CacheStorageCacheObserver* cache_observer_;
« no previous file with comments | « content/browser/cache_storage/cache_storage.proto ('k') | content/browser/cache_storage/cache_storage_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698