Index: Source/web/ServiceWorkerGlobalScopeProxy.cpp |
diff --git a/Source/web/ServiceWorkerGlobalScopeProxy.cpp b/Source/web/ServiceWorkerGlobalScopeProxy.cpp |
index 95001ffd7e9203328c1e4b23fdf12637458e40a8..3d0a55410be7a00e2c8ef9842758a1dc75683b9d 100644 |
--- a/Source/web/ServiceWorkerGlobalScopeProxy.cpp |
+++ b/Source/web/ServiceWorkerGlobalScopeProxy.cpp |
@@ -40,6 +40,7 @@ |
#include "core/inspector/ConsoleMessage.h" |
#include "core/workers/WorkerGlobalScope.h" |
#include "modules/background_sync/SyncEvent.h" |
+#include "modules/background_sync/SyncRegistration.h" |
#include "modules/fetch/Headers.h" |
#include "modules/geofencing/CircularGeofencingRegion.h" |
#include "modules/geofencing/GeofencingEvent.h" |
@@ -160,6 +161,8 @@ void ServiceWorkerGlobalScopeProxy::dispatchServicePortConnectEvent(WebServicePo |
collection->dispatchConnectEvent(callbacks.release(), targetURL, origin, portID); |
} |
+// TODO(iclelland): Remove this method in favor of the two-parameter version |
+// below, once all call sites have been updated. |
void ServiceWorkerGlobalScopeProxy::dispatchSyncEvent(int eventID) |
{ |
ASSERT(m_workerGlobalScope); |
@@ -173,6 +176,18 @@ void ServiceWorkerGlobalScopeProxy::dispatchSyncEvent(int eventID) |
m_workerGlobalScope->dispatchExtendableEvent(event.release(), observer); |
} |
+void ServiceWorkerGlobalScopeProxy::dispatchSyncEvent(int eventID, const WebSyncRegistration& registration) |
+{ |
+ ASSERT(m_workerGlobalScope); |
+ if (!RuntimeEnabledFeatures::backgroundSyncEnabled()) { |
+ ServiceWorkerGlobalScopeClient::from(m_workerGlobalScope)->didHandleSyncEvent(eventID, WebServiceWorkerEventResultCompleted); |
+ return; |
+ } |
+ WaitUntilObserver* observer = WaitUntilObserver::create(m_workerGlobalScope, WaitUntilObserver::Sync, eventID); |
+ RefPtrWillBeRawPtr<Event> event(SyncEvent::create(EventTypeNames::sync, SyncRegistration::create(registration, m_workerGlobalScope->registration()), observer)); |
+ m_workerGlobalScope->dispatchExtendableEvent(event.release(), observer); |
+} |
+ |
void ServiceWorkerGlobalScopeProxy::dispatchCrossOriginConnectEvent(int eventID, const WebCrossOriginServiceWorkerClient& webClient) |
{ |
ASSERT(m_workerGlobalScope); |