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

Side by Side Diff: content/browser/cache_storage/cache_storage.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 unified diff | Download patch
« no previous file with comments | « content/browser/cache_storage/README.md ('k') | content/browser/cache_storage/cache_storage.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_H_ 5 #ifndef CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_H_
6 #define CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_H_ 6 #define CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
11 #include <memory> 11 #include <memory>
12 #include <string> 12 #include <string>
13 #include <vector> 13 #include <vector>
14 14
15 #include "base/callback.h" 15 #include "base/callback.h"
16 #include "base/files/file_path.h" 16 #include "base/files/file_path.h"
17 #include "base/gtest_prod_util.h"
18 #include "base/macros.h" 17 #include "base/macros.h"
19 #include "base/memory/ref_counted.h" 18 #include "base/memory/ref_counted.h"
20 #include "base/memory/weak_ptr.h" 19 #include "base/memory/weak_ptr.h"
21 #include "content/browser/cache_storage/cache_storage_cache.h" 20 #include "content/browser/cache_storage/cache_storage_cache.h"
22 #include "content/browser/cache_storage/cache_storage_cache_observer.h" 21 #include "content/browser/cache_storage/cache_storage_cache_observer.h"
23 22
24 namespace base { 23 namespace base {
25 class SequencedTaskRunner; 24 class SequencedTaskRunner;
26 } 25 }
27 26
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 // The size of all of the origin's contents. This value should be used as an 112 // The size of all of the origin's contents. This value should be used as an
114 // estimate only since the cache may be modified at any time. 113 // estimate only since the cache may be modified at any time.
115 void Size(SizeCallback callback); 114 void Size(SizeCallback callback);
116 115
117 // The functions below are for tests to verify that the operations run 116 // The functions below are for tests to verify that the operations run
118 // serially. 117 // serially.
119 void StartAsyncOperationForTesting(); 118 void StartAsyncOperationForTesting();
120 void CompleteAsyncOperationForTesting(); 119 void CompleteAsyncOperationForTesting();
121 120
122 // CacheStorageCacheObserver: 121 // CacheStorageCacheObserver:
123 void CacheSizeUpdated(const CacheStorageCache* cache) override; 122 void CacheSizeUpdated(const CacheStorageCache* cache, int64_t size) override;
124 123
125 private: 124 private:
126 friend class CacheStorageCacheHandle; 125 friend class CacheStorageCacheHandle;
127 friend class CacheStorageCache; 126 friend class CacheStorageCache;
128 friend class CacheStorageManagerTest; 127 friend class CacheStorageManagerTest;
129 FRIEND_TEST_ALL_PREFIXES(CacheStorageManagerTest, PersistedCacheKeyUsed);
130 class CacheLoader; 128 class CacheLoader;
131 class MemoryLoader; 129 class MemoryLoader;
132 class SimpleCacheLoader; 130 class SimpleCacheLoader;
133 struct CacheMatchResponse; 131 struct CacheMatchResponse;
134 132
135 typedef std::map<std::string, std::unique_ptr<CacheStorageCache>> CacheMap; 133 typedef std::map<std::string, std::unique_ptr<CacheStorageCache>> CacheMap;
136 134
137 // Generate a new padding key. For testing only and *not thread safe*.
138 static void GenerateNewKeyForTesting();
139
140 // Functions for exposing handles to CacheStorageCache to clients. 135 // Functions for exposing handles to CacheStorageCache to clients.
141 std::unique_ptr<CacheStorageCacheHandle> CreateCacheHandle( 136 std::unique_ptr<CacheStorageCacheHandle> CreateCacheHandle(
142 CacheStorageCache* cache); 137 CacheStorageCache* cache);
143 void AddCacheHandleRef(CacheStorageCache* cache); 138 void AddCacheHandleRef(CacheStorageCache* cache);
144 void DropCacheHandleRef(CacheStorageCache* cache); 139 void DropCacheHandleRef(CacheStorageCache* cache);
145 140
146 // Returns a CacheStorageCacheHandle for the given name if the name is known. 141 // Returns a CacheStorageCacheHandle for the given name if the name is known.
147 // If the CacheStorageCache has been deleted, creates a new one. 142 // If the CacheStorageCache has been deleted, creates a new one.
148 std::unique_ptr<CacheStorageCacheHandle> GetLoadedCache( 143 std::unique_ptr<CacheStorageCacheHandle> GetLoadedCache(
149 const std::string& cache_name); 144 const std::string& cache_name);
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 base::CancelableClosure index_write_task_; 264 base::CancelableClosure index_write_task_;
270 265
271 base::WeakPtrFactory<CacheStorage> weak_factory_; 266 base::WeakPtrFactory<CacheStorage> weak_factory_;
272 267
273 DISALLOW_COPY_AND_ASSIGN(CacheStorage); 268 DISALLOW_COPY_AND_ASSIGN(CacheStorage);
274 }; 269 };
275 270
276 } // namespace content 271 } // namespace content
277 272
278 #endif // CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_H_ 273 #endif // CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_H_
OLDNEW
« no previous file with comments | « content/browser/cache_storage/README.md ('k') | content/browser/cache_storage/cache_storage.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698