| 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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 int provider_id); | 276 int provider_id); |
| 277 void TransferProviderHostIn( | 277 void TransferProviderHostIn( |
| 278 int new_process_id, | 278 int new_process_id, |
| 279 int new_host_id, | 279 int new_host_id, |
| 280 std::unique_ptr<ServiceWorkerProviderHost> provider_host); | 280 std::unique_ptr<ServiceWorkerProviderHost> provider_host); |
| 281 | 281 |
| 282 void ClearAllServiceWorkersForTest(const base::Closure& callback); | 282 void ClearAllServiceWorkersForTest(const base::Closure& callback); |
| 283 | 283 |
| 284 // Determines if there is a ServiceWorker registration that matches |url|, and | 284 // Determines if there is a ServiceWorker registration that matches |url|, and |
| 285 // if |other_url| falls inside the scope of the same registration. See | 285 // if |other_url| falls inside the scope of the same registration. See |
| 286 // ServiceWorkerContext::CheckHasServiceWorker for more details. | 286 // ServiceWorkerContext::CheckServiceWorkerStatus for more details. |
| 287 void CheckHasServiceWorker( | 287 void CheckServiceWorkerStatus( |
| 288 const GURL& url, | 288 const GURL& url, |
| 289 const GURL& other_url, | 289 const GURL& other_url, |
| 290 const ServiceWorkerContext::CheckHasServiceWorkerCallback callback); | 290 const ServiceWorkerContext::CheckServiceWorkerStatusCallback callback); |
| 291 | 291 |
| 292 void UpdateVersionFailureCount(int64_t version_id, | 292 void UpdateVersionFailureCount(int64_t version_id, |
| 293 ServiceWorkerStatusCode status); | 293 ServiceWorkerStatusCode status); |
| 294 // Returns the count of consecutive start worker failures for the given | 294 // Returns the count of consecutive start worker failures for the given |
| 295 // version. The count resets to zero when the worker successfully starts. | 295 // version. The count resets to zero when the worker successfully starts. |
| 296 int GetVersionFailureCount(int64_t version_id); | 296 int GetVersionFailureCount(int64_t version_id); |
| 297 | 297 |
| 298 base::WeakPtr<ServiceWorkerContextCore> AsWeakPtr() { | 298 base::WeakPtr<ServiceWorkerContextCore> AsWeakPtr() { |
| 299 return weak_factory_.GetWeakPtr(); | 299 return weak_factory_.GetWeakPtr(); |
| 300 } | 300 } |
| (...skipping 29 matching lines...) Expand all Loading... |
| 330 const UnregistrationCallback& callback, | 330 const UnregistrationCallback& callback, |
| 331 int64_t registration_id, | 331 int64_t registration_id, |
| 332 ServiceWorkerStatusCode status); | 332 ServiceWorkerStatusCode status); |
| 333 | 333 |
| 334 void DidGetAllRegistrationsForUnregisterForOrigin( | 334 void DidGetAllRegistrationsForUnregisterForOrigin( |
| 335 const UnregistrationCallback& result, | 335 const UnregistrationCallback& result, |
| 336 const GURL& origin, | 336 const GURL& origin, |
| 337 ServiceWorkerStatusCode status, | 337 ServiceWorkerStatusCode status, |
| 338 const std::vector<ServiceWorkerRegistrationInfo>& registrations); | 338 const std::vector<ServiceWorkerRegistrationInfo>& registrations); |
| 339 | 339 |
| 340 void DidFindRegistrationForCheckHasServiceWorker( | 340 void DidFindRegistrationForCheckServiceWorkerStatus( |
| 341 const GURL& other_url, | 341 const GURL& other_url, |
| 342 const ServiceWorkerContext::CheckHasServiceWorkerCallback callback, | 342 const ServiceWorkerContext::CheckServiceWorkerStatusCallback callback, |
| 343 ServiceWorkerStatusCode status, | 343 ServiceWorkerStatusCode status, |
| 344 scoped_refptr<ServiceWorkerRegistration> registration); | 344 scoped_refptr<ServiceWorkerRegistration> registration); |
| 345 void OnRegistrationFinishedForCheckHasServiceWorker( | 345 void OnRegistrationFinishedForCheckServiceWorkerStatus( |
| 346 const ServiceWorkerContext::CheckHasServiceWorkerCallback callback, | 346 const ServiceWorkerContext::CheckServiceWorkerStatusCallback callback, |
| 347 scoped_refptr<ServiceWorkerRegistration> registration); | 347 scoped_refptr<ServiceWorkerRegistration> registration); |
| 348 | 348 |
| 349 // It's safe to store a raw pointer instead of a scoped_refptr to |wrapper_| | 349 // It's safe to store a raw pointer instead of a scoped_refptr to |wrapper_| |
| 350 // because the Wrapper::Shutdown call that hops threads to destroy |this| uses | 350 // because the Wrapper::Shutdown call that hops threads to destroy |this| uses |
| 351 // Bind() to hold a reference to |wrapper_| until |this| is fully destroyed. | 351 // Bind() to hold a reference to |wrapper_| until |this| is fully destroyed. |
| 352 ServiceWorkerContextWrapper* wrapper_; | 352 ServiceWorkerContextWrapper* wrapper_; |
| 353 std::map<int /* process_id */, ServiceWorkerDispatcherHost*> | 353 std::map<int /* process_id */, ServiceWorkerDispatcherHost*> |
| 354 dispatcher_hosts_; | 354 dispatcher_hosts_; |
| 355 std::unique_ptr<ProcessToProviderMap> providers_; | 355 std::unique_ptr<ProcessToProviderMap> providers_; |
| 356 std::unique_ptr<ProviderByClientUUIDMap> provider_by_uuid_; | 356 std::unique_ptr<ProviderByClientUUIDMap> provider_by_uuid_; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 378 scoped_refptr<base::ObserverListThreadSafe<ServiceWorkerContextObserver>> | 378 scoped_refptr<base::ObserverListThreadSafe<ServiceWorkerContextObserver>> |
| 379 observer_list_; | 379 observer_list_; |
| 380 base::WeakPtrFactory<ServiceWorkerContextCore> weak_factory_; | 380 base::WeakPtrFactory<ServiceWorkerContextCore> weak_factory_; |
| 381 | 381 |
| 382 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextCore); | 382 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextCore); |
| 383 }; | 383 }; |
| 384 | 384 |
| 385 } // namespace content | 385 } // namespace content |
| 386 | 386 |
| 387 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CORE_H_ | 387 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CORE_H_ |
| OLD | NEW |