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

Side by Side Diff: third_party/WebKit/Source/modules/background_fetch/BackgroundFetchFailEvent.cpp

Issue 2767093004: Implement the BackgroundFetch{Fail,ed} Service Worker events (Closed)
Patch Set: forward declare the data view Created 3 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/background_fetch/BackgroundFetchFailEvent.h" 5 #include "modules/background_fetch/BackgroundFetchFailEvent.h"
6 6
7 #include "modules/EventModulesNames.h" 7 #include "modules/EventModulesNames.h"
8 #include "modules/background_fetch/BackgroundFetchFailEventInit.h" 8 #include "modules/background_fetch/BackgroundFetchFailEventInit.h"
9 #include "modules/background_fetch/BackgroundFetchSettledFetch.h" 9 #include "modules/background_fetch/BackgroundFetchSettledFetch.h"
10 #include "modules/fetch/Request.h"
11 #include "modules/fetch/Response.h"
12 #include "public/platform/modules/background_fetch/WebBackgroundFetchSettledFetc h.h"
10 13
11 namespace blink { 14 namespace blink {
12 15
13 BackgroundFetchFailEvent::BackgroundFetchFailEvent( 16 BackgroundFetchFailEvent::BackgroundFetchFailEvent(
14 const AtomicString& type, 17 const AtomicString& type,
15 const BackgroundFetchFailEventInit& init) 18 const BackgroundFetchFailEventInit& initializer)
16 : BackgroundFetchEvent(type, init, nullptr /* observer */), 19 : BackgroundFetchEvent(type, initializer, nullptr /* observer */),
17 m_fetches(init.fetches()) {} 20 m_fetches(initializer.fetches()) {}
21
22 BackgroundFetchFailEvent::BackgroundFetchFailEvent(
23 const AtomicString& type,
24 const BackgroundFetchFailEventInit& initializer,
25 const WebVector<WebBackgroundFetchSettledFetch>& fetches,
26 ScriptState* scriptState,
27 WaitUntilObserver* observer)
28 : BackgroundFetchEvent(type, initializer, observer) {
29 m_fetches.reserveInitialCapacity(fetches.size());
30 for (const WebBackgroundFetchSettledFetch& fetch : fetches) {
31 auto* settledFetch = BackgroundFetchSettledFetch::create(
32 Request::create(scriptState, fetch.request),
33 Response::create(scriptState, fetch.response));
34
35 m_fetches.push_back(settledFetch);
36 }
37 }
18 38
19 BackgroundFetchFailEvent::~BackgroundFetchFailEvent() = default; 39 BackgroundFetchFailEvent::~BackgroundFetchFailEvent() = default;
20 40
21 HeapVector<Member<BackgroundFetchSettledFetch>> 41 HeapVector<Member<BackgroundFetchSettledFetch>>
22 BackgroundFetchFailEvent::fetches() const { 42 BackgroundFetchFailEvent::fetches() const {
23 return m_fetches; 43 return m_fetches;
24 } 44 }
25 45
26 const AtomicString& BackgroundFetchFailEvent::interfaceName() const { 46 const AtomicString& BackgroundFetchFailEvent::interfaceName() const {
27 return EventNames::BackgroundFetchFailEvent; 47 return EventNames::BackgroundFetchFailEvent;
28 } 48 }
29 49
30 DEFINE_TRACE(BackgroundFetchFailEvent) { 50 DEFINE_TRACE(BackgroundFetchFailEvent) {
31 visitor->trace(m_fetches); 51 visitor->trace(m_fetches);
32 BackgroundFetchEvent::trace(visitor); 52 BackgroundFetchEvent::trace(visitor);
33 } 53 }
34 54
35 } // namespace blink 55 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698