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

Side by Side Diff: content/browser/cache_storage/cache_storage_cache.h

Issue 2901083002: [CacheStorage] Pad and bin opaque resource sizes. (Closed)
Patch Set: Creating single padding key per session. Created 3 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_CACHE_H_ 5 #ifndef CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_CACHE_H_
6 #define CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_CACHE_H_ 6 #define CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_CACHE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/callback.h" 14 #include "base/callback.h"
15 #include "base/files/file_path.h" 15 #include "base/files/file_path.h"
16 #include "base/id_map.h" 16 #include "base/id_map.h"
17 #include "base/macros.h" 17 #include "base/macros.h"
18 #include "base/memory/weak_ptr.h" 18 #include "base/memory/weak_ptr.h"
19 #include "content/common/cache_storage/cache_storage_types.h" 19 #include "content/common/cache_storage/cache_storage_types.h"
20 #include "content/common/service_worker/service_worker_types.h" 20 #include "content/common/service_worker/service_worker_types.h"
21 #include "net/base/io_buffer.h" 21 #include "net/base/io_buffer.h"
22 #include "net/disk_cache/disk_cache.h" 22 #include "net/disk_cache/disk_cache.h"
23 #include "storage/common/quota/quota_status_code.h" 23 #include "storage/common/quota/quota_status_code.h"
24 24
25 namespace crypto {
26 class SymmetricKey;
27 }
28
25 namespace net { 29 namespace net {
26 class URLRequestContextGetter; 30 class URLRequestContextGetter;
27 } 31 }
28 32
29 namespace storage { 33 namespace storage {
30 class BlobDataHandle; 34 class BlobDataHandle;
31 class BlobStorageContext; 35 class BlobStorageContext;
32 class QuotaManagerProxy; 36 class QuotaManagerProxy;
33 } 37 }
34 38
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 using SizeCallback = base::Callback<void(int64_t)>; 71 using SizeCallback = base::Callback<void(int64_t)>;
68 72
69 enum EntryIndex { INDEX_HEADERS = 0, INDEX_RESPONSE_BODY, INDEX_SIDE_DATA }; 73 enum EntryIndex { INDEX_HEADERS = 0, INDEX_RESPONSE_BODY, INDEX_SIDE_DATA };
70 74
71 static std::unique_ptr<CacheStorageCache> CreateMemoryCache( 75 static std::unique_ptr<CacheStorageCache> CreateMemoryCache(
72 const GURL& origin, 76 const GURL& origin,
73 const std::string& cache_name, 77 const std::string& cache_name,
74 CacheStorage* cache_storage, 78 CacheStorage* cache_storage,
75 scoped_refptr<net::URLRequestContextGetter> request_context_getter, 79 scoped_refptr<net::URLRequestContextGetter> request_context_getter,
76 scoped_refptr<storage::QuotaManagerProxy> quota_manager_proxy, 80 scoped_refptr<storage::QuotaManagerProxy> quota_manager_proxy,
77 base::WeakPtr<storage::BlobStorageContext> blob_context); 81 base::WeakPtr<storage::BlobStorageContext> blob_context,
82 std::unique_ptr<crypto::SymmetricKey> cache_padding_key);
78 static std::unique_ptr<CacheStorageCache> CreatePersistentCache( 83 static std::unique_ptr<CacheStorageCache> CreatePersistentCache(
79 const GURL& origin, 84 const GURL& origin,
80 const std::string& cache_name, 85 const std::string& cache_name,
81 CacheStorage* cache_storage, 86 CacheStorage* cache_storage,
82 const base::FilePath& path, 87 const base::FilePath& path,
83 scoped_refptr<net::URLRequestContextGetter> request_context_getter, 88 scoped_refptr<net::URLRequestContextGetter> request_context_getter,
84 scoped_refptr<storage::QuotaManagerProxy> quota_manager_proxy, 89 scoped_refptr<storage::QuotaManagerProxy> quota_manager_proxy,
85 base::WeakPtr<storage::BlobStorageContext> blob_context, 90 base::WeakPtr<storage::BlobStorageContext> blob_context,
86 int64_t cache_size); 91 int64_t cache_size,
92 int64_t cache_padding,
93 std::unique_ptr<crypto::SymmetricKey> cache_padding_key);
94 static int64_t CalculateResponsePadding(
95 const ServiceWorkerResponse& response,
96 const crypto::SymmetricKey* padding_key);
87 97
88 // Returns ERROR_TYPE_NOT_FOUND if not found. 98 // Returns ERROR_TYPE_NOT_FOUND if not found.
89 void Match(std::unique_ptr<ServiceWorkerFetchRequest> request, 99 void Match(std::unique_ptr<ServiceWorkerFetchRequest> request,
90 const CacheStorageCacheQueryParams& match_params, 100 const CacheStorageCacheQueryParams& match_params,
91 const ResponseCallback& callback); 101 const ResponseCallback& callback);
92 102
93 // Returns CACHE_STORAGE_OK and matched responses in this cache. If there are 103 // Returns CACHE_STORAGE_OK and matched responses in this cache. If there are
94 // no responses, returns CACHE_STORAGE_OK and an empty vector. 104 // no responses, returns CACHE_STORAGE_OK and an empty vector.
95 void MatchAll(std::unique_ptr<ServiceWorkerFetchRequest> request, 105 void MatchAll(std::unique_ptr<ServiceWorkerFetchRequest> request,
96 const CacheStorageCacheQueryParams& match_params, 106 const CacheStorageCacheQueryParams& match_params,
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 163
154 // Async operations in progress will cancel and not run their callbacks. 164 // Async operations in progress will cancel and not run their callbacks.
155 virtual ~CacheStorageCache(); 165 virtual ~CacheStorageCache();
156 166
157 base::FilePath path() const { return path_; } 167 base::FilePath path() const { return path_; }
158 168
159 std::string cache_name() const { return cache_name_; } 169 std::string cache_name() const { return cache_name_; }
160 170
161 int64_t cache_size() const { return cache_size_; } 171 int64_t cache_size() const { return cache_size_; }
162 172
173 int64_t cache_padding() const { return cache_padding_; }
174
175 const crypto::SymmetricKey* cache_padding_key() const {
176 return cache_padding_key_.get();
177 }
178
179 // Return the total cache size (actual size + padding). If either is unknown
180 // then CacheStorage::kSizeUnknown is returned.
181 int64_t PaddedCacheSize() const;
182
163 // Set the one observer that will be notified of changes to this cache. 183 // Set the one observer that will be notified of changes to this cache.
164 // Note: Either the observer must have a lifetime longer than this instance 184 // Note: Either the observer must have a lifetime longer than this instance
165 // or call SetObserver(nullptr) to stop receiving notification of changes. 185 // or call SetObserver(nullptr) to stop receiving notification of changes.
166 void SetObserver(CacheStorageCacheObserver* observer); 186 void SetObserver(CacheStorageCacheObserver* observer);
167 187
168 base::WeakPtr<CacheStorageCache> AsWeakPtr(); 188 base::WeakPtr<CacheStorageCache> AsWeakPtr();
169 189
170 private: 190 private:
171 enum class QueryCacheType { REQUESTS, REQUESTS_AND_RESPONSES, CACHE_ENTRIES }; 191 // QueryCache types:
192 const uint32_t QUERY_CACHE_REQUESTS = 0x1;
jkarlin 2017/06/15 16:08:35 I'd prefer an enum (but not an enum class since th
cmumford 2017/06/20 18:22:04 Done.
193 const uint32_t QUERY_CACHE_RESPONSES_WITH_BODIES = 0x2;
194 const uint32_t QUERY_CACHE_RESPONSES_NO_BODIES = 0x4;
195 const uint32_t QUERY_CACHE_ENTRIES = 0x8;
172 196
173 // The backend progresses from uninitialized, to open, to closed, and cannot 197 // The backend progresses from uninitialized, to open, to closed, and cannot
174 // reverse direction. The open step may be skipped. 198 // reverse direction. The open step may be skipped.
175 enum BackendState { 199 enum BackendState {
176 BACKEND_UNINITIALIZED, // No backend, create backend on first operation. 200 BACKEND_UNINITIALIZED, // No backend, create backend on first operation.
177 BACKEND_OPEN, // Backend can be used. 201 BACKEND_OPEN, // Backend can be used.
178 BACKEND_CLOSED // Backend cannot be used. All ops should fail. 202 BACKEND_CLOSED // Backend cannot be used. All ops should fail.
179 }; 203 };
180 204
181 friend class base::RefCounted<CacheStorageCache>; 205 friend class base::RefCounted<CacheStorageCache>;
182 friend class TestCacheStorageCache; 206 friend class TestCacheStorageCache;
183 friend class CacheStorageCacheTest; 207 friend class CacheStorageCacheTest;
184 208
185 struct OpenAllEntriesContext; 209 struct OpenAllEntriesContext;
186 struct PutContext; 210 struct PutContext;
187 struct QueryCacheContext; 211 struct QueryCacheContext;
188 struct QueryCacheResult; 212 struct QueryCacheResult;
189 213
190 using QueryCacheResults = std::vector<QueryCacheResult>; 214 using QueryCacheResults = std::vector<QueryCacheResult>;
191 using QueryCacheCallback = 215 using QueryCacheCallback =
192 base::Callback<void(CacheStorageError, 216 base::Callback<void(CacheStorageError,
193 std::unique_ptr<QueryCacheResults>)>; 217 std::unique_ptr<QueryCacheResults>)>;
194 using Entries = std::vector<disk_cache::Entry*>; 218 using Entries = std::vector<disk_cache::Entry*>;
195 using ScopedBackendPtr = std::unique_ptr<disk_cache::Backend>; 219 using ScopedBackendPtr = std::unique_ptr<disk_cache::Backend>;
196 using BlobToDiskCacheIDMap = 220 using BlobToDiskCacheIDMap =
197 IDMap<std::unique_ptr<CacheStorageBlobToDiskCache>>; 221 IDMap<std::unique_ptr<CacheStorageBlobToDiskCache>>;
198 using OpenAllEntriesCallback = 222 using OpenAllEntriesCallback =
199 base::Callback<void(std::unique_ptr<OpenAllEntriesContext>, 223 base::Callback<void(std::unique_ptr<OpenAllEntriesContext>,
200 CacheStorageError)>; 224 CacheStorageError)>;
225 using SizePaddingCallback =
226 base::Callback<void(int64_t cache_size, int64_t cache_padding)>;
201 227
202 CacheStorageCache( 228 CacheStorageCache(
203 const GURL& origin, 229 const GURL& origin,
204 const std::string& cache_name, 230 const std::string& cache_name,
205 const base::FilePath& path, 231 const base::FilePath& path,
206 CacheStorage* cache_storage, 232 CacheStorage* cache_storage,
207 scoped_refptr<net::URLRequestContextGetter> request_context_getter, 233 scoped_refptr<net::URLRequestContextGetter> request_context_getter,
208 scoped_refptr<storage::QuotaManagerProxy> quota_manager_proxy, 234 scoped_refptr<storage::QuotaManagerProxy> quota_manager_proxy,
209 base::WeakPtr<storage::BlobStorageContext> blob_context, 235 base::WeakPtr<storage::BlobStorageContext> blob_context,
210 int64_t cache_size); 236 int64_t cache_size,
237 int64_t cache_padding,
238 std::unique_ptr<crypto::SymmetricKey> cache_padding_key);
211 239
212 // Returns all entries in this cache. 240 // Returns all entries in this cache.
213 void OpenAllEntries(const OpenAllEntriesCallback& callback); 241 void OpenAllEntries(const OpenAllEntriesCallback& callback);
214 void DidOpenNextEntry(std::unique_ptr<OpenAllEntriesContext> entries_context, 242 void DidOpenNextEntry(std::unique_ptr<OpenAllEntriesContext> entries_context,
215 const OpenAllEntriesCallback& callback, 243 const OpenAllEntriesCallback& callback,
216 int rv); 244 int rv);
217 245
218 // Runs |callback| with matching requests/response data. The data provided 246 // Runs |callback| with matching requests/response data. The data provided
219 // in the QueryCacheResults depends on the |query_type|. If |query_type| is 247 // in the QueryCacheResults depends on the |query_type|. If |query_type| is
220 // CACHE_ENTRIES then only out_entries is valid. If |query_type| is REQUESTS 248 // CACHE_ENTRIES then only out_entries is valid. If |query_type| is REQUESTS
221 // then only out_requests is valid. If |query_type| is 249 // then only out_requests is valid. If |query_type| is
222 // REQUESTS_AND_RESPONSES then only out_requests, out_responses, and 250 // REQUESTS_AND_RESPONSES then only out_requests, out_responses, and
223 // out_blob_data_handles are valid. 251 // out_blob_data_handles are valid.
224 void QueryCache(std::unique_ptr<ServiceWorkerFetchRequest> request, 252 void QueryCache(std::unique_ptr<ServiceWorkerFetchRequest> request,
225 const CacheStorageCacheQueryParams& options, 253 const CacheStorageCacheQueryParams& options,
226 QueryCacheType query_type, 254 uint32_t query_types,
227 const QueryCacheCallback& callback); 255 const QueryCacheCallback& callback);
228 void QueryCacheDidOpenFastPath( 256 void QueryCacheDidOpenFastPath(
229 std::unique_ptr<QueryCacheContext> query_cache_context, 257 std::unique_ptr<QueryCacheContext> query_cache_context,
230 int rv); 258 int rv);
231 void QueryCacheOpenNextEntry( 259 void QueryCacheOpenNextEntry(
232 std::unique_ptr<QueryCacheContext> query_cache_context); 260 std::unique_ptr<QueryCacheContext> query_cache_context);
233 void QueryCacheFilterEntry( 261 void QueryCacheFilterEntry(
234 std::unique_ptr<QueryCacheContext> query_cache_context, 262 std::unique_ptr<QueryCacheContext> query_cache_context,
235 int rv); 263 int rv);
236 void QueryCacheDidReadMetadata( 264 void QueryCacheDidReadMetadata(
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 disk_cache::ScopedEntryPtr entry, 326 disk_cache::ScopedEntryPtr entry,
299 int expected_bytes, 327 int expected_bytes,
300 int rv); 328 int rv);
301 329
302 // Puts the request and response object in the cache. The response body (if 330 // Puts the request and response object in the cache. The response body (if
303 // present) is stored in the cache, but not the request body. Returns OK on 331 // present) is stored in the cache, but not the request body. Returns OK on
304 // success. 332 // success.
305 void Put(const CacheStorageBatchOperation& operation, 333 void Put(const CacheStorageBatchOperation& operation,
306 const ErrorCallback& callback); 334 const ErrorCallback& callback);
307 void PutImpl(std::unique_ptr<PutContext> put_context); 335 void PutImpl(std::unique_ptr<PutContext> put_context);
308 void PutDidDoomEntry(std::unique_ptr<PutContext> put_context, int rv); 336 void PutDidDeleteEntry(std::unique_ptr<PutContext> put_context,
337 CacheStorageError error,
338 std::unique_ptr<QueryCacheResults> query_results);
309 void PutDidGetUsageAndQuota(std::unique_ptr<PutContext> put_context, 339 void PutDidGetUsageAndQuota(std::unique_ptr<PutContext> put_context,
310 storage::QuotaStatusCode status_code, 340 storage::QuotaStatusCode status_code,
311 int64_t usage, 341 int64_t usage,
312 int64_t quota); 342 int64_t quota);
313 void PutDidCreateEntry(std::unique_ptr<disk_cache::Entry*> entry_ptr, 343 void PutDidCreateEntry(std::unique_ptr<disk_cache::Entry*> entry_ptr,
314 std::unique_ptr<PutContext> put_context, 344 std::unique_ptr<PutContext> put_context,
315 int rv); 345 int rv);
316 void PutDidWriteHeaders(std::unique_ptr<PutContext> put_context, 346 void PutDidWriteHeaders(std::unique_ptr<PutContext> put_context,
317 int expected_bytes, 347 int expected_bytes,
318 int rv); 348 int rv);
319 void PutDidWriteBlobToCache(std::unique_ptr<PutContext> put_context, 349 void PutDidWriteBlobToCache(std::unique_ptr<PutContext> put_context,
320 BlobToDiskCacheIDMap::KeyType blob_to_cache_key, 350 BlobToDiskCacheIDMap::KeyType blob_to_cache_key,
321 disk_cache::ScopedEntryPtr entry, 351 disk_cache::ScopedEntryPtr entry,
322 bool success); 352 bool success);
323 353
324 // Asynchronously calculates the current cache size, notifies the quota 354 // Asynchronously calculates the current cache size, notifies the quota
325 // manager of any change from the last report, and sets cache_size_ to the new 355 // manager of any change from the last report, and sets cache_size_ to the new
326 // size. 356 // size.
327 void UpdateCacheSize(const base::Closure& callback); 357 void UpdateCacheSize(const base::Closure& callback);
328 void UpdateCacheSizeGotSize(std::unique_ptr<CacheStorageCacheHandle>, 358 void UpdateCacheSizeGotSize(std::unique_ptr<CacheStorageCacheHandle>,
329 const base::Closure& callback, 359 const base::Closure& callback,
330 int current_cache_size); 360 int current_cache_size);
331 361
332 // Returns ERROR_NOT_FOUND if not found. Otherwise deletes and returns OK. 362 // Returns ERROR_NOT_FOUND if not found. Otherwise deletes and returns OK.
333 void Delete(const CacheStorageBatchOperation& operation, 363 void Delete(const CacheStorageBatchOperation& operation,
334 const ErrorCallback& callback); 364 const ErrorCallback& callback);
335 void DeleteImpl(std::unique_ptr<ServiceWorkerFetchRequest> request, 365 void DeleteImpl(std::unique_ptr<ServiceWorkerFetchRequest> request,
336 const CacheStorageCacheQueryParams& match_params, 366 const CacheStorageCacheQueryParams& match_params,
337 const ErrorCallback& callback); 367 const QueryCacheCallback& callback);
338 void DeleteDidQueryCache( 368 void DeleteDidQueryCache(
339 const ErrorCallback& callback, 369 const QueryCacheCallback& callback,
340 CacheStorageError error, 370 CacheStorageError error,
341 std::unique_ptr<QueryCacheResults> query_cache_results); 371 std::unique_ptr<QueryCacheResults> query_cache_results);
372 void DeleteDidDelete(const ErrorCallback& callback,
373 CacheStorageError error,
374 std::unique_ptr<QueryCacheResults> query_results);
342 375
343 // Keys callbacks. 376 // Keys callbacks.
344 void KeysImpl(std::unique_ptr<ServiceWorkerFetchRequest> request, 377 void KeysImpl(std::unique_ptr<ServiceWorkerFetchRequest> request,
345 const CacheStorageCacheQueryParams& options, 378 const CacheStorageCacheQueryParams& options,
346 const RequestsCallback& callback); 379 const RequestsCallback& callback);
347 void KeysDidQueryCache( 380 void KeysDidQueryCache(
348 const RequestsCallback& callback, 381 const RequestsCallback& callback,
349 CacheStorageError error, 382 CacheStorageError error,
350 std::unique_ptr<QueryCacheResults> query_cache_results); 383 std::unique_ptr<QueryCacheResults> query_cache_results);
351 384
352 void CloseImpl(const base::Closure& callback); 385 void CloseImpl(const base::Closure& callback);
353 386
354 void SizeImpl(const SizeCallback& callback); 387 void SizeImpl(const SizeCallback& callback);
355 388
356 void GetSizeThenCloseDidGetSize(const SizeCallback& callback, 389 void GetSizeThenCloseDidGetSize(const SizeCallback& callback,
357 int64_t cache_size); 390 int64_t cache_size);
358 391
359 // Loads the backend and calls the callback with the result (true for 392 // Loads the backend and calls the callback with the result (true for
360 // success). The callback will always be called. Virtual for tests. 393 // success). The callback will always be called. Virtual for tests.
361 virtual void CreateBackend(const ErrorCallback& callback); 394 virtual void CreateBackend(const ErrorCallback& callback);
362 void CreateBackendDidCreate(const CacheStorageCache::ErrorCallback& callback, 395 void CreateBackendDidCreate(const CacheStorageCache::ErrorCallback& callback,
363 std::unique_ptr<ScopedBackendPtr> backend_ptr, 396 std::unique_ptr<ScopedBackendPtr> backend_ptr,
364 int rv); 397 int rv);
365 398
399 // Calculate the size and padding of the cache.
400 void CalculateCacheSizePadding(const SizePaddingCallback& callback);
401 void CalculateCacheSizePaddingGotSize(const SizePaddingCallback& callback,
402 int cache_size);
403 void PaddingDidQueryCache(
404 const SizePaddingCallback& callback,
405 int cache_size,
406 CacheStorageError error,
407 std::unique_ptr<QueryCacheResults> query_cache_results);
408
409 // Calculate the size (but not padding) of the cache.
410 void CalculateCacheSize(const net::CompletionCallback& callback);
411
366 void InitBackend(); 412 void InitBackend();
367 void InitDidCreateBackend(const base::Closure& callback, 413 void InitDidCreateBackend(const base::Closure& callback,
368 CacheStorageError cache_create_error); 414 CacheStorageError cache_create_error);
369 void InitGotCacheSize(const base::Closure& callback, 415 void InitGotCacheSize(const base::Closure& callback,
370 CacheStorageError cache_create_error, 416 CacheStorageError cache_create_error,
371 int cache_size); 417 int cache_size);
418 void InitGotCacheSizeAndPadding(const base::Closure& callback,
419 CacheStorageError cache_create_error,
420 int64_t cache_size,
421 int64_t cache_padding);
372 422
373 std::unique_ptr<storage::BlobDataHandle> PopulateResponseBody( 423 std::unique_ptr<storage::BlobDataHandle> PopulateResponseBody(
374 disk_cache::ScopedEntryPtr entry, 424 disk_cache::ScopedEntryPtr entry,
375 ServiceWorkerResponse* response); 425 ServiceWorkerResponse* response);
376 426
377 // Virtual for testing. 427 // Virtual for testing.
378 virtual std::unique_ptr<CacheStorageCacheHandle> CreateCacheHandle(); 428 virtual std::unique_ptr<CacheStorageCacheHandle> CreateCacheHandle();
379 429
380 // Be sure to check |backend_state_| before use. 430 // Be sure to check |backend_state_| before use.
381 std::unique_ptr<disk_cache::Backend> backend_; 431 std::unique_ptr<disk_cache::Backend> backend_;
382 432
383 GURL origin_; 433 GURL origin_;
384 const std::string cache_name_; 434 const std::string cache_name_;
385 base::FilePath path_; 435 base::FilePath path_;
386 436
387 // Raw pointer is safe because CacheStorage owns this object. 437 // Raw pointer is safe because CacheStorage owns this object.
388 CacheStorage* cache_storage_; 438 CacheStorage* cache_storage_;
389 439
390 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; 440 scoped_refptr<net::URLRequestContextGetter> request_context_getter_;
391 scoped_refptr<storage::QuotaManagerProxy> quota_manager_proxy_; 441 scoped_refptr<storage::QuotaManagerProxy> quota_manager_proxy_;
392 base::WeakPtr<storage::BlobStorageContext> blob_storage_context_; 442 base::WeakPtr<storage::BlobStorageContext> blob_storage_context_;
393 BackendState backend_state_ = BACKEND_UNINITIALIZED; 443 BackendState backend_state_ = BACKEND_UNINITIALIZED;
394 std::unique_ptr<CacheStorageScheduler> scheduler_; 444 std::unique_ptr<CacheStorageScheduler> scheduler_;
395 bool initializing_ = false; 445 bool initializing_ = false;
396 int64_t cache_size_; 446 int64_t cache_size_;
447 int64_t cache_padding_ = 0;
448 std::unique_ptr<crypto::SymmetricKey> cache_padding_key_;
449 int64_t last_reported_size_ = 0;
397 size_t max_query_size_bytes_; 450 size_t max_query_size_bytes_;
398 CacheStorageCacheObserver* cache_observer_; 451 CacheStorageCacheObserver* cache_observer_;
399 452
400 // Owns the elements of the list 453 // Owns the elements of the list
401 BlobToDiskCacheIDMap active_blob_to_disk_cache_writers_; 454 BlobToDiskCacheIDMap active_blob_to_disk_cache_writers_;
402 455
403 // Whether or not to store data in disk or memory. 456 // Whether or not to store data in disk or memory.
404 bool memory_only_; 457 bool memory_only_;
405 458
406 base::WeakPtrFactory<CacheStorageCache> weak_ptr_factory_; 459 base::WeakPtrFactory<CacheStorageCache> weak_ptr_factory_;
407 460
408 DISALLOW_COPY_AND_ASSIGN(CacheStorageCache); 461 DISALLOW_COPY_AND_ASSIGN(CacheStorageCache);
409 }; 462 };
410 463
411 } // namespace content 464 } // namespace content
412 465
413 #endif // CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_CACHE_H_ 466 #endif // CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_CACHE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698