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 "bindings/core/v8/TraceWrapperMember.h" | 8 #include "bindings/core/v8/TraceWrapperMember.h" |
9 #include "core/events/EventTarget.h" | 9 #include "core/events/EventTarget.h" |
10 #include "core/html/HTMLMediaElement.h" | 10 #include "core/html/HTMLMediaElement.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 } | 55 } |
56 | 56 |
57 void remove(WebMediaPlayer::TrackId trackId) { | 57 void remove(WebMediaPlayer::TrackId trackId) { |
58 for (unsigned i = 0; i < m_tracks.size(); ++i) { | 58 for (unsigned i = 0; i < m_tracks.size(); ++i) { |
59 if (m_tracks[i]->id() != trackId) | 59 if (m_tracks[i]->id() != trackId) |
60 continue; | 60 continue; |
61 | 61 |
62 m_tracks[i]->setMediaElement(0); | 62 m_tracks[i]->setMediaElement(0); |
63 scheduleEvent( | 63 scheduleEvent( |
64 TrackEvent::create(EventTypeNames::removetrack, m_tracks[i].get())); | 64 TrackEvent::create(EventTypeNames::removetrack, m_tracks[i].get())); |
65 m_tracks.remove(i); | 65 m_tracks.erase(i); |
66 return; | 66 return; |
67 } | 67 } |
68 NOTREACHED(); | 68 NOTREACHED(); |
69 } | 69 } |
70 | 70 |
71 void removeAll() { | 71 void removeAll() { |
72 for (const auto& track : m_tracks) | 72 for (const auto& track : m_tracks) |
73 track->setMediaElement(0); | 73 track->setMediaElement(0); |
74 | 74 |
75 m_tracks.clear(); | 75 m_tracks.clear(); |
(...skipping 22 matching lines...) Expand all Loading... |
98 m_mediaElement->scheduleEvent(event); | 98 m_mediaElement->scheduleEvent(event); |
99 } | 99 } |
100 | 100 |
101 HeapVector<TraceWrapperMember<T>> m_tracks; | 101 HeapVector<TraceWrapperMember<T>> m_tracks; |
102 Member<HTMLMediaElement> m_mediaElement; | 102 Member<HTMLMediaElement> m_mediaElement; |
103 }; | 103 }; |
104 | 104 |
105 } // namespace blink | 105 } // namespace blink |
106 | 106 |
107 #endif | 107 #endif |
OLD | NEW |