Chromium Code Reviews| Index: content/browser/service_worker/service_worker_storage.h |
| diff --git a/content/browser/service_worker/service_worker_storage.h b/content/browser/service_worker/service_worker_storage.h |
| index b3f1dbfaf69bace0dfe72297de346abbf7693335..0ec3d6357399945fb1965b648a37ed8c04367b20 100644 |
| --- a/content/browser/service_worker/service_worker_storage.h |
| +++ b/content/browser/service_worker/service_worker_storage.h |
| @@ -22,23 +22,15 @@ class QuotaManagerProxy; |
| namespace content { |
| class ServiceWorkerRegistration; |
| -class ServiceWorkerRegisterJob; |
| // This class provides an interface to load registration data and |
| -// instantiate ServiceWorkerRegistration objects. Any asynchronous |
| -// operations are run through instances of ServiceWorkerRegisterJob. |
| +// instantiate ServiceWorkerRegistration objects. |
| class CONTENT_EXPORT ServiceWorkerStorage { |
| public: |
| ServiceWorkerStorage(const base::FilePath& path, |
| quota::QuotaManagerProxy* quota_manager_proxy); |
| ~ServiceWorkerStorage(); |
| - typedef base::Callback<void(ServiceWorkerRegistrationStatus status, |
| - const scoped_refptr<ServiceWorkerRegistration>& |
| - registration)> RegistrationCallback; |
| - typedef base::Callback< |
| - void(ServiceWorkerRegistrationStatus status)> UnregistrationCallback; |
| - |
| // `found` is only valid if status == REGISTRATION_OK. |
| typedef base::Callback<void(bool found, |
| ServiceWorkerRegistrationStatus status, |
| @@ -50,20 +42,6 @@ class CONTENT_EXPORT ServiceWorkerStorage { |
| void FindRegistrationForPattern(const GURL& pattern, |
| const FindRegistrationCallback& callback); |
| - void Register(const GURL& pattern, |
| - const GURL& script_url, |
| - const RegistrationCallback& callback); |
| - |
| - void Unregister(const GURL& pattern, const UnregistrationCallback& callback); |
| - |
| - private: |
| - friend class ServiceWorkerRegisterJob; |
| - FRIEND_TEST_ALL_PREFIXES(ServiceWorkerStorageTest, PatternMatches); |
| - |
| - typedef std::map<GURL, scoped_refptr<ServiceWorkerRegistration> > |
| - PatternToRegistrationMap; |
| - typedef ScopedVector<ServiceWorkerRegisterJob> RegistrationJobList; |
| - |
| // TODO(alecflett): These are temporary internal methods providing |
| // synchronous in-memory registration. Eventually these will be |
| // replaced by asynchronous methods that persist registration to disk. |
| @@ -71,31 +49,23 @@ class CONTENT_EXPORT ServiceWorkerStorage { |
| const GURL& pattern, |
| const GURL& script_url); |
| void UnregisterInternal(const GURL& pattern); |
| - static bool PatternMatches(const GURL& pattern, const GURL& script_url); |
| - // Jobs are removed whenever they are finished or canceled. |
| - void EraseJob(ServiceWorkerRegisterJob* job); |
| + base::WeakPtr<ServiceWorkerStorage> AsWeakPtr() { |
| + return weak_factory_.GetWeakPtr(); |
| + } |
|
kinuko
2013/12/18 05:43:35
I don't think we should expose this as public AsWe
alecflett
2014/01/06 21:47:12
The real problem with SupportsWeakPtr is the odd o
kinuko
2014/01/08 06:19:10
I think I'm saying that I don't want to introduce
alecflett
2014/01/08 23:17:11
Ah I understand your preference now. the real reas
|
| - // Called at ServiceWorkerRegisterJob completion. |
| - void RegisterComplete(const RegistrationCallback& callback, |
| - ServiceWorkerRegisterJob* job, |
| - ServiceWorkerRegistrationStatus status, |
| - ServiceWorkerRegistration* registration); |
| + private: |
| + FRIEND_TEST_ALL_PREFIXES(ServiceWorkerStorageTest, PatternMatches); |
| - // Called at ServiceWorkerRegisterJob completion. |
| - void UnregisterComplete(const UnregistrationCallback& callback, |
| - ServiceWorkerRegisterJob* job, |
| - ServiceWorkerRegistrationStatus status, |
| - ServiceWorkerRegistration* registration); |
| + typedef std::map<GURL, scoped_refptr<ServiceWorkerRegistration> > |
| + PatternToRegistrationMap; |
| + |
| + static bool PatternMatches(const GURL& pattern, const GURL& script_url); |
| // This is the in-memory registration. Eventually the registration will be |
| // persisted to disk. |
| - // A list of currently running jobs. This is a temporary structure until we |
| - // start managing overlapping registrations explicitly. |
| - RegistrationJobList registration_jobs_; |
| - |
| - // in-memory map, to eventually be replaced with persistence |
| PatternToRegistrationMap registration_by_pattern_; |
|
kinuko
2013/12/18 05:43:35
I assume on-disk storage will have triplets like {
alecflett
2014/01/06 21:47:12
more or less - more likely something like a persis
|
| + |
| scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_; |
| base::FilePath path_; |
| base::WeakPtrFactory<ServiceWorkerStorage> weak_factory_; |