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 <deque> | 8 #include <deque> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 void StoreRegistration( | 99 void StoreRegistration( |
100 ServiceWorkerRegistration* registration, | 100 ServiceWorkerRegistration* registration, |
101 ServiceWorkerVersion* version, | 101 ServiceWorkerVersion* version, |
102 const StatusCallback& callback); | 102 const StatusCallback& callback); |
103 | 103 |
104 // Updates the state of the registration's stored version to active. | 104 // Updates the state of the registration's stored version to active. |
105 void UpdateToActiveState( | 105 void UpdateToActiveState( |
106 ServiceWorkerRegistration* registration, | 106 ServiceWorkerRegistration* registration, |
107 const StatusCallback& callback); | 107 const StatusCallback& callback); |
108 | 108 |
| 109 // Updates the stored time to match the value of |
| 110 // registration->last_update_check(). |
| 111 void UpdateLastUpdateCheckTime(ServiceWorkerRegistration* registration); |
| 112 |
109 // Deletes the registration data for |registration_id|. If the registration's | 113 // Deletes the registration data for |registration_id|. If the registration's |
110 // version is live, its script resources will remain available. | 114 // version is live, its script resources will remain available. |
111 // PurgeResources should be called when it's OK to delete them. | 115 // PurgeResources should be called when it's OK to delete them. |
112 void DeleteRegistration(int64 registration_id, | 116 void DeleteRegistration(int64 registration_id, |
113 const GURL& origin, | 117 const GURL& origin, |
114 const StatusCallback& callback); | 118 const StatusCallback& callback); |
115 | 119 |
116 scoped_ptr<ServiceWorkerResponseReader> CreateResponseReader( | 120 scoped_ptr<ServiceWorkerResponseReader> CreateResponseReader( |
117 int64 response_id); | 121 int64 response_id); |
118 scoped_ptr<ServiceWorkerResponseWriter> CreateResponseWriter( | 122 scoped_ptr<ServiceWorkerResponseWriter> CreateResponseWriter( |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 | 156 |
153 void Disable(); | 157 void Disable(); |
154 bool IsDisabled() const; | 158 bool IsDisabled() const; |
155 | 159 |
156 // |resources| must already be on the purgeable list. | 160 // |resources| must already be on the purgeable list. |
157 void PurgeResources(const ResourceList& resources); | 161 void PurgeResources(const ResourceList& resources); |
158 | 162 |
159 private: | 163 private: |
160 friend class ServiceWorkerResourceStorageTest; | 164 friend class ServiceWorkerResourceStorageTest; |
161 friend class ServiceWorkerControlleeRequestHandlerTest; | 165 friend class ServiceWorkerControlleeRequestHandlerTest; |
| 166 friend class ServiceWorkerContextRequestHandlerTest; |
162 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerResourceStorageTest, | 167 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerResourceStorageTest, |
163 DeleteRegistration_NoLiveVersion); | 168 DeleteRegistration_NoLiveVersion); |
164 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerResourceStorageTest, | 169 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerResourceStorageTest, |
165 DeleteRegistration_WaitingVersion); | 170 DeleteRegistration_WaitingVersion); |
166 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerResourceStorageTest, | 171 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerResourceStorageTest, |
167 DeleteRegistration_ActiveVersion); | 172 DeleteRegistration_ActiveVersion); |
168 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerResourceStorageTest, | 173 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerResourceStorageTest, |
169 UpdateRegistration); | 174 UpdateRegistration); |
170 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerResourceStorageDiskTest, | 175 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerResourceStorageDiskTest, |
171 CleanupOnRestart); | 176 CleanupOnRestart); |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 std::set<int64> pending_deletions_; | 384 std::set<int64> pending_deletions_; |
380 | 385 |
381 base::WeakPtrFactory<ServiceWorkerStorage> weak_factory_; | 386 base::WeakPtrFactory<ServiceWorkerStorage> weak_factory_; |
382 | 387 |
383 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerStorage); | 388 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerStorage); |
384 }; | 389 }; |
385 | 390 |
386 } // namespace content | 391 } // namespace content |
387 | 392 |
388 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_STORAGE_H_ | 393 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_STORAGE_H_ |
OLD | NEW |