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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 // This must be called before creating any of the public *Cache functions | 76 // This must be called before creating any of the public *Cache functions |
77 // above. | 77 // above. |
78 void SetBlobParametersForCache( | 78 void SetBlobParametersForCache( |
79 const scoped_refptr<net::URLRequestContextGetter>& request_context_getter, | 79 const scoped_refptr<net::URLRequestContextGetter>& request_context_getter, |
80 base::WeakPtr<storage::BlobStorageContext> blob_storage_context); | 80 base::WeakPtr<storage::BlobStorageContext> blob_storage_context); |
81 | 81 |
82 base::WeakPtr<CacheStorageManager> AsWeakPtr() { | 82 base::WeakPtr<CacheStorageManager> AsWeakPtr() { |
83 return weak_ptr_factory_.GetWeakPtr(); | 83 return weak_ptr_factory_.GetWeakPtr(); |
84 } | 84 } |
85 | 85 |
| 86 base::FilePath root_path() const { return root_path_; } |
| 87 |
86 private: | 88 private: |
87 friend class CacheStorageContextImpl; | 89 friend class CacheStorageContextImpl; |
88 friend class CacheStorageManagerTest; | 90 friend class CacheStorageManagerTest; |
89 friend class CacheStorageMigrationTest; | 91 friend class CacheStorageMigrationTest; |
90 friend class CacheStorageQuotaClient; | 92 friend class CacheStorageQuotaClient; |
91 friend class MigratedLegacyCacheDirectoryNameTest; | |
92 | 93 |
93 typedef std::map<GURL, CacheStorage*> CacheStorageMap; | 94 typedef std::map<GURL, CacheStorage*> CacheStorageMap; |
94 | 95 |
95 CacheStorageManager( | 96 CacheStorageManager( |
96 const base::FilePath& path, | 97 const base::FilePath& path, |
97 const scoped_refptr<base::SequencedTaskRunner>& cache_task_runner, | 98 const scoped_refptr<base::SequencedTaskRunner>& cache_task_runner, |
98 const scoped_refptr<storage::QuotaManagerProxy>& quota_manager_proxy); | 99 const scoped_refptr<storage::QuotaManagerProxy>& quota_manager_proxy); |
99 | 100 |
100 // The returned CacheStorage* is owned by this manager. | 101 // The returned CacheStorage* is owned by this manager. |
101 CacheStorage* FindOrCreateCacheStorage(const GURL& origin); | 102 CacheStorage* FindOrCreateCacheStorage(const GURL& origin); |
(...skipping 13 matching lines...) Expand all Loading... |
115 static void DeleteOriginDidClose( | 116 static void DeleteOriginDidClose( |
116 const GURL& origin, | 117 const GURL& origin, |
117 const storage::QuotaClient::DeletionCallback& callback, | 118 const storage::QuotaClient::DeletionCallback& callback, |
118 scoped_ptr<CacheStorage> cache_storage, | 119 scoped_ptr<CacheStorage> cache_storage, |
119 base::WeakPtr<CacheStorageManager> cache_manager); | 120 base::WeakPtr<CacheStorageManager> cache_manager); |
120 | 121 |
121 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter() | 122 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter() |
122 const { | 123 const { |
123 return request_context_getter_; | 124 return request_context_getter_; |
124 } | 125 } |
| 126 |
125 base::WeakPtr<storage::BlobStorageContext> blob_storage_context() const { | 127 base::WeakPtr<storage::BlobStorageContext> blob_storage_context() const { |
126 return blob_context_; | 128 return blob_context_; |
127 } | 129 } |
128 base::FilePath root_path() const { return root_path_; } | 130 |
129 const scoped_refptr<base::SequencedTaskRunner>& cache_task_runner() const { | 131 const scoped_refptr<base::SequencedTaskRunner>& cache_task_runner() const { |
130 return cache_task_runner_; | 132 return cache_task_runner_; |
131 } | 133 } |
132 | 134 |
133 bool IsMemoryBacked() const { return root_path_.empty(); } | 135 bool IsMemoryBacked() const { return root_path_.empty(); } |
134 | 136 |
135 // Map a origin to the path. Exposed for testing. | 137 // Map a origin to the path. Exposed for testing. |
136 static base::FilePath ConstructLegacyOriginPath( | 138 static base::FilePath ConstructLegacyOriginPath( |
137 const base::FilePath& root_path, | 139 const base::FilePath& root_path, |
138 const GURL& origin); | 140 const GURL& origin); |
(...skipping 16 matching lines...) Expand all Loading... |
155 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; | 157 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; |
156 base::WeakPtr<storage::BlobStorageContext> blob_context_; | 158 base::WeakPtr<storage::BlobStorageContext> blob_context_; |
157 | 159 |
158 base::WeakPtrFactory<CacheStorageManager> weak_ptr_factory_; | 160 base::WeakPtrFactory<CacheStorageManager> weak_ptr_factory_; |
159 DISALLOW_COPY_AND_ASSIGN(CacheStorageManager); | 161 DISALLOW_COPY_AND_ASSIGN(CacheStorageManager); |
160 }; | 162 }; |
161 | 163 |
162 } // namespace content | 164 } // namespace content |
163 | 165 |
164 #endif // CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_MANAGER_H_ | 166 #endif // CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_MANAGER_H_ |
OLD | NEW |