Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: content/renderer/service_worker/service_worker_context_client.h

Issue 2307543002: ServiceWorker: Mojofication of EWInstance::StopWorker (Closed)
Patch Set: Added a check of the status when detached Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 52
53 namespace content { 53 namespace content {
54 54
55 struct PlatformNotificationData; 55 struct PlatformNotificationData;
56 struct PushEventPayload; 56 struct PushEventPayload;
57 struct ServiceWorkerClientInfo; 57 struct ServiceWorkerClientInfo;
58 class ServiceWorkerProviderContext; 58 class ServiceWorkerProviderContext;
59 class ServiceWorkerContextClient; 59 class ServiceWorkerContextClient;
60 class ThreadSafeSender; 60 class ThreadSafeSender;
61 class WebServiceWorkerRegistrationImpl; 61 class WebServiceWorkerRegistrationImpl;
62 class EmbeddedWorkerInstanceClientImpl;
62 63
63 // This class provides access to/from an ServiceWorker's WorkerGlobalScope. 64 // This class provides access to/from an ServiceWorker's WorkerGlobalScope.
64 // Unless otherwise noted, all methods are called on the worker thread. 65 // Unless otherwise noted, all methods are called on the worker thread.
65 class ServiceWorkerContextClient 66 class ServiceWorkerContextClient
66 : public blink::WebServiceWorkerContextClient { 67 : public blink::WebServiceWorkerContextClient {
67 public: 68 public:
68 using SyncCallback = 69 using SyncCallback =
69 base::Callback<void(blink::mojom::ServiceWorkerEventStatus, 70 base::Callback<void(blink::mojom::ServiceWorkerEventStatus,
70 base::Time /* dispatch_event_time */)>; 71 base::Time /* dispatch_event_time */)>;
71 using FetchCallback = 72 using FetchCallback =
72 base::Callback<void(ServiceWorkerStatusCode, 73 base::Callback<void(ServiceWorkerStatusCode,
73 base::Time /* dispatch_event_time */)>; 74 base::Time /* dispatch_event_time */)>;
74 75
75 // Returns a thread-specific client instance. This does NOT create a 76 // Returns a thread-specific client instance. This does NOT create a
76 // new instance. 77 // new instance.
77 static ServiceWorkerContextClient* ThreadSpecificInstance(); 78 static ServiceWorkerContextClient* ThreadSpecificInstance();
78 79
79 // Called on the main thread. 80 // Called on the main thread.
80 ServiceWorkerContextClient(int embedded_worker_id, 81 ServiceWorkerContextClient(
81 int64_t service_worker_version_id, 82 int embedded_worker_id,
82 const GURL& service_worker_scope, 83 int64_t service_worker_version_id,
83 const GURL& script_url, 84 const GURL& service_worker_scope,
84 int worker_devtools_agent_route_id); 85 const GURL& script_url,
86 int worker_devtools_agent_route_id,
87 std::unique_ptr<EmbeddedWorkerInstanceClientImpl> embedded_worker);
85 ~ServiceWorkerContextClient() override; 88 ~ServiceWorkerContextClient() override;
86 89
87 void OnMessageReceived(int thread_id, 90 void OnMessageReceived(int thread_id,
88 int embedded_worker_id, 91 int embedded_worker_id,
89 const IPC::Message& message); 92 const IPC::Message& message);
90 93
91 // Called some time after the worker has started. 94 // Called some time after the worker has started.
92 void BindInterfaceProviders( 95 void BindInterfaceProviders(
93 shell::mojom::InterfaceProviderRequest request, 96 shell::mojom::InterfaceProviderRequest request,
94 shell::mojom::InterfaceProviderPtr remote_interfaces); 97 shell::mojom::InterfaceProviderPtr remote_interfaces);
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 const int worker_devtools_agent_route_id_; 259 const int worker_devtools_agent_route_id_;
257 scoped_refptr<ThreadSafeSender> sender_; 260 scoped_refptr<ThreadSafeSender> sender_;
258 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; 261 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_;
259 scoped_refptr<base::TaskRunner> worker_task_runner_; 262 scoped_refptr<base::TaskRunner> worker_task_runner_;
260 263
261 scoped_refptr<ServiceWorkerProviderContext> provider_context_; 264 scoped_refptr<ServiceWorkerProviderContext> provider_context_;
262 265
263 // Not owned; this object is destroyed when proxy_ becomes invalid. 266 // Not owned; this object is destroyed when proxy_ becomes invalid.
264 blink::WebServiceWorkerContextProxy* proxy_; 267 blink::WebServiceWorkerContextProxy* proxy_;
265 268
269 // Renderer-side object corresponding to WebEmbeddedWorkerInstance
270 std::unique_ptr<EmbeddedWorkerInstanceClientImpl> embedded_worker_client_;
271
266 // Initialized on the worker thread in workerContextStarted and 272 // Initialized on the worker thread in workerContextStarted and
267 // destructed on the worker thread in willDestroyWorkerContext. 273 // destructed on the worker thread in willDestroyWorkerContext.
268 std::unique_ptr<WorkerContextData> context_; 274 std::unique_ptr<WorkerContextData> context_;
269 275
270 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextClient); 276 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextClient);
271 }; 277 };
272 278
273 } // namespace content 279 } // namespace content
274 280
275 #endif // CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CLIENT_H_ 281 #endif // CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698