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_CACHE_STORAGE_CACHE_STORAGE_CACHE_H_ | 5 #ifndef CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_CACHE_H_ |
6 #define CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_CACHE_H_ | 6 #define CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_CACHE_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 // Async operations in progress will cancel and not run their callbacks. | 153 // Async operations in progress will cancel and not run their callbacks. |
154 virtual ~CacheStorageCache(); | 154 virtual ~CacheStorageCache(); |
155 | 155 |
156 base::FilePath path() const { return path_; } | 156 base::FilePath path() const { return path_; } |
157 | 157 |
158 std::string cache_name() const { return cache_name_; } | 158 std::string cache_name() const { return cache_name_; } |
159 | 159 |
160 base::WeakPtr<CacheStorageCache> AsWeakPtr(); | 160 base::WeakPtr<CacheStorageCache> AsWeakPtr(); |
161 | 161 |
162 private: | 162 private: |
163 enum class QueryCacheType { REQUESTS_AND_RESPONSES, CACHE_ENTRIES }; | 163 enum class QueryCacheType { REQUESTS, REQUESTS_AND_RESPONSES, CACHE_ENTRIES }; |
164 | 164 |
165 friend class base::RefCounted<CacheStorageCache>; | 165 friend class base::RefCounted<CacheStorageCache>; |
166 friend class TestCacheStorageCache; | 166 friend class TestCacheStorageCache; |
167 | 167 |
168 struct OpenAllEntriesContext; | 168 struct OpenAllEntriesContext; |
169 struct PutContext; | 169 struct PutContext; |
170 | 170 |
171 // The backend progresses from uninitialized, to open, to closed, and cannot | 171 // The backend progresses from uninitialized, to open, to closed, and cannot |
172 // reverse direction. The open step may be skipped. | 172 // reverse direction. The open step may be skipped. |
173 enum BackendState { | 173 enum BackendState { |
(...skipping 20 matching lines...) Expand all Loading... |
194 base::WeakPtr<storage::BlobStorageContext> blob_context); | 194 base::WeakPtr<storage::BlobStorageContext> blob_context); |
195 | 195 |
196 // Returns all entries in this cache. | 196 // Returns all entries in this cache. |
197 void OpenAllEntries(const OpenAllEntriesCallback& callback); | 197 void OpenAllEntries(const OpenAllEntriesCallback& callback); |
198 void DidOpenNextEntry(std::unique_ptr<OpenAllEntriesContext> entries_context, | 198 void DidOpenNextEntry(std::unique_ptr<OpenAllEntriesContext> entries_context, |
199 const OpenAllEntriesCallback& callback, | 199 const OpenAllEntriesCallback& callback, |
200 int rv); | 200 int rv); |
201 | 201 |
202 // Runs |callback| with matching requests/response data. The data provided | 202 // Runs |callback| with matching requests/response data. The data provided |
203 // in the QueryCacheResults depends on the |query_type|. If |query_type| is | 203 // in the QueryCacheResults depends on the |query_type|. If |query_type| is |
204 // CACHE_ENTRIES then only out_entries is valid. If |query_type| is | 204 // CACHE_ENTRIES then only out_entries is valid. If |query_type| is REQUESTS |
| 205 // then only out_requests is valid. If |query_type| is |
205 // REQUESTS_AND_RESPONSES then only out_requests, out_responses, and | 206 // REQUESTS_AND_RESPONSES then only out_requests, out_responses, and |
206 // out_blob_data_handles are valid. | 207 // out_blob_data_handles are valid. |
207 void QueryCache(std::unique_ptr<ServiceWorkerFetchRequest> request, | 208 void QueryCache(std::unique_ptr<ServiceWorkerFetchRequest> request, |
208 const CacheStorageCacheQueryParams& options, | 209 const CacheStorageCacheQueryParams& options, |
209 QueryCacheType query_type, | 210 QueryCacheType query_type, |
210 const QueryCacheResultsCallback& callback); | 211 const QueryCacheResultsCallback& callback); |
211 void QueryCacheDidOpenEntry( | 212 void QueryCacheDidOpenEntry( |
212 std::unique_ptr<QueryCacheResults> query_cache_results, | 213 std::unique_ptr<QueryCacheResults> query_cache_results, |
213 std::unique_ptr<disk_cache::Entry*> entry, | 214 std::unique_ptr<disk_cache::Entry*> entry, |
214 int rv); | 215 int rv); |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 bool memory_only_; | 390 bool memory_only_; |
390 | 391 |
391 base::WeakPtrFactory<CacheStorageCache> weak_ptr_factory_; | 392 base::WeakPtrFactory<CacheStorageCache> weak_ptr_factory_; |
392 | 393 |
393 DISALLOW_COPY_AND_ASSIGN(CacheStorageCache); | 394 DISALLOW_COPY_AND_ASSIGN(CacheStorageCache); |
394 }; | 395 }; |
395 | 396 |
396 } // namespace content | 397 } // namespace content |
397 | 398 |
398 #endif // CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_CACHE_H_ | 399 #endif // CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_CACHE_H_ |
OLD | NEW |