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_MANAGER_H_ | 5 #ifndef CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_MANAGER_H_ |
6 #define CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_MANAGER_H_ | 6 #define CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 13 matching lines...) Expand all Loading... |
24 } | 24 } |
25 | 25 |
26 namespace storage { | 26 namespace storage { |
27 class BlobStorageContext; | 27 class BlobStorageContext; |
28 class QuotaManagerProxy; | 28 class QuotaManagerProxy; |
29 } | 29 } |
30 | 30 |
31 namespace content { | 31 namespace content { |
32 | 32 |
33 class CacheStorageQuotaClient; | 33 class CacheStorageQuotaClient; |
| 34 class MigratedLegacyCacheDirectoryNameTest; |
34 | 35 |
35 // Keeps track of a CacheStorage per origin. There is one | 36 // Keeps track of a CacheStorage per origin. There is one |
36 // CacheStorageManager per ServiceWorkerContextCore. | 37 // CacheStorageManager per ServiceWorkerContextCore. |
37 // TODO(jkarlin): Remove CacheStorage from memory once they're no | 38 // TODO(jkarlin): Remove CacheStorage from memory once they're no |
38 // longer in active use. | 39 // longer in active use. |
39 class CONTENT_EXPORT CacheStorageManager { | 40 class CONTENT_EXPORT CacheStorageManager { |
40 public: | 41 public: |
41 static scoped_ptr<CacheStorageManager> Create( | 42 static scoped_ptr<CacheStorageManager> Create( |
42 const base::FilePath& path, | 43 const base::FilePath& path, |
43 const scoped_refptr<base::SequencedTaskRunner>& cache_task_runner, | 44 const scoped_refptr<base::SequencedTaskRunner>& cache_task_runner, |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 | 82 |
82 base::WeakPtr<CacheStorageManager> AsWeakPtr() { | 83 base::WeakPtr<CacheStorageManager> AsWeakPtr() { |
83 return weak_ptr_factory_.GetWeakPtr(); | 84 return weak_ptr_factory_.GetWeakPtr(); |
84 } | 85 } |
85 | 86 |
86 private: | 87 private: |
87 friend class CacheStorageContextImpl; | 88 friend class CacheStorageContextImpl; |
88 friend class CacheStorageManagerTest; | 89 friend class CacheStorageManagerTest; |
89 friend class CacheStorageMigrationTest; | 90 friend class CacheStorageMigrationTest; |
90 friend class CacheStorageQuotaClient; | 91 friend class CacheStorageQuotaClient; |
| 92 friend class MigratedLegacyCacheDirectoryNameTest; |
91 | 93 |
92 typedef std::map<GURL, CacheStorage*> CacheStorageMap; | 94 typedef std::map<GURL, CacheStorage*> CacheStorageMap; |
93 | 95 |
94 CacheStorageManager( | 96 CacheStorageManager( |
95 const base::FilePath& path, | 97 const base::FilePath& path, |
96 const scoped_refptr<base::SequencedTaskRunner>& cache_task_runner, | 98 const scoped_refptr<base::SequencedTaskRunner>& cache_task_runner, |
97 const scoped_refptr<storage::QuotaManagerProxy>& quota_manager_proxy); | 99 const scoped_refptr<storage::QuotaManagerProxy>& quota_manager_proxy); |
98 | 100 |
99 // The returned CacheStorage* is owned by this manager. | 101 // The returned CacheStorage* is owned by this manager. |
100 CacheStorage* FindOrCreateCacheStorage(const GURL& origin); | 102 CacheStorage* FindOrCreateCacheStorage(const GURL& origin); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; | 156 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; |
155 base::WeakPtr<storage::BlobStorageContext> blob_context_; | 157 base::WeakPtr<storage::BlobStorageContext> blob_context_; |
156 | 158 |
157 base::WeakPtrFactory<CacheStorageManager> weak_ptr_factory_; | 159 base::WeakPtrFactory<CacheStorageManager> weak_ptr_factory_; |
158 DISALLOW_COPY_AND_ASSIGN(CacheStorageManager); | 160 DISALLOW_COPY_AND_ASSIGN(CacheStorageManager); |
159 }; | 161 }; |
160 | 162 |
161 } // namespace content | 163 } // namespace content |
162 | 164 |
163 #endif // CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_MANAGER_H_ | 165 #endif // CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_MANAGER_H_ |
OLD | NEW |