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

Unified Diff: third_party/WebKit/Source/modules/background_fetch/BackgroundFetchFailEvent.cpp

Issue 2767093004: Implement the BackgroundFetch{Fail,ed} Service Worker events (Closed)
Patch Set: add missing uma 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
Index: third_party/WebKit/Source/modules/background_fetch/BackgroundFetchFailEvent.cpp
diff --git a/third_party/WebKit/Source/modules/background_fetch/BackgroundFetchFailEvent.cpp b/third_party/WebKit/Source/modules/background_fetch/BackgroundFetchFailEvent.cpp
index 15508d3a5179d6978bbe10bacd1cfec94ca653d4..a6463051ee909666c85e976c711fe78947beab44 100644
--- a/third_party/WebKit/Source/modules/background_fetch/BackgroundFetchFailEvent.cpp
+++ b/third_party/WebKit/Source/modules/background_fetch/BackgroundFetchFailEvent.cpp
@@ -7,14 +7,34 @@
#include "modules/EventModulesNames.h"
#include "modules/background_fetch/BackgroundFetchFailEventInit.h"
#include "modules/background_fetch/BackgroundFetchSettledFetch.h"
+#include "modules/fetch/Request.h"
+#include "modules/fetch/Response.h"
+#include "public/platform/modules/background_fetch/WebBackgroundFetchSettledFetch.h"
namespace blink {
BackgroundFetchFailEvent::BackgroundFetchFailEvent(
const AtomicString& type,
- const BackgroundFetchFailEventInit& init)
- : BackgroundFetchEvent(type, init, nullptr /* observer */),
- m_fetches(init.fetches()) {}
+ const BackgroundFetchFailEventInit& initializer)
+ : BackgroundFetchEvent(type, initializer, nullptr /* observer */),
+ m_fetches(initializer.fetches()) {}
+
+BackgroundFetchFailEvent::BackgroundFetchFailEvent(
+ const AtomicString& type,
+ const BackgroundFetchFailEventInit& initializer,
+ const WebVector<WebBackgroundFetchSettledFetch>& fetches,
+ ScriptState* scriptState,
+ WaitUntilObserver* observer)
+ : BackgroundFetchEvent(type, initializer, observer) {
+ m_fetches.reserveInitialCapacity(fetches.size());
+ for (const WebBackgroundFetchSettledFetch& fetch : fetches) {
+ auto* settledFetch = BackgroundFetchSettledFetch::create(
+ Request::create(scriptState, fetch.request),
+ Response::create(scriptState, fetch.response));
+
+ m_fetches.push_back(settledFetch);
+ }
+}
BackgroundFetchFailEvent::~BackgroundFetchFailEvent() = default;

Powered by Google App Engine
This is Rietveld 408576698