Index: content/renderer/service_worker/service_worker_context_client.h |
diff --git a/content/renderer/service_worker/service_worker_context_client.h b/content/renderer/service_worker/service_worker_context_client.h |
index 2686e316ac8aed153985e388c6c2c446880e96ed..4e2752018ec39a7524c02a9b259286b2d8307572 100644 |
--- a/content/renderer/service_worker/service_worker_context_client.h |
+++ b/content/renderer/service_worker/service_worker_context_client.h |
@@ -220,6 +220,8 @@ class ServiceWorkerContextClient : public blink::WebServiceWorkerContextClient, |
const ServiceWorkerFetchRequest& request, |
mojom::FetchEventPreloadHandlePtr preload_handle, |
const DispatchFetchEventCallback& callback) override; |
+ void DispatchPushEvent(const PushEventPayload& payload, |
+ const DispatchPushEventCallback& callback) override; |
void DispatchSyncEvent( |
const std::string& tag, |
blink::mojom::BackgroundSyncEventLastChance last_chance, |
@@ -233,7 +235,6 @@ class ServiceWorkerContextClient : public blink::WebServiceWorkerContextClient, |
const PlatformNotificationData& notification_data, |
int action_index, |
const base::NullableString16& reply); |
- void OnPushEvent(int request_id, const PushEventPayload& payload); |
void OnNotificationCloseEvent( |
int request_id, |
const std::string& notification_id, |
@@ -291,6 +292,15 @@ class ServiceWorkerContextClient : public blink::WebServiceWorkerContextClient, |
// destructed on the worker thread in willDestroyWorkerContext. |
std::unique_ptr<WorkerContextData> context_; |
+ // Use this template in willDestroyWorkerContext to abort all the pending |
+ // events callbacks. |
+ template <typename T> |
+ void AbortPendingEventCallbacks(T& x) { |
+ for (typename T::iterator it(&x); !it.IsAtEnd(); it.Advance()) { |
Peter Beverloo
2016/12/15 17:35:40
nit: s/x/callbacks/
xiaofengzhang
2016/12/16 02:15:49
Acknowledged.
|
+ it.GetCurrentValue()->Run(SERVICE_WORKER_ERROR_ABORT, base::Time::Now()); |
+ } |
+ } |
+ |
Peter Beverloo
2016/12/15 17:35:39
nit: I'd move this to service_worker_context_clien
xiaofengzhang
2016/12/16 02:15:49
Acknowledged.
|
DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextClient); |
}; |