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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 | 51 |
52 ServiceWorkerCacheStorage( | 52 ServiceWorkerCacheStorage( |
53 const base::FilePath& origin_path, | 53 const base::FilePath& origin_path, |
54 bool memory_only, | 54 bool memory_only, |
55 base::SequencedTaskRunner* cache_task_runner, | 55 base::SequencedTaskRunner* cache_task_runner, |
56 net::URLRequestContext* request_context, | 56 net::URLRequestContext* request_context, |
57 base::WeakPtr<storage::BlobStorageContext> blob_context); | 57 base::WeakPtr<storage::BlobStorageContext> blob_context); |
58 | 58 |
59 virtual ~ServiceWorkerCacheStorage(); | 59 virtual ~ServiceWorkerCacheStorage(); |
60 | 60 |
61 // Create a ServiceWorkerCache if it doesn't already exist and call the | |
62 // callback with the cache. If it already | |
63 // exists the callback is called with CACHE_STORAGE_ERROR_EXISTS. | |
64 void CreateCache(const std::string& cache_name, | |
65 const CacheAndErrorCallback& callback); | |
66 | |
67 // Get the cache for the given key. If not found returns | |
68 // CACHE_STORAGE_ERROR_NOT_FOUND. | |
69 void GetCache(const std::string& cache_name, | |
70 const CacheAndErrorCallback& callback); | |
71 | |
72 // Get the cache for the given key. If the cache is not found it is | 61 // Get the cache for the given key. If the cache is not found it is |
73 // created. | 62 // created. |
74 void OpenCache(const std::string& cache_name, | 63 void OpenCache(const std::string& cache_name, |
75 const CacheAndErrorCallback& callback); | 64 const CacheAndErrorCallback& callback); |
76 | 65 |
77 // Calls the callback with whether or not the cache exists. | 66 // Calls the callback with whether or not the cache exists. |
78 void HasCache(const std::string& cache_name, | 67 void HasCache(const std::string& cache_name, |
79 const BoolAndErrorCallback& callback); | 68 const BoolAndErrorCallback& callback); |
80 | 69 |
81 // Deletes the cache if it exists. If it doesn't exist, | 70 // Deletes the cache if it exists. If it doesn't exist, |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 scoped_ptr<CacheLoader> cache_loader_; | 140 scoped_ptr<CacheLoader> cache_loader_; |
152 | 141 |
153 base::WeakPtrFactory<ServiceWorkerCacheStorage> weak_factory_; | 142 base::WeakPtrFactory<ServiceWorkerCacheStorage> weak_factory_; |
154 | 143 |
155 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerCacheStorage); | 144 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerCacheStorage); |
156 }; | 145 }; |
157 | 146 |
158 } // namespace content | 147 } // namespace content |
159 | 148 |
160 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CACHE_STORAGE_H_ | 149 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CACHE_STORAGE_H_ |
OLD | NEW |