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

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

Issue 2040173002: [CacheStorage] Clean up CacheStorageCache lifetimes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Simplify and caught one more reference Created 4 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
« no previous file with comments | « no previous file | 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>
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 void LazyInitDidLoadIndex( 131 void LazyInitDidLoadIndex(
132 std::unique_ptr<std::vector<std::string>> indexed_cache_names); 132 std::unique_ptr<std::vector<std::string>> indexed_cache_names);
133 133
134 // The Open and CreateCache callbacks are below. 134 // The Open and CreateCache callbacks are below.
135 void OpenCacheImpl(const std::string& cache_name, 135 void OpenCacheImpl(const std::string& cache_name,
136 const CacheAndErrorCallback& callback); 136 const CacheAndErrorCallback& callback);
137 void CreateCacheDidCreateCache(const std::string& cache_name, 137 void CreateCacheDidCreateCache(const std::string& cache_name,
138 const CacheAndErrorCallback& callback, 138 const CacheAndErrorCallback& callback,
139 scoped_refptr<CacheStorageCache> cache); 139 scoped_refptr<CacheStorageCache> cache);
140 void CreateCacheDidWriteIndex(const CacheAndErrorCallback& callback, 140 void CreateCacheDidWriteIndex(const CacheAndErrorCallback& callback,
141 scoped_refptr<CacheStorageCache> cache,
142 bool success); 141 bool success);
143 142
144 // The HasCache callbacks are below. 143 // The HasCache callbacks are below.
145 void HasCacheImpl(const std::string& cache_name, 144 void HasCacheImpl(const std::string& cache_name,
146 const BoolAndErrorCallback& callback); 145 const BoolAndErrorCallback& callback);
147 146
148 // The DeleteCache callbacks are below. 147 // The DeleteCache callbacks are below.
149 void DeleteCacheImpl(const std::string& cache_name, 148 void DeleteCacheImpl(const std::string& cache_name,
150 const BoolAndErrorCallback& callback); 149 const BoolAndErrorCallback& callback);
151 150
152 void DeleteCacheDidClose(const std::string& cache_name, 151 void DeleteCacheDidClose(const std::string& cache_name,
153 const BoolAndErrorCallback& callback, 152 const BoolAndErrorCallback& callback,
154 const StringVector& ordered_cache_names, 153 const StringVector& ordered_cache_names,
155 scoped_refptr<CacheStorageCache> cache,
156 int64_t cache_size); 154 int64_t cache_size);
157 void DeleteCacheDidWriteIndex(const std::string& cache_name, 155 void DeleteCacheDidWriteIndex(const std::string& cache_name,
158 const BoolAndErrorCallback& callback, 156 const BoolAndErrorCallback& callback,
159 int cache_size, 157 int cache_size,
160 bool success); 158 bool success);
161 void DeleteCacheDidCleanUp(const BoolAndErrorCallback& callback, 159 void DeleteCacheDidCleanUp(const BoolAndErrorCallback& callback,
162 bool success); 160 bool success);
163 161
164 // The EnumerateCache callbacks are below. 162 // The EnumerateCache callbacks are below.
165 void EnumerateCachesImpl(const StringsAndErrorCallback& callback); 163 void EnumerateCachesImpl(const StringsAndErrorCallback& callback);
166 164
167 // The MatchCache callbacks are below. 165 // The MatchCache callbacks are below.
168 void MatchCacheImpl(const std::string& cache_name, 166 void MatchCacheImpl(const std::string& cache_name,
169 std::unique_ptr<ServiceWorkerFetchRequest> request, 167 std::unique_ptr<ServiceWorkerFetchRequest> request,
170 const CacheStorageCache::ResponseCallback& callback); 168 const CacheStorageCache::ResponseCallback& callback);
171 void MatchCacheDidMatch(scoped_refptr<CacheStorageCache> cache, 169 void MatchCacheDidMatch(const CacheStorageCache::ResponseCallback& callback,
172 const CacheStorageCache::ResponseCallback& callback,
173 CacheStorageError error, 170 CacheStorageError error,
174 std::unique_ptr<ServiceWorkerResponse> response, 171 std::unique_ptr<ServiceWorkerResponse> response,
175 std::unique_ptr<storage::BlobDataHandle> handle); 172 std::unique_ptr<storage::BlobDataHandle> handle);
176 173
177 // The MatchAllCaches callbacks are below. 174 // The MatchAllCaches callbacks are below.
178 void MatchAllCachesImpl(std::unique_ptr<ServiceWorkerFetchRequest> request, 175 void MatchAllCachesImpl(std::unique_ptr<ServiceWorkerFetchRequest> request,
179 const CacheStorageCache::ResponseCallback& callback); 176 const CacheStorageCache::ResponseCallback& callback);
180 void MatchAllCachesDidMatch( 177 void MatchAllCachesDidMatch(
181 scoped_refptr<CacheStorageCache> cache,
182 CacheMatchResponse* out_match_response, 178 CacheMatchResponse* out_match_response,
183 const base::Closure& barrier_closure, 179 const base::Closure& barrier_closure,
184 CacheStorageError error, 180 CacheStorageError error,
185 std::unique_ptr<ServiceWorkerResponse> service_worker_response, 181 std::unique_ptr<ServiceWorkerResponse> service_worker_response,
186 std::unique_ptr<storage::BlobDataHandle> handle); 182 std::unique_ptr<storage::BlobDataHandle> handle);
187 void MatchAllCachesDidMatchAll( 183 void MatchAllCachesDidMatchAll(
188 std::unique_ptr<std::vector<CacheMatchResponse>> match_responses, 184 std::unique_ptr<std::vector<CacheMatchResponse>> match_responses,
189 const CacheStorageCache::ResponseCallback& callback); 185 const CacheStorageCache::ResponseCallback& callback);
190 186
191 void GetSizeThenCloseAllCachesImpl(const SizeCallback& callback); 187 void GetSizeThenCloseAllCachesImpl(const SizeCallback& callback);
192 188
193 void SizeImpl(const SizeCallback& callback); 189 void SizeImpl(const SizeCallback& callback);
190 void SizeRetrievedFromAllCaches(std::unique_ptr<int64_t> accumulator,
191 const CacheStorage::SizeCallback& callback);
194 192
195 void PendingClosure(const base::Closure& callback); 193 void PendingClosure(const base::Closure& callback);
196 void PendingBoolAndErrorCallback(const BoolAndErrorCallback& callback, 194 void PendingBoolAndErrorCallback(const BoolAndErrorCallback& callback,
197 bool found, 195 bool found,
198 CacheStorageError error); 196 CacheStorageError error);
199 void PendingCacheAndErrorCallback(const CacheAndErrorCallback& callback, 197 void PendingCacheAndErrorCallback(const CacheAndErrorCallback& callback,
200 scoped_refptr<CacheStorageCache> cache, 198 scoped_refptr<CacheStorageCache> cache,
201 CacheStorageError error); 199 CacheStorageError error);
202 void PendingStringsAndErrorCallback(const StringsAndErrorCallback& callback, 200 void PendingStringsAndErrorCallback(const StringsAndErrorCallback& callback,
203 const StringVector& strings, 201 const StringVector& strings,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 // without having the open the cache again. 234 // without having the open the cache again.
237 std::map<const CacheStorageCache*, scoped_refptr<CacheStorageCache>> 235 std::map<const CacheStorageCache*, scoped_refptr<CacheStorageCache>>
238 preserved_caches_; 236 preserved_caches_;
239 237
240 // The quota manager. 238 // The quota manager.
241 scoped_refptr<storage::QuotaManagerProxy> quota_manager_proxy_; 239 scoped_refptr<storage::QuotaManagerProxy> quota_manager_proxy_;
242 240
243 // The origin that this CacheStorage is associated with. 241 // The origin that this CacheStorage is associated with.
244 GURL origin_; 242 GURL origin_;
245 243
244 // Used to keep caches alive during async operations.
245 scoped_refptr<CacheStorageCache> callback_cache_;
246 std::vector<scoped_refptr<CacheStorageCache>> callback_caches_;
247
246 base::WeakPtrFactory<CacheStorage> weak_factory_; 248 base::WeakPtrFactory<CacheStorage> weak_factory_;
247 249
248 DISALLOW_COPY_AND_ASSIGN(CacheStorage); 250 DISALLOW_COPY_AND_ASSIGN(CacheStorage);
249 }; 251 };
250 252
251 } // namespace content 253 } // namespace content
252 254
253 #endif // CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_H_ 255 #endif // CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/cache_storage/cache_storage.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698