Chromium Code Reviews| 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 |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 13 #include "base/id_map.h" | 13 #include "base/id_map.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "content/browser/service_worker/service_worker_cache.h" | |
| 15 | 16 |
| 16 namespace base { | 17 namespace base { |
| 17 class SequencedTaskRunner; | 18 class SequencedTaskRunner; |
| 18 } | 19 } |
| 19 | 20 |
| 20 namespace net { | 21 namespace net { |
| 21 class URLRequestContext; | 22 class URLRequestContext; |
| 22 } | 23 } |
| 23 | 24 |
| 24 namespace webkit_blob { | 25 namespace webkit_blob { |
| 25 class BlobStorageContext; | 26 class BlobStorageContext; |
| 26 } | 27 } |
| 27 | 28 |
| 28 namespace content { | 29 namespace content { |
| 29 class ServiceWorkerCache; | 30 class ChromeBlobStorageContext; |
|
michaeln
2014/08/14 22:59:01
is this needed?
jkarlin
2014/08/15 11:49:44
Done.
| |
| 30 | 31 |
| 31 // TODO(jkarlin): Constrain the total bytes used per origin. | 32 // TODO(jkarlin): Constrain the total bytes used per origin. |
| 32 | 33 |
| 33 // ServiceWorkerCacheStorage holds the set of caches for a given origin. It is | 34 // ServiceWorkerCacheStorage holds the set of caches for a given origin. It is |
| 34 // owned by the ServiceWorkerCacheStorageManager. This class expects to be run | 35 // owned by the ServiceWorkerCacheStorageManager. This class expects to be run |
| 35 // on the IO thread. | 36 // on the IO thread. |
| 36 class ServiceWorkerCacheStorage { | 37 class ServiceWorkerCacheStorage { |
| 37 public: | 38 public: |
| 38 enum CacheStorageError { | 39 enum CacheStorageError { |
| 39 CACHE_STORAGE_ERROR_NO_ERROR, | 40 CACHE_STORAGE_ERROR_NO_ERROR, |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 101 scoped_ptr<std::vector<std::string> > indexed_cache_names); | 102 scoped_ptr<std::vector<std::string> > indexed_cache_names); |
| 102 void LazyInitIterateAndLoadCacheName( | 103 void LazyInitIterateAndLoadCacheName( |
| 103 const base::Closure& callback, | 104 const base::Closure& callback, |
| 104 scoped_ptr<std::vector<std::string> > indexed_cache_names, | 105 scoped_ptr<std::vector<std::string> > indexed_cache_names, |
| 105 const std::vector<std::string>::const_iterator& iter, | 106 const std::vector<std::string>::const_iterator& iter, |
| 106 scoped_ptr<ServiceWorkerCache> cache); | 107 scoped_ptr<ServiceWorkerCache> cache); |
| 107 void LazyInitDone(); | 108 void LazyInitDone(); |
| 108 | 109 |
| 109 void DidCreateBackend(base::WeakPtr<ServiceWorkerCache> cache, | 110 void DidCreateBackend(base::WeakPtr<ServiceWorkerCache> cache, |
| 110 const CacheAndErrorCallback& callback, | 111 const CacheAndErrorCallback& callback, |
| 111 bool success); | 112 ServiceWorkerCache::ErrorType error); |
| 112 | 113 |
| 113 void AddCacheToMaps(scoped_ptr<ServiceWorkerCache> cache); | 114 void AddCacheToMaps(scoped_ptr<ServiceWorkerCache> cache); |
| 114 | 115 |
| 115 // The CreateCache callbacks are below. | 116 // The CreateCache callbacks are below. |
| 116 void CreateCacheDidCreateCache(const std::string& cache_name, | 117 void CreateCacheDidCreateCache(const std::string& cache_name, |
| 117 const CacheAndErrorCallback& callback, | 118 const CacheAndErrorCallback& callback, |
| 118 scoped_ptr<ServiceWorkerCache> cache); | 119 scoped_ptr<ServiceWorkerCache> cache); |
| 119 void CreateCacheDidWriteIndex(const CacheAndErrorCallback& callback, | 120 void CreateCacheDidWriteIndex(const CacheAndErrorCallback& callback, |
| 120 base::WeakPtr<ServiceWorkerCache> cache, | 121 base::WeakPtr<ServiceWorkerCache> cache, |
| 121 bool success); | 122 bool success); |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 150 scoped_refptr<CacheLoader> cache_loader_; | 151 scoped_refptr<CacheLoader> cache_loader_; |
| 151 | 152 |
| 152 base::WeakPtrFactory<ServiceWorkerCacheStorage> weak_factory_; | 153 base::WeakPtrFactory<ServiceWorkerCacheStorage> weak_factory_; |
| 153 | 154 |
| 154 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerCacheStorage); | 155 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerCacheStorage); |
| 155 }; | 156 }; |
| 156 | 157 |
| 157 } // namespace content | 158 } // namespace content |
| 158 | 159 |
| 159 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CACHE_STORAGE_H_ | 160 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CACHE_STORAGE_H_ |
| OLD | NEW |