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

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

Issue 424863002: Fill in some of ServiceWorkerFetchStores. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cache_storage
Patch Set: Updated license 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_fetch_store.h
diff --git a/content/browser/service_worker/service_worker_fetch_store.h b/content/browser/service_worker/service_worker_fetch_store.h
new file mode 100644
index 0000000000000000000000000000000000000000..fb3854590c8f95aa8568b8904b393533a67173af
--- /dev/null
+++ b/content/browser/service_worker/service_worker_fetch_store.h
@@ -0,0 +1,52 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// 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_FETCH_STORE_H_
+#define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_FETCH_STORE_H_
+
+#include "base/callback.h"
+#include "base/files/file_path.h"
+
+namespace content {
+
+// TODO(jkarlin): Fill this in with a real FetchStore implementation as
+// specified in
+// https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html.
+// TODO(jkarlin): Unload store backend from memory once the store object is no
+// longer referenced in javascript.
+
+// Represents a ServiceWorker FetchStore as seen in
+// https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html.
+// InitializeIfNeeded must be called before calling the other public members.
+class ServiceWorkerFetchStore {
+ public:
+ static ServiceWorkerFetchStore* CreateMemoryStore(const std::string& name);
+ static ServiceWorkerFetchStore* CreatePersistentStore(
+ const base::FilePath& path,
+ const std::string& name);
+ virtual ~ServiceWorkerFetchStore();
+
+ // Loads the backend and calls the callback with the result (true for
+ // success). This must be called before member functions that require a
+ // backend are called.
+ void CreateBackend(const base::Callback<void(bool)>& callback);
+
+ void set_name(const std::string& name) { name_ = name; }
+ const std::string& name() const { return name_; }
+ int32 id() const { return id_; }
+ void set_id(int32 id) { id_ = id; }
+
+ private:
+ ServiceWorkerFetchStore(const base::FilePath& path, const std::string& name);
+
+ base::FilePath path_;
+ std::string name_;
+ int32 id_;
+
+ DISALLOW_COPY_AND_ASSIGN(ServiceWorkerFetchStore);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_FETCH_STORE_H_

Powered by Google App Engine
This is Rietveld 408576698