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

Unified Diff: third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp

Issue 2767093004: Implement the BackgroundFetch{Fail,ed} Service Worker events (Closed)
Patch Set: forward declare the data view Created 3 years, 9 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 | « third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.h ('k') | third_party/WebKit/public/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp
diff --git a/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp b/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp
index 2b130e66be030703ee5766ac85f774426aa204d3..87b0531c2fa0dcc1bf616b42e4378bd393bce1ea 100644
--- a/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp
+++ b/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp
@@ -46,6 +46,10 @@
#include "modules/background_fetch/BackgroundFetchClickEventInit.h"
#include "modules/background_fetch/BackgroundFetchEvent.h"
#include "modules/background_fetch/BackgroundFetchEventInit.h"
+#include "modules/background_fetch/BackgroundFetchFailEvent.h"
+#include "modules/background_fetch/BackgroundFetchFailEventInit.h"
+#include "modules/background_fetch/BackgroundFetchedEvent.h"
+#include "modules/background_fetch/BackgroundFetchedEventInit.h"
#include "modules/background_sync/SyncEvent.h"
#include "modules/fetch/Headers.h"
#include "modules/notifications/Notification.h"
@@ -145,6 +149,48 @@ void ServiceWorkerGlobalScopeProxy::dispatchBackgroundFetchClickEvent(
workerGlobalScope()->dispatchExtendableEvent(event, observer);
}
+void ServiceWorkerGlobalScopeProxy::dispatchBackgroundFetchFailEvent(
+ int eventID,
+ const WebString& tag,
+ const WebVector<WebBackgroundFetchSettledFetch>& fetches) {
+ WaitUntilObserver* observer = WaitUntilObserver::create(
+ workerGlobalScope(), WaitUntilObserver::BackgroundFetchFail, eventID);
+
+ BackgroundFetchFailEventInit init;
+ init.setTag(tag);
+
+ ScriptState* scriptState =
+ workerGlobalScope()->scriptController()->getScriptState();
+ ScriptState::Scope scope(scriptState);
+
+ BackgroundFetchFailEvent* event =
+ BackgroundFetchFailEvent::create(EventTypeNames::backgroundfetchfail,
+ init, fetches, scriptState, observer);
+
+ workerGlobalScope()->dispatchExtendableEvent(event, observer);
+}
+
+void ServiceWorkerGlobalScopeProxy::dispatchBackgroundFetchedEvent(
+ int eventID,
+ const WebString& tag,
+ const WebVector<WebBackgroundFetchSettledFetch>& fetches) {
+ WaitUntilObserver* observer = WaitUntilObserver::create(
+ workerGlobalScope(), WaitUntilObserver::BackgroundFetched, eventID);
+
+ BackgroundFetchedEventInit init;
+ init.setTag(tag);
+
+ ScriptState* scriptState =
+ workerGlobalScope()->scriptController()->getScriptState();
+ ScriptState::Scope scope(scriptState);
+
+ BackgroundFetchedEvent* event = BackgroundFetchedEvent::create(
+ EventTypeNames::backgroundfetched, init, fetches, scriptState, observer,
+ m_workerGlobalScope->registration());
+
+ workerGlobalScope()->dispatchExtendableEvent(event, observer);
+}
+
void ServiceWorkerGlobalScopeProxy::dispatchActivateEvent(int eventID) {
WaitUntilObserver* observer = WaitUntilObserver::create(
workerGlobalScope(), WaitUntilObserver::Activate, eventID);
« no previous file with comments | « third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.h ('k') | third_party/WebKit/public/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698