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 #include "core/html/track/TrackEventInit.h" |
13 | 13 |
14 namespace blink { | 14 namespace blink { |
15 | 15 |
16 template<class T> | 16 template<class T> |
17 class TrackListBase : public EventTargetWithInlineData, public RefCountedWillBeN
oBase<TrackListBase<T>> { | 17 class TrackListBase : public EventTargetWithInlineData, public RefCountedWillBeN
oBase<TrackListBase<T>> { |
18 REFCOUNTED_EVENT_TARGET(TrackListBase); | 18 REFCOUNTED_EVENT_TARGET(TrackListBase); |
19 public: | 19 public: |
20 explicit TrackListBase(HTMLMediaElement* mediaElement) | 20 explicit TrackListBase(HTMLMediaElement* mediaElement) |
21 : m_mediaElement(mediaElement) | 21 : m_mediaElement(mediaElement) |
22 { | 22 { |
23 } | 23 } |
24 | 24 |
25 virtual ~TrackListBase() | 25 ~TrackListBase() override |
26 { | 26 { |
27 #if !ENABLE(OILPAN) | 27 #if !ENABLE(OILPAN) |
28 ASSERT(m_tracks.isEmpty()); | 28 ASSERT(m_tracks.isEmpty()); |
29 ASSERT(!m_mediaElement); | 29 ASSERT(!m_mediaElement); |
30 #endif | 30 #endif |
31 } | 31 } |
32 | 32 |
33 unsigned length() const { return m_tracks.size(); } | 33 unsigned length() const { return m_tracks.size(); } |
34 T* anonymousIndexedGetter(unsigned index) const | 34 T* anonymousIndexedGetter(unsigned index) const |
35 { | 35 { |
(...skipping 10 matching lines...) Expand all Loading... |
46 } | 46 } |
47 | 47 |
48 return nullptr; | 48 return nullptr; |
49 } | 49 } |
50 | 50 |
51 DEFINE_ATTRIBUTE_EVENT_LISTENER(change); | 51 DEFINE_ATTRIBUTE_EVENT_LISTENER(change); |
52 DEFINE_ATTRIBUTE_EVENT_LISTENER(addtrack); | 52 DEFINE_ATTRIBUTE_EVENT_LISTENER(addtrack); |
53 DEFINE_ATTRIBUTE_EVENT_LISTENER(removetrack); | 53 DEFINE_ATTRIBUTE_EVENT_LISTENER(removetrack); |
54 | 54 |
55 // EventTarget interface | 55 // EventTarget interface |
56 virtual ExecutionContext* executionContext() const override | 56 ExecutionContext* executionContext() const override |
57 { | 57 { |
58 if (m_mediaElement) | 58 if (m_mediaElement) |
59 return m_mediaElement->executionContext(); | 59 return m_mediaElement->executionContext(); |
60 return nullptr; | 60 return nullptr; |
61 } | 61 } |
62 | 62 |
63 #if !ENABLE(OILPAN) | 63 #if !ENABLE(OILPAN) |
64 void shutdown() | 64 void shutdown() |
65 { | 65 { |
66 removeAll(); | 66 removeAll(); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 m_mediaElement->scheduleEvent(event); | 123 m_mediaElement->scheduleEvent(event); |
124 } | 124 } |
125 | 125 |
126 WillBeHeapVector<RefPtrWillBeMember<T>> m_tracks; | 126 WillBeHeapVector<RefPtrWillBeMember<T>> m_tracks; |
127 RawPtrWillBeMember<HTMLMediaElement> m_mediaElement; | 127 RawPtrWillBeMember<HTMLMediaElement> m_mediaElement; |
128 }; | 128 }; |
129 | 129 |
130 } // namespace blink | 130 } // namespace blink |
131 | 131 |
132 #endif | 132 #endif |
OLD | NEW |