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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_FETCH_STORE_H_
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_FETCH_STORE_H_
7
8 #include "base/callback.h"
9 #include "base/files/file_path.h"
10
11 namespace content {
12
13 // TODO(jkarlin): Fill this in with a real FetchStore implementation as
14 // specified in
15 // https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html.
16 // TODO(jkarlin): Unload store backend from memory once the store object is no
17 // longer referenced in javascript.
18
19 // Represents a ServiceWorker FetchStore as seen in
20 // https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html.
21 // InitializeIfNeeded must be called before calling the other public members.
22 class ServiceWorkerFetchStore {
23 public:
24 static ServiceWorkerFetchStore* CreateMemoryStore(const std::string& name);
25 static ServiceWorkerFetchStore* CreatePersistentStore(
26 const base::FilePath& path,
27 const std::string& name);
28 virtual ~ServiceWorkerFetchStore();
29
30 // Loads the backend and calls the callback with the result (true for
31 // success). This must be called before member functions that require a
32 // backend are called.
33 void CreateBackend(const base::Callback<void(bool)>& callback);
34
35 void set_name(const std::string& name) { name_ = name; }
36 const std::string& name() const { return name_; }
37 int32 id() const { return id_; }
38 void set_id(int32 id) { id_ = id; }
39
40 private:
41 ServiceWorkerFetchStore(const base::FilePath& path, const std::string& name);
42
43 base::FilePath path_;
44 std::string name_;
45 int32 id_;
46
47 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerFetchStore);
48 };
49
50 } // namespace content
51
52 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_FETCH_STORE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698