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

Unified Diff: Source/web/ServiceWorkerGlobalScopeProxy.cpp

Issue 1220223003: [Background Sync] Add sync registration details to onsync event (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix: Missing words in comment Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/web/ServiceWorkerGlobalScopeProxy.h ('k') | public/web/WebServiceWorkerContextProxy.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « Source/web/ServiceWorkerGlobalScopeProxy.h ('k') | public/web/WebServiceWorkerContextProxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698