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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 // Updates the service worker. If |force_bypass_cache| is true or 24 hours | 200 // Updates the service worker. If |force_bypass_cache| is true or 24 hours |
201 // have passed since the last update, bypasses the browser cache. | 201 // have passed since the last update, bypasses the browser cache. |
202 void UpdateServiceWorker(ServiceWorkerRegistration* registration, | 202 void UpdateServiceWorker(ServiceWorkerRegistration* registration, |
203 bool force_bypass_cache); | 203 bool force_bypass_cache); |
204 void UpdateServiceWorker(ServiceWorkerRegistration* registration, | 204 void UpdateServiceWorker(ServiceWorkerRegistration* registration, |
205 bool force_bypass_cache, | 205 bool force_bypass_cache, |
206 bool skip_script_comparison, | 206 bool skip_script_comparison, |
207 ServiceWorkerProviderHost* provider_host, | 207 ServiceWorkerProviderHost* provider_host, |
208 const UpdateCallback& callback); | 208 const UpdateCallback& callback); |
209 | 209 |
210 // Used in DevTools to update the service worker registration without | 210 // Used in DevTools to update the service worker registrations without |
211 // consulting the browser cache while loading the controlled page. The loading | 211 // consulting the browser cache while loading the controlled page. The |
212 // is delayed until the update completes and the new worker is activated. The | 212 // loading is delayed until the update completes and the new worker is |
213 // new worker skips the waiting state and immediately becomes active after | 213 // activated. The new worker skips the waiting state and immediately |
214 // installed. | 214 // becomes active after installed. |
215 void SetForceUpdateOnPageLoad(int64_t registration_id, | 215 bool force_update_on_page_load() { return force_update_on_page_load_; } |
216 bool force_update_on_page_load); | 216 void set_force_update_on_page_load(bool force_update_on_page_load) { |
| 217 force_update_on_page_load_ = force_update_on_page_load; |
| 218 } |
217 | 219 |
218 // This class maintains collections of live instances, this class | 220 // This class maintains collections of live instances, this class |
219 // does not own these object or influence their lifetime. | 221 // does not own these object or influence their lifetime. |
220 ServiceWorkerRegistration* GetLiveRegistration(int64_t registration_id); | 222 ServiceWorkerRegistration* GetLiveRegistration(int64_t registration_id); |
221 void AddLiveRegistration(ServiceWorkerRegistration* registration); | 223 void AddLiveRegistration(ServiceWorkerRegistration* registration); |
222 void RemoveLiveRegistration(int64_t registration_id); | 224 void RemoveLiveRegistration(int64_t registration_id); |
223 const std::map<int64_t, ServiceWorkerRegistration*>& GetLiveRegistrations() | 225 const std::map<int64_t, ServiceWorkerRegistration*>& GetLiveRegistrations() |
224 const { | 226 const { |
225 return live_registrations_; | 227 return live_registrations_; |
226 } | 228 } |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 std::map<int64_t, ServiceWorkerRegistration*> live_registrations_; | 340 std::map<int64_t, ServiceWorkerRegistration*> live_registrations_; |
339 std::map<int64_t, ServiceWorkerVersion*> live_versions_; | 341 std::map<int64_t, ServiceWorkerVersion*> live_versions_; |
340 std::map<int64_t, scoped_refptr<ServiceWorkerVersion>> protected_versions_; | 342 std::map<int64_t, scoped_refptr<ServiceWorkerVersion>> protected_versions_; |
341 std::map<int64_t /* version_id */, int /* count */> failure_counts_; | 343 std::map<int64_t /* version_id */, int /* count */> failure_counts_; |
342 | 344 |
343 // PlzNavigate | 345 // PlzNavigate |
344 // Map of ServiceWorkerNavigationHandleCores used for navigation requests. | 346 // Map of ServiceWorkerNavigationHandleCores used for navigation requests. |
345 std::map<int, ServiceWorkerNavigationHandleCore*> | 347 std::map<int, ServiceWorkerNavigationHandleCore*> |
346 navigation_handle_cores_map_; | 348 navigation_handle_cores_map_; |
347 | 349 |
| 350 bool force_update_on_page_load_; |
348 int next_handle_id_; | 351 int next_handle_id_; |
349 int next_registration_handle_id_; | 352 int next_registration_handle_id_; |
350 // Set in RegisterServiceWorker(), cleared in ClearAllServiceWorkersForTest(). | 353 // Set in RegisterServiceWorker(), cleared in ClearAllServiceWorkersForTest(). |
351 // This is used to avoid unnecessary disk read operation in tests. This value | 354 // This is used to avoid unnecessary disk read operation in tests. This value |
352 // is false if Chrome was relaunched after service workers were registered. | 355 // is false if Chrome was relaunched after service workers were registered. |
353 bool was_service_worker_registered_; | 356 bool was_service_worker_registered_; |
354 scoped_refptr<base::ObserverListThreadSafe<ServiceWorkerContextObserver>> | 357 scoped_refptr<base::ObserverListThreadSafe<ServiceWorkerContextObserver>> |
355 observer_list_; | 358 observer_list_; |
356 base::WeakPtrFactory<ServiceWorkerContextCore> weak_factory_; | 359 base::WeakPtrFactory<ServiceWorkerContextCore> weak_factory_; |
357 | 360 |
358 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextCore); | 361 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextCore); |
359 }; | 362 }; |
360 | 363 |
361 } // namespace content | 364 } // namespace content |
362 | 365 |
363 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CORE_H_ | 366 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CORE_H_ |
OLD | NEW |