Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 true on success. This must be | |
| 31 // called before the other public member functions. | |
|
jkarlin
2014/08/06 20:58:32
Really this is about initializing the backend (sim
jkarlin
2014/08/07 16:02:35
Done.
| |
| 32 void InitializeIfNeeded(const base::Callback<void(bool)>& callback); | |
| 33 | |
| 34 void set_name(const std::string& name) { name_ = name; } | |
| 35 const std::string& name() const { return name_; } | |
| 36 int32 id() const { return id_; } | |
| 37 void set_id(int32 id) { id_ = id; } | |
| 38 | |
| 39 private: | |
| 40 ServiceWorkerFetchStore(const base::FilePath& path, const std::string& name); | |
| 41 | |
| 42 base::FilePath path_; | |
| 43 std::string name_; | |
| 44 int32 id_; | |
| 45 | |
| 46 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerFetchStore); | |
| 47 }; | |
| 48 | |
| 49 } // namespace content | |
| 50 | |
| 51 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_FETCH_STORE_H_ | |
| OLD | NEW |