OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_STORAGE_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_STORAGE_H_ |
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_STORAGE_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_STORAGE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 void DeleteRegistration(const GURL& pattern, | 65 void DeleteRegistration(const GURL& pattern, |
66 const StatusCallback& callback); | 66 const StatusCallback& callback); |
67 | 67 |
68 // Returns new IDs which are guaranteed to be unique in the storage. | 68 // Returns new IDs which are guaranteed to be unique in the storage. |
69 int64 NewRegistrationId(); | 69 int64 NewRegistrationId(); |
70 int64 NewVersionId(); | 70 int64 NewVersionId(); |
71 | 71 |
72 private: | 72 private: |
73 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerStorageTest, PatternMatches); | 73 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerStorageTest, PatternMatches); |
74 | 74 |
| 75 // TODO(michaeln,kinuko): Make this not own ServiceWorkerRegistration. |
75 typedef std::map<GURL, scoped_refptr<ServiceWorkerRegistration> > | 76 typedef std::map<GURL, scoped_refptr<ServiceWorkerRegistration> > |
76 PatternToRegistrationMap; | 77 PatternToRegistrationMap; |
77 | 78 |
78 static bool PatternMatches(const GURL& pattern, const GURL& script_url); | 79 static bool PatternMatches(const GURL& pattern, const GURL& script_url); |
79 | 80 |
80 // This is the in-memory registration. Eventually the registration will be | 81 // This is the in-memory registration. Eventually the registration will be |
81 // persisted to disk. | 82 // persisted to disk. |
82 PatternToRegistrationMap registration_by_pattern_; | 83 PatternToRegistrationMap registration_by_pattern_; |
83 | 84 |
84 int last_registration_id_; | 85 int last_registration_id_; |
85 int last_version_id_; | 86 int last_version_id_; |
86 | 87 |
87 scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_; | 88 scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_; |
88 base::FilePath path_; | 89 base::FilePath path_; |
89 | 90 |
90 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerStorage); | 91 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerStorage); |
91 }; | 92 }; |
92 | 93 |
93 } // namespace content | 94 } // namespace content |
94 | 95 |
95 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_STORAGE_H_ | 96 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_STORAGE_H_ |
OLD | NEW |