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

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

Issue 512743002: Guarantee ServiceWorkerCacheStorage::LazyInit calls its callback (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@loader_weak
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
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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 class CacheLoader; 96 class CacheLoader;
97 struct CacheContext; 97 struct CacheContext;
98 98
99 typedef std::map<CacheID, CacheContext*> CacheMap; 99 typedef std::map<CacheID, CacheContext*> CacheMap;
100 typedef std::map<std::string, CacheID> NameMap; 100 typedef std::map<std::string, CacheID> NameMap;
101 101
102 CacheContext* GetLoadedCache(const std::string& cache_name) const; 102 CacheContext* GetLoadedCache(const std::string& cache_name) const;
103 103
104 // Initializer and its callback are below. 104 // Initializer and its callback are below.
105 void LazyInit(const base::Closure& closure); 105 void LazyInit(const base::Closure& closure);
106 void LazyInitDidLoadIndex( 106 static void LazyInitDidLoadIndex(
107 const base::Closure& callback, 107 const base::Closure& callback,
108 base::WeakPtr<ServiceWorkerCacheStorage> storage,
108 scoped_ptr<std::vector<std::string> > indexed_cache_names); 109 scoped_ptr<std::vector<std::string> > indexed_cache_names);
109 void LazyInitIterateAndLoadCacheName( 110 static void LazyInitIterateAndLoadCacheName(
110 const base::Closure& callback, 111 const base::Closure& callback,
112 base::WeakPtr<ServiceWorkerCacheStorage> storage,
111 scoped_ptr<std::vector<std::string> > indexed_cache_names, 113 scoped_ptr<std::vector<std::string> > indexed_cache_names,
112 const std::vector<std::string>::const_iterator& iter, 114 const std::vector<std::string>::const_iterator& iter,
113 const std::string& cache_name, 115 const std::string& cache_name,
114 scoped_ptr<ServiceWorkerCache> cache); 116 scoped_ptr<ServiceWorkerCache> cache);
115 void LazyInitDone(); 117 static void LazyInitDone(base::WeakPtr<ServiceWorkerCacheStorage> storage);
116 118
117 void DidCreateBackend(base::WeakPtr<ServiceWorkerCache> cache, 119 void DidCreateBackend(base::WeakPtr<ServiceWorkerCache> cache,
118 CacheID cache_id, 120 CacheID cache_id,
119 const CacheAndErrorCallback& callback, 121 const CacheAndErrorCallback& callback,
120 ServiceWorkerCache::ErrorType error); 122 ServiceWorkerCache::ErrorType error);
121 123
122 CacheContext* AddCacheToMaps(const std::string& cache_name, 124 CacheContext* AddCacheToMaps(const std::string& cache_name,
123 scoped_ptr<ServiceWorkerCache> cache); 125 scoped_ptr<ServiceWorkerCache> cache);
124 126
125 // The CreateCache callbacks are below. 127 // The CreateCache callbacks are below.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 scoped_refptr<CacheLoader> cache_loader_; 165 scoped_refptr<CacheLoader> cache_loader_;
164 166
165 base::WeakPtrFactory<ServiceWorkerCacheStorage> weak_factory_; 167 base::WeakPtrFactory<ServiceWorkerCacheStorage> weak_factory_;
166 168
167 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerCacheStorage); 169 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerCacheStorage);
168 }; 170 };
169 171
170 } // namespace content 172 } // namespace content
171 173
172 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CACHE_STORAGE_H_ 174 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CACHE_STORAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698