Chromium Code Reviews| Index: content/browser/service_worker/service_worker_cache.h |
| diff --git a/content/browser/service_worker/service_worker_cache.h b/content/browser/service_worker/service_worker_cache.h |
| index d8709690f22e8362bb9f04e524dbd50432c8d0ed..0b715d659d3eb230a62885cf8cc296cc81777114 100644 |
| --- a/content/browser/service_worker/service_worker_cache.h |
| +++ b/content/browser/service_worker/service_worker_cache.h |
| @@ -7,6 +7,7 @@ |
| #include "base/callback.h" |
| #include "base/files/file_path.h" |
| +#include "base/memory/weak_ptr.h" |
| namespace content { |
| @@ -21,9 +22,11 @@ namespace content { |
| // InitializeIfNeeded must be called before calling the other public members. |
| class ServiceWorkerCache { |
| public: |
| - static ServiceWorkerCache* CreateMemoryCache(const std::string& name); |
| - static ServiceWorkerCache* CreatePersistentCache(const base::FilePath& path, |
| - const std::string& name); |
| + static scoped_ptr<ServiceWorkerCache> CreateMemoryCache( |
|
michaeln
2014/08/12 23:34:32
nice change on the rv types
jkarlin
2014/08/12 23:52:55
Acknowledged.
|
| + const std::string& name); |
| + static scoped_ptr<ServiceWorkerCache> CreatePersistentCache( |
| + const base::FilePath& path, |
| + const std::string& name); |
| virtual ~ServiceWorkerCache(); |
| // Loads the backend and calls the callback with the result (true for |
| @@ -36,6 +39,10 @@ class ServiceWorkerCache { |
| int32 id() const { return id_; } |
| void set_id(int32 id) { id_ = id; } |
| + base::WeakPtr<ServiceWorkerCache> GetWeakPtr() { |
|
michaeln
2014/08/12 23:34:32
typicically a methods on classes that vend weakptr
jkarlin
2014/08/12 23:52:55
Done.
|
| + return weak_ptr_factory_.GetWeakPtr(); |
| + } |
| + |
| private: |
| ServiceWorkerCache(const base::FilePath& path, const std::string& name); |
| @@ -43,6 +50,8 @@ class ServiceWorkerCache { |
| std::string name_; |
| int32 id_; |
| + base::WeakPtrFactory<ServiceWorkerCache> weak_ptr_factory_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(ServiceWorkerCache); |
| }; |