Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(931)

Unified Diff: content/browser/service_worker/service_worker_cache.h

Issue 460683002: Change threading in ServiceWorkerCacheStorage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: AsWeakPtr Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..3a7aea1394df4cc41df305992c9b099c605f0b63 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(
+ 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,8 @@ class ServiceWorkerCache {
int32 id() const { return id_; }
void set_id(int32 id) { id_ = id; }
+ base::WeakPtr<ServiceWorkerCache> AsWeakPtr();
+
private:
ServiceWorkerCache(const base::FilePath& path, const std::string& name);
@@ -43,6 +48,8 @@ class ServiceWorkerCache {
std::string name_;
int32 id_;
+ base::WeakPtrFactory<ServiceWorkerCache> weak_ptr_factory_;
+
DISALLOW_COPY_AND_ASSIGN(ServiceWorkerCache);
};

Powered by Google App Engine
This is Rietveld 408576698