OLD | NEW |
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 Loading... |
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 Loading... |
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_ |
OLD | NEW |