| Index: content/renderer/service_worker/service_worker_script_context.h
|
| diff --git a/content/renderer/service_worker/service_worker_script_context.h b/content/renderer/service_worker/service_worker_script_context.h
|
| index 9013795d09aa4aecb6c1bfef909cc8cdb1ee57ed..9d48ffdd81990d054ba38e247468d7d2fb6b091a 100644
|
| --- a/content/renderer/service_worker/service_worker_script_context.h
|
| +++ b/content/renderer/service_worker/service_worker_script_context.h
|
| @@ -15,6 +15,7 @@
|
| #include "base/strings/string16.h"
|
| #include "base/time/time.h"
|
| #include "content/child/webmessageportchannel_impl.h"
|
| +#include "content/common/background_sync_service.mojom.h"
|
| #include "content/common/service_worker/service_worker_types.h"
|
| #include "third_party/WebKit/public/platform/WebGeofencingEventType.h"
|
| #include "third_party/WebKit/public/platform/WebMessagePortChannel.h"
|
| @@ -43,6 +44,8 @@ struct NavigatorConnectClient;
|
| struct PlatformNotificationData;
|
| struct ServiceWorkerClientInfo;
|
|
|
| +using SyncCallback = mojo::Callback<void(BackgroundSyncEventStatus)>;
|
| +
|
| // TODO(kinuko): This should implement WebServiceWorkerContextClient
|
| // rather than having EmbeddedWorkerContextClient implement it.
|
| // See the header comment in embedded_worker_context_client.h for the
|
| @@ -102,6 +105,8 @@ class ServiceWorkerScriptContext {
|
| // in the browser process.
|
| int GetRoutingID() const;
|
|
|
| + void DispatchSyncEvent(const SyncCallback& callbacks);
|
| +
|
| private:
|
| typedef IDMap<blink::WebServiceWorkerClientsCallbacks, IDMapOwnPointer>
|
| ClientsCallbacksMap;
|
| @@ -111,11 +116,12 @@ class ServiceWorkerScriptContext {
|
| ClientCallbacksMap;
|
| typedef IDMap<blink::WebServiceWorkerSkipWaitingCallbacks, IDMapOwnPointer>
|
| SkipWaitingCallbacksMap;
|
| + typedef IDMap<const mojo::Callback<void(BackgroundSyncEventStatus)>,
|
| + IDMapExternalPointer> SyncEventCallbacksMap;
|
|
|
| void OnActivateEvent(int request_id);
|
| void OnInstallEvent(int request_id);
|
| void OnFetchEvent(int request_id, const ServiceWorkerFetchRequest& request);
|
| - void OnSyncEvent(int request_id);
|
| void OnNotificationClickEvent(
|
| int request_id,
|
| int64_t persistent_notification_id,
|
| @@ -177,6 +183,9 @@ class ServiceWorkerScriptContext {
|
| // Pending callbacks for ClaimClients().
|
| ClaimClientsCallbacksMap pending_claim_clients_callbacks_;
|
|
|
| + // Pending callbacks for Background Sync Events
|
| + SyncEventCallbacksMap sync_event_callbacks_;
|
| +
|
| // Capture timestamps for UMA
|
| std::map<int, base::TimeTicks> activate_start_timings_;
|
| std::map<int, base::TimeTicks> fetch_start_timings_;
|
|
|