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> |
| 9 #include <stdint.h> |
| 10 |
8 #include <map> | 11 #include <map> |
9 #include <string> | 12 #include <string> |
10 #include <vector> | 13 #include <vector> |
11 | 14 |
12 #include "base/id_map.h" | 15 #include "base/id_map.h" |
| 16 #include "base/macros.h" |
13 #include "base/memory/ref_counted.h" | 17 #include "base/memory/ref_counted.h" |
14 #include "base/memory/scoped_ptr.h" | 18 #include "base/memory/scoped_ptr.h" |
15 #include "base/strings/string16.h" | 19 #include "base/strings/string16.h" |
16 #include "base/time/time.h" | 20 #include "base/time/time.h" |
17 #include "content/child/webmessageportchannel_impl.h" | 21 #include "content/child/webmessageportchannel_impl.h" |
18 #include "content/common/service_worker/service_worker_types.h" | 22 #include "content/common/service_worker/service_worker_types.h" |
19 #include "content/public/common/service_worker_event_status.mojom.h" | 23 #include "content/public/common/service_worker_event_status.mojom.h" |
20 #include "ipc/ipc_listener.h" | 24 #include "ipc/ipc_listener.h" |
21 #include "mojo/application/public/interfaces/service_provider.mojom.h" | 25 #include "mojo/application/public/interfaces/service_provider.mojom.h" |
22 #include "third_party/WebKit/public/platform/WebGeofencingEventType.h" | 26 #include "third_party/WebKit/public/platform/WebGeofencingEventType.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 : public blink::WebServiceWorkerContextClient { | 65 : public blink::WebServiceWorkerContextClient { |
62 public: | 66 public: |
63 using SyncCallback = mojo::Callback<void(ServiceWorkerEventStatus)>; | 67 using SyncCallback = mojo::Callback<void(ServiceWorkerEventStatus)>; |
64 | 68 |
65 // Returns a thread-specific client instance. This does NOT create a | 69 // Returns a thread-specific client instance. This does NOT create a |
66 // new instance. | 70 // new instance. |
67 static ServiceWorkerContextClient* ThreadSpecificInstance(); | 71 static ServiceWorkerContextClient* ThreadSpecificInstance(); |
68 | 72 |
69 // Called on the main thread. | 73 // Called on the main thread. |
70 ServiceWorkerContextClient(int embedded_worker_id, | 74 ServiceWorkerContextClient(int embedded_worker_id, |
71 int64 service_worker_version_id, | 75 int64_t service_worker_version_id, |
72 const GURL& service_worker_scope, | 76 const GURL& service_worker_scope, |
73 const GURL& script_url, | 77 const GURL& script_url, |
74 int worker_devtools_agent_route_id); | 78 int worker_devtools_agent_route_id); |
75 ~ServiceWorkerContextClient() override; | 79 ~ServiceWorkerContextClient() override; |
76 | 80 |
77 void OnMessageReceived(int thread_id, | 81 void OnMessageReceived(int thread_id, |
78 int embedded_worker_id, | 82 int embedded_worker_id, |
79 const IPC::Message& message); | 83 const IPC::Message& message); |
80 | 84 |
81 // Called some time after the worker has started. Attempts to use the | 85 // Called some time after the worker has started. Attempts to use the |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 void OnDidSkipWaiting(int request_id); | 219 void OnDidSkipWaiting(int request_id); |
216 void OnDidClaimClients(int request_id); | 220 void OnDidClaimClients(int request_id); |
217 void OnClaimClientsError(int request_id, | 221 void OnClaimClientsError(int request_id, |
218 blink::WebServiceWorkerError::ErrorType error_type, | 222 blink::WebServiceWorkerError::ErrorType error_type, |
219 const base::string16& message); | 223 const base::string16& message); |
220 void OnPing(); | 224 void OnPing(); |
221 | 225 |
222 base::WeakPtr<ServiceWorkerContextClient> GetWeakPtr(); | 226 base::WeakPtr<ServiceWorkerContextClient> GetWeakPtr(); |
223 | 227 |
224 const int embedded_worker_id_; | 228 const int embedded_worker_id_; |
225 const int64 service_worker_version_id_; | 229 const int64_t service_worker_version_id_; |
226 const GURL service_worker_scope_; | 230 const GURL service_worker_scope_; |
227 const GURL script_url_; | 231 const GURL script_url_; |
228 const int worker_devtools_agent_route_id_; | 232 const int worker_devtools_agent_route_id_; |
229 scoped_refptr<ThreadSafeSender> sender_; | 233 scoped_refptr<ThreadSafeSender> sender_; |
230 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; | 234 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; |
231 scoped_refptr<base::TaskRunner> worker_task_runner_; | 235 scoped_refptr<base::TaskRunner> worker_task_runner_; |
232 | 236 |
233 scoped_refptr<ServiceWorkerProviderContext> provider_context_; | 237 scoped_refptr<ServiceWorkerProviderContext> provider_context_; |
234 | 238 |
235 // Not owned; this object is destroyed when proxy_ becomes invalid. | 239 // Not owned; this object is destroyed when proxy_ becomes invalid. |
236 blink::WebServiceWorkerContextProxy* proxy_; | 240 blink::WebServiceWorkerContextProxy* proxy_; |
237 | 241 |
238 // Initialized on the worker thread in workerContextStarted and | 242 // Initialized on the worker thread in workerContextStarted and |
239 // destructed on the worker thread in willDestroyWorkerContext. | 243 // destructed on the worker thread in willDestroyWorkerContext. |
240 scoped_ptr<WorkerContextData> context_; | 244 scoped_ptr<WorkerContextData> context_; |
241 | 245 |
242 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextClient); | 246 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextClient); |
243 }; | 247 }; |
244 | 248 |
245 } // namespace content | 249 } // namespace content |
246 | 250 |
247 #endif // CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CLIENT_H_ | 251 #endif // CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CLIENT_H_ |
OLD | NEW |