OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_RENDERER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CLIENT_H_ | 5 #ifndef CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CLIENT_H_ |
6 #define CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CLIENT_H_ | 6 #define CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CLIENT_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 | 54 |
55 namespace content { | 55 namespace content { |
56 | 56 |
57 struct PlatformNotificationData; | 57 struct PlatformNotificationData; |
58 struct PushEventPayload; | 58 struct PushEventPayload; |
59 struct ServiceWorkerClientInfo; | 59 struct ServiceWorkerClientInfo; |
60 class ServiceWorkerProviderContext; | 60 class ServiceWorkerProviderContext; |
61 class ServiceWorkerContextClient; | 61 class ServiceWorkerContextClient; |
62 class ThreadSafeSender; | 62 class ThreadSafeSender; |
63 class EmbeddedWorkerInstanceClientImpl; | 63 class EmbeddedWorkerInstanceClientImpl; |
| 64 class WebWorkerFetchContext; |
64 | 65 |
65 // This class provides access to/from an ServiceWorker's WorkerGlobalScope. | 66 // This class provides access to/from an ServiceWorker's WorkerGlobalScope. |
66 // Unless otherwise noted, all methods are called on the worker thread. | 67 // Unless otherwise noted, all methods are called on the worker thread. |
67 class ServiceWorkerContextClient : public blink::WebServiceWorkerContextClient, | 68 class ServiceWorkerContextClient : public blink::WebServiceWorkerContextClient, |
68 public mojom::ServiceWorkerEventDispatcher { | 69 public mojom::ServiceWorkerEventDispatcher { |
69 public: | 70 public: |
70 using SyncCallback = | 71 using SyncCallback = |
71 base::Callback<void(ServiceWorkerStatusCode, | 72 base::Callback<void(ServiceWorkerStatusCode, |
72 base::Time /* dispatch_event_time */)>; | 73 base::Time /* dispatch_event_time */)>; |
73 using FetchCallback = | 74 using FetchCallback = |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 int payment_request_id, | 186 int payment_request_id, |
186 const blink::WebPaymentAppResponse& response, | 187 const blink::WebPaymentAppResponse& response, |
187 double dispatch_event_time) override; | 188 double dispatch_event_time) override; |
188 void DidHandlePaymentRequestEvent(int payment_request_id, | 189 void DidHandlePaymentRequestEvent(int payment_request_id, |
189 blink::WebServiceWorkerEventResult result, | 190 blink::WebServiceWorkerEventResult result, |
190 double dispatch_event_time) override; | 191 double dispatch_event_time) override; |
191 | 192 |
192 // Called on the main thread. | 193 // Called on the main thread. |
193 blink::WebServiceWorkerNetworkProvider* CreateServiceWorkerNetworkProvider() | 194 blink::WebServiceWorkerNetworkProvider* CreateServiceWorkerNetworkProvider() |
194 override; | 195 override; |
| 196 blink::WebWorkerFetchContext* CreateServiceWorkerFetchContext() override; |
195 blink::WebServiceWorkerProvider* CreateServiceWorkerProvider() override; | 197 blink::WebServiceWorkerProvider* CreateServiceWorkerProvider() override; |
196 | 198 |
197 void PostMessageToClient(const blink::WebString& uuid, | 199 void PostMessageToClient(const blink::WebString& uuid, |
198 const blink::WebString& message, | 200 const blink::WebString& message, |
199 blink::WebMessagePortChannelArray channels) override; | 201 blink::WebMessagePortChannelArray channels) override; |
200 void Focus(const blink::WebString& uuid, | 202 void Focus(const blink::WebString& uuid, |
201 std::unique_ptr<blink::WebServiceWorkerClientCallbacks>) override; | 203 std::unique_ptr<blink::WebServiceWorkerClientCallbacks>) override; |
202 void Navigate( | 204 void Navigate( |
203 const blink::WebString& uuid, | 205 const blink::WebString& uuid, |
204 const blink::WebURL&, | 206 const blink::WebURL&, |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 void OnNavigationPreloadError( | 317 void OnNavigationPreloadError( |
316 int fetch_event_id, | 318 int fetch_event_id, |
317 std::unique_ptr<blink::WebServiceWorkerError> error); | 319 std::unique_ptr<blink::WebServiceWorkerError> error); |
318 | 320 |
319 base::WeakPtr<ServiceWorkerContextClient> GetWeakPtr(); | 321 base::WeakPtr<ServiceWorkerContextClient> GetWeakPtr(); |
320 | 322 |
321 const int embedded_worker_id_; | 323 const int embedded_worker_id_; |
322 const int64_t service_worker_version_id_; | 324 const int64_t service_worker_version_id_; |
323 const GURL service_worker_scope_; | 325 const GURL service_worker_scope_; |
324 const GURL script_url_; | 326 const GURL script_url_; |
| 327 int network_provider_id_ = kInvalidServiceWorkerProviderId; |
325 scoped_refptr<ThreadSafeSender> sender_; | 328 scoped_refptr<ThreadSafeSender> sender_; |
326 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; | 329 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; |
327 scoped_refptr<base::TaskRunner> worker_task_runner_; | 330 scoped_refptr<base::TaskRunner> worker_task_runner_; |
328 | 331 |
329 scoped_refptr<ServiceWorkerProviderContext> provider_context_; | 332 scoped_refptr<ServiceWorkerProviderContext> provider_context_; |
330 | 333 |
331 // Not owned; this object is destroyed when proxy_ becomes invalid. | 334 // Not owned; this object is destroyed when proxy_ becomes invalid. |
332 blink::WebServiceWorkerContextProxy* proxy_; | 335 blink::WebServiceWorkerContextProxy* proxy_; |
333 | 336 |
334 // This is bound on the worker thread. | 337 // This is bound on the worker thread. |
(...skipping 10 matching lines...) Expand all Loading... |
345 // Initialized on the worker thread in workerContextStarted and | 348 // Initialized on the worker thread in workerContextStarted and |
346 // destructed on the worker thread in willDestroyWorkerContext. | 349 // destructed on the worker thread in willDestroyWorkerContext. |
347 std::unique_ptr<WorkerContextData> context_; | 350 std::unique_ptr<WorkerContextData> context_; |
348 | 351 |
349 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextClient); | 352 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextClient); |
350 }; | 353 }; |
351 | 354 |
352 } // namespace content | 355 } // namespace content |
353 | 356 |
354 #endif // CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CLIENT_H_ | 357 #endif // CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CLIENT_H_ |
OLD | NEW |