| 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 385450d3554df6e5f12f602b51f3de3eb3ab5c76..a9e8f458c4603132d8aef729659eeb30f550f3ed 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> {
|
| 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(
|
| @@ -77,18 +81,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_;
|
| }
|
| @@ -100,9 +120,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_;
|
|
|