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

Side by Side Diff: content/browser/service_worker/service_worker_cache_storage.h

Issue 511893002: Guarantees ServiceWorkerCacheStorage callbacks are called. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@guarantee_init
Patch Set: Rebase Created 6 years, 3 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/service_worker/service_worker_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_SERVICE_WORKER_SERVICE_WORKER_CACHE_STORAGE_H_ 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CACHE_STORAGE_H_
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CACHE_STORAGE_H_ 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CACHE_STORAGE_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 scoped_ptr<std::vector<std::string> > indexed_cache_names); 109 scoped_ptr<std::vector<std::string> > indexed_cache_names);
110 static void LazyInitIterateAndLoadCacheName( 110 static void LazyInitIterateAndLoadCacheName(
111 const base::Closure& callback, 111 const base::Closure& callback,
112 base::WeakPtr<ServiceWorkerCacheStorage> storage, 112 base::WeakPtr<ServiceWorkerCacheStorage> storage,
113 scoped_ptr<std::vector<std::string> > indexed_cache_names, 113 scoped_ptr<std::vector<std::string> > indexed_cache_names,
114 const std::vector<std::string>::const_iterator& iter, 114 const std::vector<std::string>::const_iterator& iter,
115 const std::string& cache_name, 115 const std::string& cache_name,
116 scoped_ptr<ServiceWorkerCache> cache); 116 scoped_ptr<ServiceWorkerCache> cache);
117 static void LazyInitDone(base::WeakPtr<ServiceWorkerCacheStorage> storage); 117 static void LazyInitDone(base::WeakPtr<ServiceWorkerCacheStorage> storage);
118 118
119 void DidCreateBackend(base::WeakPtr<ServiceWorkerCache> cache, 119 static void DidCreateBackend(base::WeakPtr<ServiceWorkerCache> cache,
120 CacheID cache_id, 120 CacheID cache_id,
121 const CacheAndErrorCallback& callback, 121 const CacheAndErrorCallback& callback,
122 ServiceWorkerCache::ErrorType error); 122 ServiceWorkerCache::ErrorType error);
123 123
124 CacheContext* AddCacheToMaps(const std::string& cache_name, 124 CacheContext* AddCacheToMaps(const std::string& cache_name,
125 scoped_ptr<ServiceWorkerCache> cache); 125 scoped_ptr<ServiceWorkerCache> cache);
126 126
127 // The CreateCache callbacks are below. 127 // The CreateCache callbacks are below.
128 void CreateCacheDidCreateCache(const std::string& cache_name, 128 static void CreateCacheDidCreateCache(
129 const CacheAndErrorCallback& callback, 129 const std::string& cache_name,
130 scoped_ptr<ServiceWorkerCache> cache); 130 const CacheAndErrorCallback& callback,
131 void CreateCacheDidWriteIndex(const CacheAndErrorCallback& callback, 131 base::WeakPtr<ServiceWorkerCacheStorage> storage,
132 base::WeakPtr<ServiceWorkerCache> cache, 132 scoped_ptr<ServiceWorkerCache> cache);
133 CacheID id, 133 static void CreateCacheDidWriteIndex(const CacheAndErrorCallback& callback,
134 bool success); 134 base::WeakPtr<ServiceWorkerCache> cache,
135 CacheID id,
136 bool success);
135 137
136 // The DeleteCache callbacks are below. 138 // The DeleteCache callbacks are below.
137 void DeleteCacheDidWriteIndex(const std::string& cache_name, 139 static void DeleteCacheDidWriteIndex(
138 const BoolAndErrorCallback& callback, 140 const std::string& cache_name,
139 bool success); 141 const BoolAndErrorCallback& callback,
140 void DeleteCacheDidCleanUp(const BoolAndErrorCallback& callback, 142 base::WeakPtr<ServiceWorkerCacheStorage> storage,
141 bool success); 143 bool success);
144 static void DeleteCacheDidCleanUp(const BoolAndErrorCallback& callback,
145 bool success);
142 146
143 // Whether or not we've loaded the list of cache names into memory. 147 // Whether or not we've loaded the list of cache names into memory.
144 bool initialized_; 148 bool initialized_;
145 149
146 // The list of operations waiting on initialization. 150 // The list of operations waiting on initialization.
147 std::vector<base::Closure> init_callbacks_; 151 std::vector<base::Closure> init_callbacks_;
148 152
149 // The map of CacheIDs to their CacheContext objects. Owns the CacheContext 153 // The map of CacheIDs to their CacheContext objects. Owns the CacheContext
150 // object. The CacheIDs are used by JavaScript to reference a 154 // object. The CacheIDs are used by JavaScript to reference a
151 // ServiceWorkerCache. 155 // ServiceWorkerCache.
(...skipping 13 matching lines...) Expand all
165 scoped_refptr<CacheLoader> cache_loader_; 169 scoped_refptr<CacheLoader> cache_loader_;
166 170
167 base::WeakPtrFactory<ServiceWorkerCacheStorage> weak_factory_; 171 base::WeakPtrFactory<ServiceWorkerCacheStorage> weak_factory_;
168 172
169 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerCacheStorage); 173 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerCacheStorage);
170 }; 174 };
171 175
172 } // namespace content 176 } // namespace content
173 177
174 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CACHE_STORAGE_H_ 178 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CACHE_STORAGE_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/service_worker/service_worker_cache_storage.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698