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 <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 28 matching lines...) Expand all Loading... |
39 | 39 |
40 namespace IPC { | 40 namespace IPC { |
41 class Message; | 41 class Message; |
42 } | 42 } |
43 | 43 |
44 namespace content { | 44 namespace content { |
45 | 45 |
46 struct NavigatorConnectClient; | 46 struct NavigatorConnectClient; |
47 struct PlatformNotificationData; | 47 struct PlatformNotificationData; |
48 struct ServiceWorkerClientInfo; | 48 struct ServiceWorkerClientInfo; |
| 49 class EmbeddedWorkerImpl; |
49 class ServiceWorkerProviderContext; | 50 class ServiceWorkerProviderContext; |
50 class ServiceWorkerContextClient; | 51 class ServiceWorkerContextClient; |
51 class ThreadSafeSender; | 52 class ThreadSafeSender; |
52 class WebServiceWorkerRegistrationImpl; | 53 class WebServiceWorkerRegistrationImpl; |
53 | 54 |
54 // This class provides access to/from an ServiceWorker's WorkerGlobalScope. | 55 // This class provides access to/from an ServiceWorker's WorkerGlobalScope. |
55 // Unless otherwise noted, all methods are called on the worker thread. | 56 // Unless otherwise noted, all methods are called on the worker thread. |
56 class ServiceWorkerContextClient | 57 class ServiceWorkerContextClient |
57 : public blink::WebServiceWorkerContextClient { | 58 : public blink::WebServiceWorkerContextClient { |
58 public: | 59 public: |
59 // Returns a thread-specific client instance. This does NOT create a | 60 // Returns a thread-specific client instance. This does NOT create a |
60 // new instance. | 61 // new instance. |
61 static ServiceWorkerContextClient* ThreadSpecificInstance(); | 62 static ServiceWorkerContextClient* ThreadSpecificInstance(); |
62 | 63 |
63 // Called on the main thread. | 64 // Called on the main thread. |
64 ServiceWorkerContextClient(int embedded_worker_id, | 65 ServiceWorkerContextClient(int embedded_worker_id, |
| 66 EmbeddedWorkerImpl* embedded_worker, |
65 int64 service_worker_version_id, | 67 int64 service_worker_version_id, |
66 const GURL& service_worker_scope, | 68 const GURL& service_worker_scope, |
67 const GURL& script_url, | 69 const GURL& script_url, |
68 int worker_devtools_agent_route_id); | 70 int worker_devtools_agent_route_id); |
69 ~ServiceWorkerContextClient() override; | 71 ~ServiceWorkerContextClient() override; |
70 | 72 |
71 void OnMessageReceived(int thread_id, | 73 void OnMessageReceived(int thread_id, |
72 int embedded_worker_id, | 74 int embedded_worker_id, |
73 const IPC::Message& message); | 75 const IPC::Message& message); |
74 | 76 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 void OnDidSkipWaiting(int request_id); | 197 void OnDidSkipWaiting(int request_id); |
196 void OnDidClaimClients(int request_id); | 198 void OnDidClaimClients(int request_id); |
197 void OnClaimClientsError(int request_id, | 199 void OnClaimClientsError(int request_id, |
198 blink::WebServiceWorkerError::ErrorType error_type, | 200 blink::WebServiceWorkerError::ErrorType error_type, |
199 const base::string16& message); | 201 const base::string16& message); |
200 void OnPing(); | 202 void OnPing(); |
201 | 203 |
202 base::WeakPtr<ServiceWorkerContextClient> GetWeakPtr(); | 204 base::WeakPtr<ServiceWorkerContextClient> GetWeakPtr(); |
203 | 205 |
204 const int embedded_worker_id_; | 206 const int embedded_worker_id_; |
| 207 EmbeddedWorkerImpl* const embedded_worker_; |
205 const int64 service_worker_version_id_; | 208 const int64 service_worker_version_id_; |
206 const GURL service_worker_scope_; | 209 const GURL service_worker_scope_; |
207 const GURL script_url_; | 210 const GURL script_url_; |
208 const int worker_devtools_agent_route_id_; | 211 const int worker_devtools_agent_route_id_; |
209 scoped_refptr<ThreadSafeSender> sender_; | 212 scoped_refptr<ThreadSafeSender> sender_; |
210 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; | 213 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; |
211 scoped_refptr<base::TaskRunner> worker_task_runner_; | 214 scoped_refptr<base::TaskRunner> worker_task_runner_; |
212 | 215 |
213 scoped_refptr<ServiceWorkerProviderContext> provider_context_; | 216 scoped_refptr<ServiceWorkerProviderContext> provider_context_; |
214 | 217 |
(...skipping 17 matching lines...) Expand all Loading... |
232 std::map<int, base::TimeTicks> install_start_timings_; | 235 std::map<int, base::TimeTicks> install_start_timings_; |
233 std::map<int, base::TimeTicks> notification_click_start_timings_; | 236 std::map<int, base::TimeTicks> notification_click_start_timings_; |
234 std::map<int, base::TimeTicks> push_start_timings_; | 237 std::map<int, base::TimeTicks> push_start_timings_; |
235 | 238 |
236 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextClient); | 239 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextClient); |
237 }; | 240 }; |
238 | 241 |
239 } // namespace content | 242 } // namespace content |
240 | 243 |
241 #endif // CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CLIENT_H_ | 244 #endif // CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CLIENT_H_ |
OLD | NEW |