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

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

Issue 2746783002: [ServiceWorker] Mojofy InstallEvent of Service Worker (Closed)
Patch Set: Rebase Created 3 years, 8 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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 std::unique_ptr<blink::WebServiceWorkerClientCallbacks>) override; 206 std::unique_ptr<blink::WebServiceWorkerClientCallbacks>) override;
207 void Navigate( 207 void Navigate(
208 const blink::WebString& uuid, 208 const blink::WebString& uuid,
209 const blink::WebURL&, 209 const blink::WebURL&,
210 std::unique_ptr<blink::WebServiceWorkerClientCallbacks>) override; 210 std::unique_ptr<blink::WebServiceWorkerClientCallbacks>) override;
211 void SkipWaiting(std::unique_ptr<blink::WebServiceWorkerSkipWaitingCallbacks> 211 void SkipWaiting(std::unique_ptr<blink::WebServiceWorkerSkipWaitingCallbacks>
212 callbacks) override; 212 callbacks) override;
213 void Claim(std::unique_ptr<blink::WebServiceWorkerClientsClaimCallbacks> 213 void Claim(std::unique_ptr<blink::WebServiceWorkerClientsClaimCallbacks>
214 callbacks) override; 214 callbacks) override;
215 void RegisterForeignFetchScopes( 215 void RegisterForeignFetchScopes(
216 const int event_id,
216 const blink::WebVector<blink::WebURL>& sub_scopes, 217 const blink::WebVector<blink::WebURL>& sub_scopes,
217 const blink::WebVector<blink::WebSecurityOrigin>& origins) override; 218 const blink::WebVector<blink::WebSecurityOrigin>& origins) override;
218 219
219 private: 220 private:
221 // The key is the unique id of every install event.
222 using InstallEventMethodsMap =
223 std::map<int, mojom::ServiceWorkerInstallEventMethodsAssociatedPtr>;
224
220 struct WorkerContextData; 225 struct WorkerContextData;
221 class NavigationPreloadRequest; 226 class NavigationPreloadRequest;
222 227
223 // Get routing_id for sending message to the ServiceWorkerVersion 228 // Get routing_id for sending message to the ServiceWorkerVersion
224 // in the browser process. 229 // in the browser process.
225 int GetRoutingID() const { return embedded_worker_id_; } 230 int GetRoutingID() const { return embedded_worker_id_; }
226 231
227 void Send(IPC::Message* message); 232 void Send(IPC::Message* message);
228 void SendWorkerStarted(); 233 void SendWorkerStarted();
229 void SetRegistrationInServiceWorkerGlobalScope( 234 void SetRegistrationInServiceWorkerGlobalScope(
230 const ServiceWorkerRegistrationObjectInfo& info, 235 const ServiceWorkerRegistrationObjectInfo& info,
231 const ServiceWorkerVersionAttributes& attrs); 236 const ServiceWorkerVersionAttributes& attrs);
232 237
233 // mojom::ServiceWorkerEventDispatcher 238 // mojom::ServiceWorkerEventDispatcher
239 void DispatchInstallEvent(
240 mojom::ServiceWorkerInstallEventMethodsAssociatedPtrInfo client,
241 const DispatchInstallEventCallback& callback) override;
234 void DispatchActivateEvent( 242 void DispatchActivateEvent(
235 const DispatchActivateEventCallback& callback) override; 243 const DispatchActivateEventCallback& callback) override;
236 void DispatchBackgroundFetchAbortEvent( 244 void DispatchBackgroundFetchAbortEvent(
237 const std::string& tag, 245 const std::string& tag,
238 const DispatchBackgroundFetchAbortEventCallback& callback) override; 246 const DispatchBackgroundFetchAbortEventCallback& callback) override;
239 void DispatchBackgroundFetchClickEvent( 247 void DispatchBackgroundFetchClickEvent(
240 const std::string& tag, 248 const std::string& tag,
241 mojom::BackgroundFetchState state, 249 mojom::BackgroundFetchState state,
242 const DispatchBackgroundFetchClickEventCallback& callback) override; 250 const DispatchBackgroundFetchClickEventCallback& callback) override;
243 void DispatchBackgroundFetchFailEvent( 251 void DispatchBackgroundFetchFailEvent(
(...skipping 29 matching lines...) Expand all
273 const std::string& tag, 281 const std::string& tag,
274 blink::mojom::BackgroundSyncEventLastChance last_chance, 282 blink::mojom::BackgroundSyncEventLastChance last_chance,
275 const DispatchSyncEventCallback& callback) override; 283 const DispatchSyncEventCallback& callback) override;
276 void DispatchPaymentRequestEvent( 284 void DispatchPaymentRequestEvent(
277 int payment_request_id, 285 int payment_request_id,
278 payments::mojom::PaymentAppRequestPtr app_request, 286 payments::mojom::PaymentAppRequestPtr app_request,
279 payments::mojom::PaymentAppResponseCallbackPtr response_callback, 287 payments::mojom::PaymentAppResponseCallbackPtr response_callback,
280 const DispatchPaymentRequestEventCallback& callback) override; 288 const DispatchPaymentRequestEventCallback& callback) override;
281 void Ping(const PingCallback& callback) override; 289 void Ping(const PingCallback& callback) override;
282 290
283 void OnInstallEvent(int request_id);
284 void OnNotificationClickEvent( 291 void OnNotificationClickEvent(
285 int request_id, 292 int request_id,
286 const std::string& notification_id, 293 const std::string& notification_id,
287 const PlatformNotificationData& notification_data, 294 const PlatformNotificationData& notification_data,
288 int action_index, 295 int action_index,
289 const base::NullableString16& reply); 296 const base::NullableString16& reply);
290 void OnNotificationCloseEvent( 297 void OnNotificationCloseEvent(
291 int request_id, 298 int request_id,
292 const std::string& notification_id, 299 const std::string& notification_id,
293 const PlatformNotificationData& notification_data); 300 const PlatformNotificationData& notification_data);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 // Not owned; this object is destroyed when proxy_ becomes invalid. 345 // Not owned; this object is destroyed when proxy_ becomes invalid.
339 blink::WebServiceWorkerContextProxy* proxy_; 346 blink::WebServiceWorkerContextProxy* proxy_;
340 347
341 // This is bound on the worker thread. 348 // This is bound on the worker thread.
342 mojom::ServiceWorkerEventDispatcherRequest pending_dispatcher_request_; 349 mojom::ServiceWorkerEventDispatcherRequest pending_dispatcher_request_;
343 350
344 // This is bound on the main thread. 351 // This is bound on the main thread.
345 scoped_refptr<mojom::ThreadSafeEmbeddedWorkerInstanceHostAssociatedPtr> 352 scoped_refptr<mojom::ThreadSafeEmbeddedWorkerInstanceHostAssociatedPtr>
346 instance_host_; 353 instance_host_;
347 354
355 // Maps every install event id with its corresponding
356 // mojom::ServiceWorkerInstallEventMethodsAssociatedPt.
357 InstallEventMethodsMap install_methods_map_;
shimazu 2017/04/24 05:00:13 Do you have any concerns to put this in WorkerCont
xiaofengzhang 2017/04/25 06:01:29 Done.
358
348 // Renderer-side object corresponding to WebEmbeddedWorkerInstance. 359 // Renderer-side object corresponding to WebEmbeddedWorkerInstance.
349 // This is valid from the ctor to workerContextDestroyed. 360 // This is valid from the ctor to workerContextDestroyed.
350 std::unique_ptr<EmbeddedWorkerInstanceClientImpl> embedded_worker_client_; 361 std::unique_ptr<EmbeddedWorkerInstanceClientImpl> embedded_worker_client_;
351 362
352 // Initialized on the worker thread in workerContextStarted and 363 // Initialized on the worker thread in workerContextStarted and
353 // destructed on the worker thread in willDestroyWorkerContext. 364 // destructed on the worker thread in willDestroyWorkerContext.
354 std::unique_ptr<WorkerContextData> context_; 365 std::unique_ptr<WorkerContextData> context_;
355 366
356 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextClient); 367 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextClient);
357 }; 368 };
358 369
359 } // namespace content 370 } // namespace content
360 371
361 #endif // CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CLIENT_H_ 372 #endif // CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698