| 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> |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <string> | 12 #include <string> |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include "base/callback.h" | 15 #include "base/callback.h" |
| 16 #include "base/files/file_path.h" | 16 #include "base/files/file_path.h" |
| 17 #include "base/id_map.h" | 17 #include "base/id_map.h" |
| 18 #include "base/macros.h" | 18 #include "base/macros.h" |
| 19 #include "base/memory/weak_ptr.h" | 19 #include "base/memory/weak_ptr.h" |
| 20 #include "base/observer_list_threadsafe.h" | 20 #include "base/observer_list_threadsafe.h" |
| 21 #include "content/browser/service_worker/service_worker_info.h" | 21 #include "content/browser/service_worker/service_worker_info.h" |
| 22 #include "content/browser/service_worker/service_worker_process_manager.h" | 22 #include "content/browser/service_worker/service_worker_process_manager.h" |
| 23 #include "content/browser/service_worker/service_worker_provider_host.h" | 23 #include "content/browser/service_worker/service_worker_provider_host.h" |
| 24 #include "content/browser/service_worker/service_worker_registration_status.h" | 24 #include "content/browser/service_worker/service_worker_registration_status.h" |
| 25 #include "content/browser/service_worker/service_worker_storage.h" | 25 #include "content/browser/service_worker/service_worker_storage.h" |
| 26 #include "content/common/content_export.h" | 26 #include "content/common/content_export.h" |
| 27 #include "content/common/worker_fetch_context_factory.mojom.h" |
| 27 #include "content/public/browser/service_worker_context.h" | 28 #include "content/public/browser/service_worker_context.h" |
| 28 | 29 |
| 29 class GURL; | 30 class GURL; |
| 30 | 31 |
| 31 namespace base { | 32 namespace base { |
| 32 class FilePath; | 33 class FilePath; |
| 33 class SingleThreadTaskRunner; | 34 class SingleThreadTaskRunner; |
| 34 } | 35 } |
| 35 | 36 |
| 36 namespace storage { | 37 namespace storage { |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 const GURL& url, | 289 const GURL& url, |
| 289 const GURL& other_url, | 290 const GURL& other_url, |
| 290 const ServiceWorkerContext::CheckHasServiceWorkerCallback callback); | 291 const ServiceWorkerContext::CheckHasServiceWorkerCallback callback); |
| 291 | 292 |
| 292 void UpdateVersionFailureCount(int64_t version_id, | 293 void UpdateVersionFailureCount(int64_t version_id, |
| 293 ServiceWorkerStatusCode status); | 294 ServiceWorkerStatusCode status); |
| 294 // Returns the count of consecutive start worker failures for the given | 295 // Returns the count of consecutive start worker failures for the given |
| 295 // version. The count resets to zero when the worker successfully starts. | 296 // version. The count resets to zero when the worker successfully starts. |
| 296 int GetVersionFailureCount(int64_t version_id); | 297 int GetVersionFailureCount(int64_t version_id); |
| 297 | 298 |
| 299 // Binds the ServiceWorkerClient of a dedicated (or shared) worker to the |
| 300 // parent frame's ServiceWorkerProviderHost. (This is used only when off-main |
| 301 // thread fetch is enabled.) |
| 302 void BindWorkerFetchContext( |
| 303 int render_process_id, |
| 304 int service_worker_provider_id, |
| 305 mojom::ServiceWorkerClientAssociatedPtrInfo client_ptr_info); |
| 306 |
| 298 base::WeakPtr<ServiceWorkerContextCore> AsWeakPtr() { | 307 base::WeakPtr<ServiceWorkerContextCore> AsWeakPtr() { |
| 299 return weak_factory_.GetWeakPtr(); | 308 return weak_factory_.GetWeakPtr(); |
| 300 } | 309 } |
| 301 | 310 |
| 302 private: | 311 private: |
| 303 friend class ServiceWorkerContextCoreTest; | 312 friend class ServiceWorkerContextCoreTest; |
| 304 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerContextCoreTest, FailureInfo); | 313 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerContextCoreTest, FailureInfo); |
| 305 | 314 |
| 306 typedef std::map<int64_t, ServiceWorkerRegistration*> RegistrationsMap; | 315 typedef std::map<int64_t, ServiceWorkerRegistration*> RegistrationsMap; |
| 307 typedef std::map<int64_t, ServiceWorkerVersion*> VersionMap; | 316 typedef std::map<int64_t, ServiceWorkerVersion*> VersionMap; |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 scoped_refptr<base::ObserverListThreadSafe<ServiceWorkerContextObserver>> | 387 scoped_refptr<base::ObserverListThreadSafe<ServiceWorkerContextObserver>> |
| 379 observer_list_; | 388 observer_list_; |
| 380 base::WeakPtrFactory<ServiceWorkerContextCore> weak_factory_; | 389 base::WeakPtrFactory<ServiceWorkerContextCore> weak_factory_; |
| 381 | 390 |
| 382 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextCore); | 391 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextCore); |
| 383 }; | 392 }; |
| 384 | 393 |
| 385 } // namespace content | 394 } // namespace content |
| 386 | 395 |
| 387 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CORE_H_ | 396 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CORE_H_ |
| OLD | NEW |