| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "config.h" | 5 #include "config.h" |
| 6 #include "FetchEvent.h" | 6 #include "FetchEvent.h" |
| 7 | 7 |
| 8 #include "core/events/ThreadLocalEventNames.h" | 8 #include "core/events/ThreadLocalEventNames.h" |
| 9 #include "modules/serviceworkers/ServiceWorkerGlobalScope.h" | 9 #include "modules/serviceworkers/ServiceWorkerGlobalScope.h" |
| 10 #include "wtf/RefPtr.h" | 10 #include "wtf/RefPtr.h" |
| 11 | 11 |
| 12 namespace WebCore { | 12 namespace WebCore { |
| 13 | 13 |
| 14 PassRefPtrWillBeRawPtr<FetchEvent> FetchEvent::create() | 14 PassRefPtr<FetchEvent> FetchEvent::create() |
| 15 { | 15 { |
| 16 return adoptRefWillBeRefCountedGarbageCollected(new FetchEvent()); | 16 return adoptRef(new FetchEvent()); |
| 17 } | 17 } |
| 18 | 18 |
| 19 PassRefPtrWillBeRawPtr<FetchEvent> FetchEvent::create(PassRefPtr<RespondWithObse
rver> observer) | 19 PassRefPtr<FetchEvent> FetchEvent::create(PassRefPtr<RespondWithObserver> observ
er) |
| 20 { | 20 { |
| 21 return adoptRefWillBeRefCountedGarbageCollected(new FetchEvent(observer)); | 21 return adoptRef(new FetchEvent(observer)); |
| 22 } | 22 } |
| 23 | 23 |
| 24 void FetchEvent::respondWith(const ScriptValue& value) | 24 void FetchEvent::respondWith(const ScriptValue& value) |
| 25 { | 25 { |
| 26 m_observer->respondWith(value); | 26 m_observer->respondWith(value); |
| 27 } | 27 } |
| 28 | 28 |
| 29 const AtomicString& FetchEvent::interfaceName() const | 29 const AtomicString& FetchEvent::interfaceName() const |
| 30 { | 30 { |
| 31 return EventNames::FetchEvent; | 31 return EventNames::FetchEvent; |
| 32 } | 32 } |
| 33 | 33 |
| 34 FetchEvent::FetchEvent() | 34 FetchEvent::FetchEvent() |
| 35 { | 35 { |
| 36 ScriptWrappable::init(this); | 36 ScriptWrappable::init(this); |
| 37 } | 37 } |
| 38 | 38 |
| 39 FetchEvent::FetchEvent(PassRefPtr<RespondWithObserver> observer) | 39 FetchEvent::FetchEvent(PassRefPtr<RespondWithObserver> observer) |
| 40 : Event(EventTypeNames::fetch, /*canBubble=*/false, /*cancelable=*/true) | 40 : Event(EventTypeNames::fetch, /*canBubble=*/false, /*cancelable=*/true) |
| 41 , m_observer(observer) | 41 , m_observer(observer) |
| 42 { | 42 { |
| 43 ScriptWrappable::init(this); | 43 ScriptWrappable::init(this); |
| 44 } | 44 } |
| 45 | 45 |
| 46 void FetchEvent::trace(Visitor* visitor) | |
| 47 { | |
| 48 Event::trace(visitor); | |
| 49 } | |
| 50 | |
| 51 } // namespace WebCore | 46 } // namespace WebCore |
| OLD | NEW |