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_CONTEXT_CORE_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CORE_H_ |
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CORE_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CORE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 ServiceWorkerRegistration* GetLiveRegistration(int64 registration_id); | 188 ServiceWorkerRegistration* GetLiveRegistration(int64 registration_id); |
189 void AddLiveRegistration(ServiceWorkerRegistration* registration); | 189 void AddLiveRegistration(ServiceWorkerRegistration* registration); |
190 void RemoveLiveRegistration(int64 registration_id); | 190 void RemoveLiveRegistration(int64 registration_id); |
191 ServiceWorkerVersion* GetLiveVersion(int64 version_id); | 191 ServiceWorkerVersion* GetLiveVersion(int64 version_id); |
192 void AddLiveVersion(ServiceWorkerVersion* version); | 192 void AddLiveVersion(ServiceWorkerVersion* version); |
193 void RemoveLiveVersion(int64 registration_id); | 193 void RemoveLiveVersion(int64 registration_id); |
194 | 194 |
195 std::vector<ServiceWorkerRegistrationInfo> GetAllLiveRegistrationInfo(); | 195 std::vector<ServiceWorkerRegistrationInfo> GetAllLiveRegistrationInfo(); |
196 std::vector<ServiceWorkerVersionInfo> GetAllLiveVersionInfo(); | 196 std::vector<ServiceWorkerVersionInfo> GetAllLiveVersionInfo(); |
197 | 197 |
| 198 // ProtectVersion holds a reference to |version| until UnprotectVersion is |
| 199 // called. |
| 200 void ProtectVersion(const scoped_refptr<ServiceWorkerVersion>& version); |
| 201 void UnprotectVersion(int64 version_id); |
| 202 |
198 // Returns new context-local unique ID. | 203 // Returns new context-local unique ID. |
199 int GetNewServiceWorkerHandleId(); | 204 int GetNewServiceWorkerHandleId(); |
200 int GetNewRegistrationHandleId(); | 205 int GetNewRegistrationHandleId(); |
201 | 206 |
202 void ScheduleDeleteAndStartOver() const; | 207 void ScheduleDeleteAndStartOver() const; |
203 | 208 |
204 // Deletes all files on disk and restarts the system. This leaves the system | 209 // Deletes all files on disk and restarts the system. This leaves the system |
205 // in a disabled state until it's done. | 210 // in a disabled state until it's done. |
206 void DeleteAndStartOver(const StatusCallback& callback); | 211 void DeleteAndStartOver(const StatusCallback& callback); |
207 | 212 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 // because the Wrapper::Shutdown call that hops threads to destroy |this| uses | 252 // because the Wrapper::Shutdown call that hops threads to destroy |this| uses |
248 // Bind() to hold a reference to |wrapper_| until |this| is fully destroyed. | 253 // Bind() to hold a reference to |wrapper_| until |this| is fully destroyed. |
249 ServiceWorkerContextWrapper* wrapper_; | 254 ServiceWorkerContextWrapper* wrapper_; |
250 scoped_ptr<ProcessToProviderMap> providers_; | 255 scoped_ptr<ProcessToProviderMap> providers_; |
251 scoped_ptr<ProviderByClientUUIDMap> provider_by_uuid_; | 256 scoped_ptr<ProviderByClientUUIDMap> provider_by_uuid_; |
252 scoped_ptr<ServiceWorkerStorage> storage_; | 257 scoped_ptr<ServiceWorkerStorage> storage_; |
253 scoped_refptr<EmbeddedWorkerRegistry> embedded_worker_registry_; | 258 scoped_refptr<EmbeddedWorkerRegistry> embedded_worker_registry_; |
254 scoped_ptr<ServiceWorkerJobCoordinator> job_coordinator_; | 259 scoped_ptr<ServiceWorkerJobCoordinator> job_coordinator_; |
255 std::map<int64, ServiceWorkerRegistration*> live_registrations_; | 260 std::map<int64, ServiceWorkerRegistration*> live_registrations_; |
256 std::map<int64, ServiceWorkerVersion*> live_versions_; | 261 std::map<int64, ServiceWorkerVersion*> live_versions_; |
| 262 std::map<int64, scoped_refptr<ServiceWorkerVersion>> protected_versions_; |
257 int next_handle_id_; | 263 int next_handle_id_; |
258 int next_registration_handle_id_; | 264 int next_registration_handle_id_; |
259 scoped_refptr<base::ObserverListThreadSafe<ServiceWorkerContextObserver>> | 265 scoped_refptr<base::ObserverListThreadSafe<ServiceWorkerContextObserver>> |
260 observer_list_; | 266 observer_list_; |
261 base::WeakPtrFactory<ServiceWorkerContextCore> weak_factory_; | 267 base::WeakPtrFactory<ServiceWorkerContextCore> weak_factory_; |
262 | 268 |
263 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextCore); | 269 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextCore); |
264 }; | 270 }; |
265 | 271 |
266 } // namespace content | 272 } // namespace content |
267 | 273 |
268 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CORE_H_ | 274 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CORE_H_ |
OLD | NEW |