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 #ifndef TrackListBase_h | 5 #ifndef TrackListBase_h |
6 #define TrackListBase_h | 6 #define TrackListBase_h |
7 | 7 |
8 #include "core/events/EventTarget.h" | 8 #include "core/events/EventTarget.h" |
9 | 9 |
10 #include "core/html/HTMLMediaElement.h" | 10 #include "core/html/HTMLMediaElement.h" |
11 #include "core/html/track/TrackEvent.h" | 11 #include "core/html/track/TrackEvent.h" |
| 12 #include "core/html/track/TrackEventInit.h" |
12 | 13 |
13 namespace blink { | 14 namespace blink { |
14 | 15 |
15 template<class T> | 16 template<class T> |
16 class TrackListBase : public RefCountedWillBeGarbageCollectedFinalized<TrackList
Base<T>>, public EventTargetWithInlineData { | 17 class TrackListBase : public RefCountedWillBeGarbageCollectedFinalized<TrackList
Base<T>>, public EventTargetWithInlineData { |
17 REFCOUNTED_EVENT_TARGET(TrackListBase); | 18 REFCOUNTED_EVENT_TARGET(TrackListBase); |
18 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(TrackListBase); | 19 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(TrackListBase); |
19 public: | 20 public: |
20 explicit TrackListBase(HTMLMediaElement* mediaElement) | 21 explicit TrackListBase(HTMLMediaElement* mediaElement) |
21 : m_mediaElement(mediaElement) | 22 : m_mediaElement(mediaElement) |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 void trace(Visitor* visitor) | 112 void trace(Visitor* visitor) |
112 { | 113 { |
113 visitor->trace(m_tracks); | 114 visitor->trace(m_tracks); |
114 visitor->trace(m_mediaElement); | 115 visitor->trace(m_mediaElement); |
115 EventTargetWithInlineData::trace(visitor); | 116 EventTargetWithInlineData::trace(visitor); |
116 } | 117 } |
117 | 118 |
118 private: | 119 private: |
119 void scheduleTrackEvent(const AtomicString& eventName, PassRefPtrWillBeRawPt
r<T> track) | 120 void scheduleTrackEvent(const AtomicString& eventName, PassRefPtrWillBeRawPt
r<T> track) |
120 { | 121 { |
121 TrackEventInit initializer; | 122 RefPtrWillBeRawPtr<Event> event = TrackEvent::create(eventName, track); |
122 initializer.track = track; | |
123 initializer.bubbles = false; | |
124 initializer.cancelable = false; | |
125 RefPtrWillBeRawPtr<Event> event = TrackEvent::create(eventName, initiali
zer); | |
126 event->setTarget(this); | 123 event->setTarget(this); |
127 m_mediaElement->scheduleEvent(event); | 124 m_mediaElement->scheduleEvent(event); |
128 } | 125 } |
129 | 126 |
130 WillBeHeapVector<RefPtrWillBeMember<T>> m_tracks; | 127 WillBeHeapVector<RefPtrWillBeMember<T>> m_tracks; |
131 RawPtrWillBeMember<HTMLMediaElement> m_mediaElement; | 128 RawPtrWillBeMember<HTMLMediaElement> m_mediaElement; |
132 }; | 129 }; |
133 | 130 |
134 } | 131 } |
135 | 132 |
136 #endif | 133 #endif |
OLD | NEW |