OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 10 matching lines...) Expand all Loading... |
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #ifndef TrackEvent_h | 26 #ifndef TrackEvent_h |
27 #define TrackEvent_h | 27 #define TrackEvent_h |
28 | 28 |
29 #include "core/events/Event.h" | 29 #include "core/events/Event.h" |
30 #include "core/html/track/TrackBase.h" | 30 #include "core/html/track/TrackBase.h" |
| 31 #include "core/html/track/TrackEventInit.h" |
31 | 32 |
32 namespace blink { | 33 namespace blink { |
33 | 34 |
34 class VideoTrackOrAudioTrackOrTextTrack; | 35 class VideoTrackOrAudioTrackOrTextTrack; |
35 | 36 |
36 struct TrackEventInit : public EventInit { | |
37 TrackEventInit(); | |
38 | |
39 RefPtrWillBeMember<TrackBase> track; | |
40 }; | |
41 | |
42 class TrackEvent final : public Event { | 37 class TrackEvent final : public Event { |
43 DEFINE_WRAPPERTYPEINFO(); | 38 DEFINE_WRAPPERTYPEINFO(); |
44 public: | 39 public: |
45 virtual ~TrackEvent(); | 40 virtual ~TrackEvent(); |
46 | 41 |
47 static PassRefPtrWillBeRawPtr<TrackEvent> create() | 42 static PassRefPtrWillBeRawPtr<TrackEvent> create() |
48 { | 43 { |
49 return adoptRefWillBeNoop(new TrackEvent); | 44 return adoptRefWillBeNoop(new TrackEvent); |
50 } | 45 } |
51 | 46 |
52 static PassRefPtrWillBeRawPtr<TrackEvent> create(const AtomicString& type, c
onst TrackEventInit& initializer) | 47 static PassRefPtrWillBeRawPtr<TrackEvent> create(const AtomicString& type, c
onst TrackEventInit& initializer) |
53 { | 48 { |
54 return adoptRefWillBeNoop(new TrackEvent(type, initializer)); | 49 return adoptRefWillBeNoop(new TrackEvent(type, initializer)); |
55 } | 50 } |
56 | 51 |
| 52 template <typename T> |
| 53 static PassRefPtrWillBeRawPtr<TrackEvent> create(const AtomicString& type, P
assRefPtrWillBeRawPtr<T> track) |
| 54 { |
| 55 return adoptRefWillBeNoop(new TrackEvent(type, track)); |
| 56 } |
| 57 |
57 virtual const AtomicString& interfaceName() const override; | 58 virtual const AtomicString& interfaceName() const override; |
58 | 59 |
59 void track(VideoTrackOrAudioTrackOrTextTrack&); | 60 void track(VideoTrackOrAudioTrackOrTextTrack&); |
60 | 61 |
61 virtual void trace(Visitor*) override; | 62 virtual void trace(Visitor*) override; |
62 | 63 |
63 private: | 64 private: |
64 TrackEvent(); | 65 TrackEvent(); |
65 TrackEvent(const AtomicString& type, const TrackEventInit& initializer); | 66 TrackEvent(const AtomicString& type, const TrackEventInit& initializer); |
| 67 template <typename T> |
| 68 TrackEvent(const AtomicString& type, PassRefPtrWillBeRawPtr<T> track) |
| 69 : Event(type, false, false) |
| 70 , m_track(track) |
| 71 { |
| 72 } |
66 | 73 |
67 RefPtrWillBeMember<TrackBase> m_track; | 74 RefPtrWillBeMember<TrackBase> m_track; |
68 }; | 75 }; |
69 | 76 |
70 } // namespace blink | 77 } // namespace blink |
71 | 78 |
72 #endif // TrackEvent_h | 79 #endif // TrackEvent_h |
OLD | NEW |