Chromium Code Reviews| 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 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 13 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
| 14 #include "content/browser/cache_storage/cache_storage.h" | 14 #include "content/browser/cache_storage/cache_storage.h" |
| 15 #include "content/common/content_export.h" | 15 #include "content/common/content_export.h" |
| 16 #include "net/url_request/url_request_context_getter.h" | |
| 16 #include "storage/browser/quota/quota_client.h" | 17 #include "storage/browser/quota/quota_client.h" |
| 17 #include "url/gurl.h" | 18 #include "url/gurl.h" |
| 18 | 19 |
| 19 namespace base { | 20 namespace base { |
| 20 class SequencedTaskRunner; | 21 class SequencedTaskRunner; |
| 21 } | 22 } |
| 22 | 23 |
| 23 namespace net { | |
| 24 class URLRequestContext; | |
| 25 } | |
| 26 | |
| 27 namespace storage { | 24 namespace storage { |
| 28 class BlobStorageContext; | 25 class BlobStorageContext; |
| 29 class QuotaManagerProxy; | 26 class QuotaManagerProxy; |
| 30 } | 27 } |
| 31 | 28 |
| 32 namespace content { | 29 namespace content { |
| 33 | 30 |
| 34 class CacheStorageQuotaClient; | 31 class CacheStorageQuotaClient; |
| 35 | 32 |
| 36 // Keeps track of a CacheStorage per origin. There is one | 33 // Keeps track of a CacheStorage per origin. There is one |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 66 const std::string& cache_name, | 63 const std::string& cache_name, |
| 67 scoped_ptr<ServiceWorkerFetchRequest> request, | 64 scoped_ptr<ServiceWorkerFetchRequest> request, |
| 68 const CacheStorageCache::ResponseCallback& callback); | 65 const CacheStorageCache::ResponseCallback& callback); |
| 69 void MatchAllCaches(const GURL& origin, | 66 void MatchAllCaches(const GURL& origin, |
| 70 scoped_ptr<ServiceWorkerFetchRequest> request, | 67 scoped_ptr<ServiceWorkerFetchRequest> request, |
| 71 const CacheStorageCache::ResponseCallback& callback); | 68 const CacheStorageCache::ResponseCallback& callback); |
| 72 | 69 |
| 73 // This must be called before creating any of the public *Cache functions | 70 // This must be called before creating any of the public *Cache functions |
| 74 // above. | 71 // above. |
| 75 void SetBlobParametersForCache( | 72 void SetBlobParametersForCache( |
| 76 net::URLRequestContext* request_context, | 73 const scoped_refptr<net::URLRequestContextGetter>& request_context, |
|
mmenke
2015/06/10 17:00:31
include ref_counted.h
jkarlin
2015/06/10 18:26:03
Done.
| |
| 77 base::WeakPtr<storage::BlobStorageContext> blob_storage_context); | 74 base::WeakPtr<storage::BlobStorageContext> blob_storage_context); |
| 78 | 75 |
| 79 base::WeakPtr<CacheStorageManager> AsWeakPtr() { | 76 base::WeakPtr<CacheStorageManager> AsWeakPtr() { |
| 80 return weak_ptr_factory_.GetWeakPtr(); | 77 return weak_ptr_factory_.GetWeakPtr(); |
| 81 } | 78 } |
| 82 | 79 |
| 83 private: | 80 private: |
| 84 friend class CacheStorageQuotaClient; | 81 friend class CacheStorageQuotaClient; |
| 85 friend class CacheStorageManagerTest; | 82 friend class CacheStorageManagerTest; |
| 86 friend class CacheStorageMigrationTest; | 83 friend class CacheStorageMigrationTest; |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 103 const std::string& host, | 100 const std::string& host, |
| 104 const storage::QuotaClient::GetOriginsCallback& callback); | 101 const storage::QuotaClient::GetOriginsCallback& callback); |
| 105 void DeleteOriginData(const GURL& origin, | 102 void DeleteOriginData(const GURL& origin, |
| 106 const storage::QuotaClient::DeletionCallback& callback); | 103 const storage::QuotaClient::DeletionCallback& callback); |
| 107 static void DeleteOriginDidClose( | 104 static void DeleteOriginDidClose( |
| 108 const GURL& origin, | 105 const GURL& origin, |
| 109 const storage::QuotaClient::DeletionCallback& callback, | 106 const storage::QuotaClient::DeletionCallback& callback, |
| 110 scoped_ptr<CacheStorage> cache_storage, | 107 scoped_ptr<CacheStorage> cache_storage, |
| 111 base::WeakPtr<CacheStorageManager> cache_manager); | 108 base::WeakPtr<CacheStorageManager> cache_manager); |
| 112 | 109 |
| 113 net::URLRequestContext* url_request_context() const { | 110 scoped_refptr<net::URLRequestContextGetter> url_request_context() const { |
| 114 return request_context_; | 111 return request_context_; |
| 115 } | 112 } |
| 116 base::WeakPtr<storage::BlobStorageContext> blob_storage_context() const { | 113 base::WeakPtr<storage::BlobStorageContext> blob_storage_context() const { |
| 117 return blob_context_; | 114 return blob_context_; |
| 118 } | 115 } |
| 119 base::FilePath root_path() const { return root_path_; } | 116 base::FilePath root_path() const { return root_path_; } |
| 120 const scoped_refptr<base::SequencedTaskRunner>& cache_task_runner() const { | 117 const scoped_refptr<base::SequencedTaskRunner>& cache_task_runner() const { |
| 121 return cache_task_runner_; | 118 return cache_task_runner_; |
| 122 } | 119 } |
| 123 | 120 |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 140 | 137 |
| 141 base::FilePath root_path_; | 138 base::FilePath root_path_; |
| 142 scoped_refptr<base::SequencedTaskRunner> cache_task_runner_; | 139 scoped_refptr<base::SequencedTaskRunner> cache_task_runner_; |
| 143 | 140 |
| 144 scoped_refptr<storage::QuotaManagerProxy> quota_manager_proxy_; | 141 scoped_refptr<storage::QuotaManagerProxy> quota_manager_proxy_; |
| 145 | 142 |
| 146 // The map owns the CacheStorages and the CacheStorages are only accessed on | 143 // The map owns the CacheStorages and the CacheStorages are only accessed on |
| 147 // |cache_task_runner_|. | 144 // |cache_task_runner_|. |
| 148 CacheStorageMap cache_storage_map_; | 145 CacheStorageMap cache_storage_map_; |
| 149 | 146 |
| 150 net::URLRequestContext* request_context_; | 147 scoped_refptr<net::URLRequestContextGetter> request_context_; |
| 151 base::WeakPtr<storage::BlobStorageContext> blob_context_; | 148 base::WeakPtr<storage::BlobStorageContext> blob_context_; |
| 152 | 149 |
| 153 base::WeakPtrFactory<CacheStorageManager> weak_ptr_factory_; | 150 base::WeakPtrFactory<CacheStorageManager> weak_ptr_factory_; |
| 154 DISALLOW_COPY_AND_ASSIGN(CacheStorageManager); | 151 DISALLOW_COPY_AND_ASSIGN(CacheStorageManager); |
| 155 }; | 152 }; |
| 156 | 153 |
| 157 } // namespace content | 154 } // namespace content |
| 158 | 155 |
| 159 #endif // CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_MANAGER_H_ | 156 #endif // CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_MANAGER_H_ |
| OLD | NEW |