OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_NAVIGATION_HANDLE_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_NAVIGATION_HANDLE_H_ |
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_NAVIGATION_HANDLE_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_NAVIGATION_HANDLE_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "content/common/service_worker/service_worker_types.h" |
10 | 11 |
11 namespace content { | 12 namespace content { |
12 | 13 |
13 class ServiceWorkerContextWrapper; | 14 class ServiceWorkerContextWrapper; |
14 class ServiceWorkerNavigationHandleCore; | 15 class ServiceWorkerNavigationHandleCore; |
15 | 16 |
16 // This class is used to manage the lifetime of ServiceWorkerProviderHosts | 17 // This class is used to manage the lifetime of ServiceWorkerProviderHosts |
17 // created during navigation. This is a UI thread class, with a pendant class | 18 // created during navigation. This is a UI thread class, with a pendant class |
18 // on the IO thread, the ServiceWorkerNavigationHandleCore. | 19 // on the IO thread, the ServiceWorkerNavigationHandleCore. |
19 // | 20 // |
(...skipping 26 matching lines...) Expand all Loading... |
46 // put it in the ServiceWorkerContextCore map of ServiceWorkerProviderHosts. | 47 // put it in the ServiceWorkerContextCore map of ServiceWorkerProviderHosts. |
47 // | 48 // |
48 // 7) When the navigation finishes, the ServiceWorkerNavigationHandle is | 49 // 7) When the navigation finishes, the ServiceWorkerNavigationHandle is |
49 // destroyed. The destructor of the ServiceWorkerNavigationHandle posts a | 50 // destroyed. The destructor of the ServiceWorkerNavigationHandle posts a |
50 // task to destroy the ServiceWorkerNavigationHandleCore on the IO thread. | 51 // task to destroy the ServiceWorkerNavigationHandleCore on the IO thread. |
51 // This in turn leads to the destruction of an unclaimed | 52 // This in turn leads to the destruction of an unclaimed |
52 // ServiceWorkerProviderHost. | 53 // ServiceWorkerProviderHost. |
53 class ServiceWorkerNavigationHandle { | 54 class ServiceWorkerNavigationHandle { |
54 public: | 55 public: |
55 explicit ServiceWorkerNavigationHandle( | 56 explicit ServiceWorkerNavigationHandle( |
56 ServiceWorkerContextWrapper* context_wrapper); | 57 ServiceWorkerContextWrapper* context_wrapper, |
| 58 const MojoURLLoaderFactoryGetter& url_loader_factory_getter); |
57 ~ServiceWorkerNavigationHandle(); | 59 ~ServiceWorkerNavigationHandle(); |
58 | 60 |
59 int service_worker_provider_host_id() const { | 61 int service_worker_provider_host_id() const { |
60 return service_worker_provider_host_id_; | 62 return service_worker_provider_host_id_; |
61 } | 63 } |
62 ServiceWorkerNavigationHandleCore* core() const { return core_; } | 64 ServiceWorkerNavigationHandleCore* core() const { return core_; } |
63 | 65 |
64 // Called after a ServiceWorkerProviderHost with id | 66 // Called after a ServiceWorkerProviderHost with id |
65 // |service_worker_provider_host_id| was pre-created for the navigation on the | 67 // |service_worker_provider_host_id| was pre-created for the navigation on the |
66 // IO thread. | 68 // IO thread. |
67 void DidCreateServiceWorkerProviderHost(int service_worker_provider_host_id); | 69 void DidCreateServiceWorkerProviderHost(int service_worker_provider_host_id); |
68 | 70 |
69 private: | 71 private: |
70 int service_worker_provider_host_id_; | 72 int service_worker_provider_host_id_; |
71 ServiceWorkerNavigationHandleCore* core_; | 73 ServiceWorkerNavigationHandleCore* core_; |
72 base::WeakPtrFactory<ServiceWorkerNavigationHandle> weak_factory_; | 74 base::WeakPtrFactory<ServiceWorkerNavigationHandle> weak_factory_; |
73 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerNavigationHandle); | 75 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerNavigationHandle); |
74 }; | 76 }; |
75 | 77 |
76 } // namespace content | 78 } // namespace content |
77 | 79 |
78 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_NAVIGATION_HANDLE_H_ | 80 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_NAVIGATION_HANDLE_H_ |
OLD | NEW |