Index: content/browser/service_worker/service_worker_cache_storage_manager.h |
diff --git a/content/browser/service_worker/service_worker_cache_storage_manager.h b/content/browser/service_worker/service_worker_cache_storage_manager.h |
index 0a04db551155bc8c80cf3d03b15f41a8d688f70e..abaede471b56c80ed34c64df6f894d5252eec58e 100644 |
--- a/content/browser/service_worker/service_worker_cache_storage_manager.h |
+++ b/content/browser/service_worker/service_worker_cache_storage_manager.h |
@@ -12,6 +12,7 @@ |
#include "base/files/file_path.h" |
#include "content/browser/service_worker/service_worker_cache_storage.h" |
#include "content/common/content_export.h" |
+#include "storage/browser/quota/quota_client.h" |
#include "url/gurl.h" |
namespace base { |
@@ -24,25 +25,28 @@ class URLRequestContext; |
namespace storage { |
class BlobStorageContext; |
+class QuotaManagerProxy; |
} |
namespace content { |
+class ServiceWorkerCacheQuotaClient; |
+ |
// Keeps track of a ServiceWorkerCacheStorage per origin. There is one |
// ServiceWorkerCacheStorageManager per ServiceWorkerContextCore. |
// TODO(jkarlin): Remove ServiceWorkerCacheStorage from memory once they're no |
// longer in active use. |
-class CONTENT_EXPORT ServiceWorkerCacheStorageManager { |
+class CONTENT_EXPORT ServiceWorkerCacheStorageManager |
+ : public base::RefCounted<ServiceWorkerCacheStorageManager> { |
falken
2014/10/17 02:27:15
If there's one SWCacheStorageManager per SWContext
jkarlin
2014/10/17 15:07:08
Done.
The QuotaClient must survive until the Quo
|
public: |
- static scoped_ptr<ServiceWorkerCacheStorageManager> Create( |
+ static scoped_refptr<ServiceWorkerCacheStorageManager> Create( |
const base::FilePath& path, |
- const scoped_refptr<base::SequencedTaskRunner>& cache_task_runner); |
+ const scoped_refptr<base::SequencedTaskRunner>& cache_task_runner, |
+ storage::QuotaManagerProxy* quota_manager_proxy); |
- static scoped_ptr<ServiceWorkerCacheStorageManager> Create( |
+ static scoped_refptr<ServiceWorkerCacheStorageManager> Create( |
ServiceWorkerCacheStorageManager* old_manager); |
- virtual ~ServiceWorkerCacheStorageManager(); |
- |
// Methods to support the CacheStorage spec. These methods call the |
// corresponding ServiceWorkerCacheStorage method on the appropriate thread. |
void CreateCache( |
@@ -73,18 +77,34 @@ class CONTENT_EXPORT ServiceWorkerCacheStorageManager { |
base::WeakPtr<storage::BlobStorageContext> blob_storage_context); |
private: |
+ friend class base::RefCounted<ServiceWorkerCacheStorageManager>; |
+ friend class ServiceWorkerCacheQuotaClient; |
+ |
typedef std::map<GURL, ServiceWorkerCacheStorage*> |
ServiceWorkerCacheStorageMap; |
ServiceWorkerCacheStorageManager( |
const base::FilePath& path, |
- const scoped_refptr<base::SequencedTaskRunner>& cache_task_runner); |
+ const scoped_refptr<base::SequencedTaskRunner>& cache_task_runner, |
+ storage::QuotaManagerProxy* quota_manager_proxy); |
+ |
+ virtual ~ServiceWorkerCacheStorageManager(); |
// The returned ServiceWorkerCacheStorage* is owned by |
// service_worker_cache_storages_. |
ServiceWorkerCacheStorage* FindOrCreateServiceWorkerCacheManager( |
const GURL& origin); |
+ // QuotaClient support |
+ void GetOriginUsage(const GURL& origin_url, |
+ const storage::QuotaClient::GetUsageCallback& callback); |
+ void GetOrigins(const storage::QuotaClient::GetOriginsCallback& callback); |
+ void GetOriginsForHost( |
+ const std::string& host, |
+ const storage::QuotaClient::GetOriginsCallback& callback); |
+ void DeleteOriginData(const GURL& origin, |
+ const storage::QuotaClient::DeletionCallback& callback); |
+ |
net::URLRequestContext* url_request_context() const { |
return request_context_; |
} |
@@ -96,9 +116,13 @@ class CONTENT_EXPORT ServiceWorkerCacheStorageManager { |
return cache_task_runner_; |
} |
+ bool IsMemoryBackend() const { return root_path_.empty(); } |
+ |
base::FilePath root_path_; |
scoped_refptr<base::SequencedTaskRunner> cache_task_runner_; |
+ scoped_refptr<storage::QuotaManagerProxy> quota_manager_proxy_; |
+ |
// The map owns the CacheStorages and the CacheStorages are only accessed on |
// |cache_task_runner_|. |
ServiceWorkerCacheStorageMap cache_storage_map_; |