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_H_ | 5 #ifndef CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_H_ |
6 #define CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_H_ | 6 #define CONTENT_BROWSER_CACHE_STORAGE_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/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "content/browser/cache_storage/cache_storage_cache.h" | 14 #include "content/browser/cache_storage/cache_storage_cache.h" |
15 | 15 |
16 namespace base { | 16 namespace base { |
17 class SequencedTaskRunner; | 17 class SequencedTaskRunner; |
18 } | 18 } |
19 | 19 |
20 namespace net { | 20 namespace net { |
21 class URLRequestContext; | 21 class URLRequestContextGetter; |
22 } | 22 } |
23 | 23 |
24 namespace storage { | 24 namespace storage { |
25 class BlobStorageContext; | 25 class BlobStorageContext; |
26 } | 26 } |
27 | 27 |
28 namespace content { | 28 namespace content { |
29 class CacheStorageScheduler; | 29 class CacheStorageScheduler; |
30 | 30 |
31 // TODO(jkarlin): Constrain the total bytes used per origin. | 31 // TODO(jkarlin): Constrain the total bytes used per origin. |
32 | 32 |
33 // CacheStorage holds the set of caches for a given origin. It is | 33 // CacheStorage holds the set of caches for a given origin. It is |
34 // owned by the CacheStorageManager. This class expects to be run | 34 // owned by the CacheStorageManager. This class expects to be run |
35 // on the IO thread. The asynchronous methods are executed serially. | 35 // on the IO thread. The asynchronous methods are executed serially. |
36 class CONTENT_EXPORT CacheStorage { | 36 class CONTENT_EXPORT CacheStorage { |
37 public: | 37 public: |
38 typedef std::vector<std::string> StringVector; | 38 typedef std::vector<std::string> StringVector; |
39 typedef base::Callback<void(bool, CacheStorageError)> BoolAndErrorCallback; | 39 typedef base::Callback<void(bool, CacheStorageError)> BoolAndErrorCallback; |
40 typedef base::Callback<void(const scoped_refptr<CacheStorageCache>&, | 40 typedef base::Callback<void(const scoped_refptr<CacheStorageCache>&, |
41 CacheStorageError)> CacheAndErrorCallback; | 41 CacheStorageError)> CacheAndErrorCallback; |
42 typedef base::Callback<void(const StringVector&, CacheStorageError)> | 42 typedef base::Callback<void(const StringVector&, CacheStorageError)> |
43 StringsAndErrorCallback; | 43 StringsAndErrorCallback; |
44 | 44 |
45 static const char kIndexFileName[]; | 45 static const char kIndexFileName[]; |
46 | 46 |
47 CacheStorage( | 47 CacheStorage( |
48 const base::FilePath& origin_path, | 48 const base::FilePath& origin_path, |
49 bool memory_only, | 49 bool memory_only, |
50 base::SequencedTaskRunner* cache_task_runner, | 50 base::SequencedTaskRunner* cache_task_runner, |
51 net::URLRequestContext* request_context, | 51 const scoped_refptr<net::URLRequestContextGetter>& request_context, |
mmenke
2015/06/10 17:00:31
include ref_counted.h
mmenke
2015/06/10 17:00:31
Goes for the entire CL: Know it's done elsewhere,
jkarlin
2015/06/10 18:26:03
Done.
jkarlin
2015/06/10 18:26:03
Done.
| |
52 const scoped_refptr<storage::QuotaManagerProxy>& quota_manager_proxy, | 52 const scoped_refptr<storage::QuotaManagerProxy>& quota_manager_proxy, |
53 base::WeakPtr<storage::BlobStorageContext> blob_context, | 53 base::WeakPtr<storage::BlobStorageContext> blob_context, |
54 const GURL& origin); | 54 const GURL& origin); |
55 | 55 |
56 // Any unfinished asynchronous operations may not complete or call their | 56 // Any unfinished asynchronous operations may not complete or call their |
57 // callbacks. | 57 // callbacks. |
58 virtual ~CacheStorage(); | 58 virtual ~CacheStorage(); |
59 | 59 |
60 // Get the cache for the given key. If the cache is not found it is | 60 // Get the cache for the given key. If the cache is not found it is |
61 // created. | 61 // created. |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
217 scoped_ptr<CacheLoader> cache_loader_; | 217 scoped_ptr<CacheLoader> cache_loader_; |
218 | 218 |
219 base::WeakPtrFactory<CacheStorage> weak_factory_; | 219 base::WeakPtrFactory<CacheStorage> weak_factory_; |
220 | 220 |
221 DISALLOW_COPY_AND_ASSIGN(CacheStorage); | 221 DISALLOW_COPY_AND_ASSIGN(CacheStorage); |
222 }; | 222 }; |
223 | 223 |
224 } // namespace content | 224 } // namespace content |
225 | 225 |
226 #endif // CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_H_ | 226 #endif // CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_H_ |
OLD | NEW |