Index: Source/web/ServiceWorkerGlobalScopeProxy.cpp |
diff --git a/Source/web/ServiceWorkerGlobalScopeProxy.cpp b/Source/web/ServiceWorkerGlobalScopeProxy.cpp |
index 288c100ca45b82a11eb761e744ef23bce2836d5b..58a8aa907b9933b642e2477d887e23e456708908 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" |
@@ -155,6 +156,8 @@ void ServiceWorkerGlobalScopeProxy::dispatchPushEvent(int eventID, const WebStri |
m_workerGlobalScope->dispatchExtendableEvent(event.release(), observer); |
} |
+// FIXME: 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); |
@@ -168,6 +171,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); |