Index: content/browser/service_worker/service_worker_cache_quota_client.h |
diff --git a/content/browser/service_worker/service_worker_quota_client.h b/content/browser/service_worker/service_worker_cache_quota_client.h |
similarity index 52% |
copy from content/browser/service_worker/service_worker_quota_client.h |
copy to content/browser/service_worker/service_worker_cache_quota_client.h |
index 7b69b45c38737ede03e32821adfbef08d6d585f7..65ab01832c4016ee99f938053cb794473cb086c3 100644 |
--- a/content/browser/service_worker/service_worker_quota_client.h |
+++ b/content/browser/service_worker/service_worker_cache_quota_client.h |
@@ -2,24 +2,35 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_QUOTA_CLIENT_H_ |
-#define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_QUOTA_CLIENT_H_ |
+#ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CACHE_QUOTA_CLIENT_H_ |
+#define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CACHE_QUOTA_CLIENT_H_ |
-#include "base/memory/ref_counted.h" |
+#include "base/memory/weak_ptr.h" |
#include "content/common/content_export.h" |
#include "storage/browser/quota/quota_client.h" |
+#include "storage/common/quota/quota_types.h" |
+ |
+namespace storage { |
+class QuotaManagerProxy; |
+} |
namespace content { |
-class ServiceWorkerContextWrapper; |
+class ServiceWorkerCacheStorageManager; |
-class ServiceWorkerQuotaClient : public storage::QuotaClient { |
+// ServiceWorkerCacheQuotaClient is owned by the QuotaManager. There is one per |
+// ServiceWorkerCacheStorageManager, and therefore one per |
+// ServiceWorkerContextCore. |
+class CONTENT_EXPORT ServiceWorkerCacheQuotaClient |
+ : public storage::QuotaClient { |
public: |
- virtual ~ServiceWorkerQuotaClient(); |
+ explicit ServiceWorkerCacheQuotaClient( |
+ base::WeakPtr<ServiceWorkerCacheStorageManager> cache_manager); |
+ virtual ~ServiceWorkerCacheQuotaClient(); |
- // QuotaClient method overrides |
+ // QuotaClient overrides |
virtual ID id() const override; |
virtual void OnQuotaManagerDestroyed() override; |
- virtual void GetOriginUsage(const GURL& origin, |
+ virtual void GetOriginUsage(const GURL& origin_url, |
storage::StorageType type, |
const GetUsageCallback& callback) override; |
virtual void GetOriginsForType(storage::StorageType type, |
@@ -33,17 +44,11 @@ class ServiceWorkerQuotaClient : public storage::QuotaClient { |
virtual bool DoesSupport(storage::StorageType type) const override; |
private: |
- friend class ServiceWorkerContextWrapper; |
- friend class ServiceWorkerQuotaClientTest; |
- |
- CONTENT_EXPORT explicit ServiceWorkerQuotaClient( |
- ServiceWorkerContextWrapper* context); |
- |
- scoped_refptr<ServiceWorkerContextWrapper> context_; |
+ base::WeakPtr<ServiceWorkerCacheStorageManager> cache_manager_; |
- DISALLOW_COPY_AND_ASSIGN(ServiceWorkerQuotaClient); |
+ DISALLOW_COPY_AND_ASSIGN(ServiceWorkerCacheQuotaClient); |
}; |
} // namespace content |
-#endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_QUOTA_CLIENT_H_ |
+#endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CACHE_QUOTA_CLIENT_H_ |