| OLD | NEW |
| 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/BackgroundFetchedEvent.h" | 5 #include "modules/background_fetch/BackgroundFetchedEvent.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ScriptPromiseResolver.h" | 7 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 8 #include "bindings/core/v8/ScriptState.h" | 8 #include "bindings/core/v8/ScriptState.h" |
| 9 #include "core/dom/DOMException.h" | 9 #include "core/dom/DOMException.h" |
| 10 #include "modules/EventModulesNames.h" | 10 #include "modules/EventModulesNames.h" |
| 11 #include "modules/background_fetch/BackgroundFetchBridge.h" | 11 #include "modules/background_fetch/BackgroundFetchBridge.h" |
| 12 #include "modules/background_fetch/BackgroundFetchSettledRequest.h" | 12 #include "modules/background_fetch/BackgroundFetchSettledFetch.h" |
| 13 #include "modules/background_fetch/BackgroundFetchedEventInit.h" | 13 #include "modules/background_fetch/BackgroundFetchedEventInit.h" |
| 14 | 14 |
| 15 namespace blink { | 15 namespace blink { |
| 16 | 16 |
| 17 BackgroundFetchedEvent::BackgroundFetchedEvent( | 17 BackgroundFetchedEvent::BackgroundFetchedEvent( |
| 18 const AtomicString& type, | 18 const AtomicString& type, |
| 19 const BackgroundFetchedEventInit& init, | 19 const BackgroundFetchedEventInit& init, |
| 20 ServiceWorkerRegistration* registration) | 20 ServiceWorkerRegistration* registration) |
| 21 : BackgroundFetchEvent(type, init), | 21 : BackgroundFetchEvent(type, init), |
| 22 m_completedFetches(init.completedFetches()), | 22 m_fetches(init.fetches()), |
| 23 m_registration(registration) {} | 23 m_registration(registration) {} |
| 24 | 24 |
| 25 BackgroundFetchedEvent::~BackgroundFetchedEvent() = default; | 25 BackgroundFetchedEvent::~BackgroundFetchedEvent() = default; |
| 26 | 26 |
| 27 HeapVector<Member<BackgroundFetchSettledRequest>> | 27 HeapVector<Member<BackgroundFetchSettledFetch>> |
| 28 BackgroundFetchedEvent::completedFetches() const { | 28 BackgroundFetchedEvent::fetches() const { |
| 29 return m_completedFetches; | 29 return m_fetches; |
| 30 } | 30 } |
| 31 | 31 |
| 32 ScriptPromise BackgroundFetchedEvent::updateUI(ScriptState* scriptState, | 32 ScriptPromise BackgroundFetchedEvent::updateUI(ScriptState* scriptState, |
| 33 const String& title) { | 33 const String& title) { |
| 34 if (!m_registration) { | 34 if (!m_registration) { |
| 35 // Return a Promise that will never settle when a developer calls this | 35 // Return a Promise that will never settle when a developer calls this |
| 36 // method on a BackgroundFetchedEvent instance they created themselves. | 36 // method on a BackgroundFetchedEvent instance they created themselves. |
| 37 return ScriptPromise(); | 37 return ScriptPromise(); |
| 38 } | 38 } |
| 39 | 39 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 61 } | 61 } |
| 62 | 62 |
| 63 NOTREACHED(); | 63 NOTREACHED(); |
| 64 } | 64 } |
| 65 | 65 |
| 66 const AtomicString& BackgroundFetchedEvent::interfaceName() const { | 66 const AtomicString& BackgroundFetchedEvent::interfaceName() const { |
| 67 return EventNames::BackgroundFetchedEvent; | 67 return EventNames::BackgroundFetchedEvent; |
| 68 } | 68 } |
| 69 | 69 |
| 70 DEFINE_TRACE(BackgroundFetchedEvent) { | 70 DEFINE_TRACE(BackgroundFetchedEvent) { |
| 71 visitor->trace(m_completedFetches); | 71 visitor->trace(m_fetches); |
| 72 visitor->trace(m_registration); | 72 visitor->trace(m_registration); |
| 73 BackgroundFetchEvent::trace(visitor); | 73 BackgroundFetchEvent::trace(visitor); |
| 74 } | 74 } |
| 75 | 75 |
| 76 } // namespace blink | 76 } // namespace blink |
| OLD | NEW |