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

Side by Side Diff: content/browser/service_worker/service_worker_version.h

Issue 1579413004: Move push event dispatching out of ServiceWorkerVersion. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 // asynchronously calls |callback| when it errors out or it gets a response 263 // asynchronously calls |callback| when it errors out or it gets a response
264 // from the worker to notify completion. 264 // from the worker to notify completion.
265 // 265 //
266 // This must be called when the status() is ACTIVATED. 266 // This must be called when the status() is ACTIVATED.
267 void DispatchNotificationClickEvent( 267 void DispatchNotificationClickEvent(
268 const StatusCallback& callback, 268 const StatusCallback& callback,
269 int64_t persistent_notification_id, 269 int64_t persistent_notification_id,
270 const PlatformNotificationData& notification_data, 270 const PlatformNotificationData& notification_data,
271 int action_index); 271 int action_index);
272 272
273 // Sends push event to the associated embedded worker and asynchronously calls
274 // |callback| when it errors out or it gets a response from the worker to
275 // notify completion.
276 //
277 // This must be called when the status() is ACTIVATED.
278 void DispatchPushEvent(const StatusCallback& callback,
279 const std::string& data);
280
281 // Sends a cross origin message event to the associated embedded worker and 273 // Sends a cross origin message event to the associated embedded worker and
282 // asynchronously calls |callback| when the message was sent (or failed to 274 // asynchronously calls |callback| when the message was sent (or failed to
283 // sent). 275 // sent).
284 // It is the responsibility of the code calling this method to make sure that 276 // It is the responsibility of the code calling this method to make sure that
285 // any transferred message ports are put on hold while potentially a process 277 // any transferred message ports are put on hold while potentially a process
286 // for the service worker is spun up. 278 // for the service worker is spun up.
287 // 279 //
288 // This must be called when the status() is ACTIVATED. 280 // This must be called when the status() is ACTIVATED.
289 void DispatchCrossOriginMessageEvent( 281 void DispatchCrossOriginMessageEvent(
290 const NavigatorConnectClient& client, 282 const NavigatorConnectClient& client,
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 MixedRequestTimeouts); 389 MixedRequestTimeouts);
398 390
399 class Metrics; 391 class Metrics;
400 class PingController; 392 class PingController;
401 393
402 enum RequestType { 394 enum RequestType {
403 REQUEST_ACTIVATE, 395 REQUEST_ACTIVATE,
404 REQUEST_INSTALL, 396 REQUEST_INSTALL,
405 REQUEST_FETCH, 397 REQUEST_FETCH,
406 REQUEST_NOTIFICATION_CLICK, 398 REQUEST_NOTIFICATION_CLICK,
407 REQUEST_PUSH,
408 REQUEST_CUSTOM, 399 REQUEST_CUSTOM,
409 NUM_REQUEST_TYPES 400 NUM_REQUEST_TYPES
410 }; 401 };
411 402
412 struct RequestInfo { 403 struct RequestInfo {
413 RequestInfo(int id, 404 RequestInfo(int id,
414 RequestType type, 405 RequestType type,
415 ServiceWorkerMetrics::EventType event_type, 406 ServiceWorkerMetrics::EventType event_type,
416 const base::TimeTicks& expiration, 407 const base::TimeTicks& expiration,
417 TimeoutBehavior timeout_behavior); 408 TimeoutBehavior timeout_behavior);
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 const ServiceWorkerClientQueryOptions& options); 550 const ServiceWorkerClientQueryOptions& options);
560 551
561 void OnActivateEventFinished(int request_id, 552 void OnActivateEventFinished(int request_id,
562 blink::WebServiceWorkerEventResult result); 553 blink::WebServiceWorkerEventResult result);
563 void OnInstallEventFinished(int request_id, 554 void OnInstallEventFinished(int request_id,
564 blink::WebServiceWorkerEventResult result); 555 blink::WebServiceWorkerEventResult result);
565 void OnFetchEventFinished(int request_id, 556 void OnFetchEventFinished(int request_id,
566 ServiceWorkerFetchEventResult result, 557 ServiceWorkerFetchEventResult result,
567 const ServiceWorkerResponse& response); 558 const ServiceWorkerResponse& response);
568 void OnNotificationClickEventFinished(int request_id); 559 void OnNotificationClickEventFinished(int request_id);
569 void OnPushEventFinished(int request_id,
570 blink::WebServiceWorkerEventResult result);
571 void OnOpenWindow(int request_id, GURL url); 560 void OnOpenWindow(int request_id, GURL url);
572 void OnOpenWindowFinished(int request_id, 561 void OnOpenWindowFinished(int request_id,
573 ServiceWorkerStatusCode status, 562 ServiceWorkerStatusCode status,
574 const std::string& client_uuid, 563 const std::string& client_uuid,
575 const ServiceWorkerClientInfo& client_info); 564 const ServiceWorkerClientInfo& client_info);
576 565
577 void OnSetCachedMetadata(const GURL& url, const std::vector<char>& data); 566 void OnSetCachedMetadata(const GURL& url, const std::vector<char>& data);
578 void OnSetCachedMetadataFinished(int64_t callback_id, int result); 567 void OnSetCachedMetadataFinished(int64_t callback_id, int result);
579 void OnClearCachedMetadata(const GURL& url); 568 void OnClearCachedMetadata(const GURL& url);
580 void OnClearCachedMetadataFinished(int64_t callback_id, int result); 569 void OnClearCachedMetadataFinished(int64_t callback_id, int result);
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 std::vector<StatusCallback> stop_callbacks_; 678 std::vector<StatusCallback> stop_callbacks_;
690 std::vector<base::Closure> status_change_callbacks_; 679 std::vector<base::Closure> status_change_callbacks_;
691 680
692 // Message callbacks. (Update HasInflightRequests() too when you update this 681 // Message callbacks. (Update HasInflightRequests() too when you update this
693 // list.) 682 // list.)
694 IDMap<PendingRequest<StatusCallback>, IDMapOwnPointer> activate_requests_; 683 IDMap<PendingRequest<StatusCallback>, IDMapOwnPointer> activate_requests_;
695 IDMap<PendingRequest<StatusCallback>, IDMapOwnPointer> install_requests_; 684 IDMap<PendingRequest<StatusCallback>, IDMapOwnPointer> install_requests_;
696 IDMap<PendingRequest<FetchCallback>, IDMapOwnPointer> fetch_requests_; 685 IDMap<PendingRequest<FetchCallback>, IDMapOwnPointer> fetch_requests_;
697 IDMap<PendingRequest<StatusCallback>, IDMapOwnPointer> 686 IDMap<PendingRequest<StatusCallback>, IDMapOwnPointer>
698 notification_click_requests_; 687 notification_click_requests_;
699 IDMap<PendingRequest<StatusCallback>, IDMapOwnPointer> push_requests_;
700 IDMap<PendingRequest<StatusCallback>, IDMapOwnPointer> custom_requests_; 688 IDMap<PendingRequest<StatusCallback>, IDMapOwnPointer> custom_requests_;
701 689
702 // Stores all open connections to mojo services. Maps the service name to 690 // Stores all open connections to mojo services. Maps the service name to
703 // the actual interface pointer. When a connection is closed it is removed 691 // the actual interface pointer. When a connection is closed it is removed
704 // from this map. 692 // from this map.
705 // mojo_services_[Interface::Name_] is assumed to always contain a 693 // mojo_services_[Interface::Name_] is assumed to always contain a
706 // MojoServiceWrapper<Interface> instance. 694 // MojoServiceWrapper<Interface> instance.
707 base::ScopedPtrHashMap<const char*, scoped_ptr<BaseMojoServiceWrapper>> 695 base::ScopedPtrHashMap<const char*, scoped_ptr<BaseMojoServiceWrapper>>
708 mojo_services_; 696 mojo_services_;
709 697
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
823 if (!ResponseMessage::Dispatch(&message, &callback_, this, param, 811 if (!ResponseMessage::Dispatch(&message, &callback_, this, param,
824 &CallbackType::Run)) 812 &CallbackType::Run))
825 message.set_dispatch_error(); 813 message.set_dispatch_error();
826 814
827 return true; 815 return true;
828 } 816 }
829 817
830 } // namespace content 818 } // namespace content
831 819
832 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ 820 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698