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 <list> | 8 #include <vector> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "content/common/cache_storage/cache_storage_types.h" | 14 #include "content/common/cache_storage/cache_storage_types.h" |
15 #include "content/common/service_worker/service_worker_types.h" | 15 #include "content/common/service_worker/service_worker_types.h" |
16 #include "net/base/completion_callback.h" | |
17 #include "net/disk_cache/disk_cache.h" | 16 #include "net/disk_cache/disk_cache.h" |
18 | 17 |
19 namespace net { | 18 namespace net { |
20 class URLRequestContext; | 19 class URLRequestContext; |
21 class IOBufferWithSize; | 20 class IOBufferWithSize; |
22 } | 21 } |
23 | 22 |
24 namespace storage { | 23 namespace storage { |
25 class BlobDataBuilder; | |
26 class BlobDataHandle; | 24 class BlobDataHandle; |
27 class BlobStorageContext; | 25 class BlobStorageContext; |
28 class QuotaManagerProxy; | 26 class QuotaManagerProxy; |
29 } | 27 } |
30 | 28 |
31 namespace content { | 29 namespace content { |
32 class ChromeBlobStorageContext; | 30 |
33 class CacheMetadata; | 31 class CacheMetadata; |
34 class CacheStorageScheduler; | 32 class CacheStorageScheduler; |
35 class TestCacheStorageCache; | 33 class TestCacheStorageCache; |
36 | 34 |
37 // Represents a ServiceWorker Cache as seen in | 35 // Represents a ServiceWorker Cache as seen in |
38 // https://slightlyoff.github.io/ServiceWorker/spec/service_worker/ | 36 // https://slightlyoff.github.io/ServiceWorker/spec/service_worker/ |
39 // The asynchronous methods are executed serially. Callbacks to the | 37 // The asynchronous methods are executed serially. Callbacks to the |
40 // public functions will be called so long as the cache object lives. | 38 // public functions will be called so long as the cache object lives. |
41 class CONTENT_EXPORT CacheStorageCache | 39 class CONTENT_EXPORT CacheStorageCache |
42 : public base::RefCounted<CacheStorageCache> { | 40 : public base::RefCounted<CacheStorageCache> { |
43 public: | 41 public: |
44 // This enum is used in histograms, so do not change the ordering and always | 42 // This enum is used in histograms, so do not change the ordering and always |
45 // append new types to the end. | 43 // append new types to the end. |
46 enum ErrorType { | 44 enum ErrorType { |
47 ERROR_TYPE_OK = 0, | 45 ERROR_TYPE_OK = 0, |
48 ERROR_TYPE_EXISTS, | 46 ERROR_TYPE_EXISTS, |
49 ERROR_TYPE_STORAGE, | 47 ERROR_TYPE_STORAGE, |
50 ERROR_TYPE_NOT_FOUND, | 48 ERROR_TYPE_NOT_FOUND, |
51 ERROR_TYPE_LAST = ERROR_TYPE_NOT_FOUND | 49 ERROR_TYPE_LAST = ERROR_TYPE_NOT_FOUND |
52 }; | 50 }; |
53 | 51 |
54 enum EntryIndex { INDEX_HEADERS = 0, INDEX_RESPONSE_BODY }; | |
55 typedef base::Callback<void(ErrorType)> ErrorCallback; | 52 typedef base::Callback<void(ErrorType)> ErrorCallback; |
56 typedef base::Callback<void(ErrorType, | 53 typedef base::Callback<void(ErrorType, |
57 scoped_ptr<ServiceWorkerResponse>, | 54 scoped_ptr<ServiceWorkerResponse>, |
58 scoped_ptr<storage::BlobDataHandle>)> | 55 scoped_ptr<storage::BlobDataHandle>)> |
59 ResponseCallback; | 56 ResponseCallback; |
60 typedef std::vector<ServiceWorkerFetchRequest> Requests; | 57 typedef std::vector<ServiceWorkerFetchRequest> Requests; |
61 typedef base::Callback<void(ErrorType, scoped_ptr<Requests>)> | 58 typedef base::Callback<void(ErrorType, scoped_ptr<Requests>)> |
62 RequestsCallback; | 59 RequestsCallback; |
63 | 60 |
64 static scoped_refptr<CacheStorageCache> CreateMemoryCache( | 61 static scoped_refptr<CacheStorageCache> CreateMemoryCache( |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 bool memory_only_; | 211 bool memory_only_; |
215 | 212 |
216 base::WeakPtrFactory<CacheStorageCache> weak_ptr_factory_; | 213 base::WeakPtrFactory<CacheStorageCache> weak_ptr_factory_; |
217 | 214 |
218 DISALLOW_COPY_AND_ASSIGN(CacheStorageCache); | 215 DISALLOW_COPY_AND_ASSIGN(CacheStorageCache); |
219 }; | 216 }; |
220 | 217 |
221 } // namespace content | 218 } // namespace content |
222 | 219 |
223 #endif // CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_CACHE_H_ | 220 #endif // CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_CACHE_H_ |
OLD | NEW |