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> |
| 9 |
8 #include <vector> | 10 #include <vector> |
9 | 11 |
10 #include "base/callback.h" | 12 #include "base/callback.h" |
11 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
12 #include "base/id_map.h" | 14 #include "base/id_map.h" |
| 15 #include "base/macros.h" |
13 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
14 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
15 #include "content/common/cache_storage/cache_storage_types.h" | 18 #include "content/common/cache_storage/cache_storage_types.h" |
16 #include "content/common/service_worker/service_worker_types.h" | 19 #include "content/common/service_worker/service_worker_types.h" |
17 #include "net/disk_cache/disk_cache.h" | 20 #include "net/disk_cache/disk_cache.h" |
18 | 21 |
19 namespace net { | 22 namespace net { |
20 class URLRequestContextGetter; | 23 class URLRequestContextGetter; |
21 class IOBufferWithSize; | 24 class IOBufferWithSize; |
22 } | 25 } |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 // TODO(jkarlin): Have keys take an optional ServiceWorkerFetchRequest. | 101 // TODO(jkarlin): Have keys take an optional ServiceWorkerFetchRequest. |
99 // Returns CACHE_STORAGE_OK and a vector of requests if there are no errors. | 102 // Returns CACHE_STORAGE_OK and a vector of requests if there are no errors. |
100 void Keys(const RequestsCallback& callback); | 103 void Keys(const RequestsCallback& callback); |
101 | 104 |
102 // Closes the backend. Future operations that require the backend | 105 // Closes the backend. Future operations that require the backend |
103 // will exit early. Close should only be called once per CacheStorageCache. | 106 // will exit early. Close should only be called once per CacheStorageCache. |
104 void Close(const base::Closure& callback); | 107 void Close(const base::Closure& callback); |
105 | 108 |
106 // The size of the cache contents in memory. Returns 0 if the cache backend is | 109 // The size of the cache contents in memory. Returns 0 if the cache backend is |
107 // not a memory cache backend. | 110 // not a memory cache backend. |
108 int64 MemoryBackedSize() const; | 111 int64_t MemoryBackedSize() const; |
109 | 112 |
110 base::FilePath path() const { return path_; } | 113 base::FilePath path() const { return path_; } |
111 | 114 |
112 base::WeakPtr<CacheStorageCache> AsWeakPtr(); | 115 base::WeakPtr<CacheStorageCache> AsWeakPtr(); |
113 | 116 |
114 private: | 117 private: |
115 friend class base::RefCounted<CacheStorageCache>; | 118 friend class base::RefCounted<CacheStorageCache>; |
116 friend class TestCacheStorageCache; | 119 friend class TestCacheStorageCache; |
117 | 120 |
118 struct OpenAllEntriesContext; | 121 struct OpenAllEntriesContext; |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 bool memory_only_; | 278 bool memory_only_; |
276 | 279 |
277 base::WeakPtrFactory<CacheStorageCache> weak_ptr_factory_; | 280 base::WeakPtrFactory<CacheStorageCache> weak_ptr_factory_; |
278 | 281 |
279 DISALLOW_COPY_AND_ASSIGN(CacheStorageCache); | 282 DISALLOW_COPY_AND_ASSIGN(CacheStorageCache); |
280 }; | 283 }; |
281 | 284 |
282 } // namespace content | 285 } // namespace content |
283 | 286 |
284 #endif // CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_CACHE_H_ | 287 #endif // CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_CACHE_H_ |
OLD | NEW |