OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
185 m_elementTracks.insert(index, track); | 185 m_elementTracks.insert(index, track); |
186 } else if (track->trackType() == TextTrack::InBand) { | 186 } else if (track->trackType() == TextTrack::InBand) { |
187 // Insert tracks added for in-band in the media file order. | 187 // Insert tracks added for in-band in the media file order. |
188 size_t index = static_cast<InbandTextTrack*>(track.get())->inbandTrackIn dex(); | 188 size_t index = static_cast<InbandTextTrack*>(track.get())->inbandTrackIn dex(); |
189 m_inbandTracks.insert(index, track); | 189 m_inbandTracks.insert(index, track); |
190 } else | 190 } else |
191 ASSERT_NOT_REACHED(); | 191 ASSERT_NOT_REACHED(); |
192 | 192 |
193 invalidateTrackIndexesAfterTrack(track.get()); | 193 invalidateTrackIndexesAfterTrack(track.get()); |
194 | 194 |
195 ASSERT(!track->mediaElement() || track->mediaElement() == m_owner); | 195 ASSERT(!track->trackList() || track->trackList() == this); |
acolwell GONE FROM CHROMIUM
2013/12/06 01:35:54
"track->trackList() == this" seems a little weird.
| |
196 track->setMediaElement(m_owner); | 196 track->setTrackList(this); |
197 | 197 |
198 scheduleAddTrackEvent(track.release()); | 198 scheduleAddTrackEvent(track.release()); |
199 } | 199 } |
200 | 200 |
201 void TextTrackList::remove(TextTrack* track) | 201 void TextTrackList::remove(TextTrack* track) |
202 { | 202 { |
203 Vector<RefPtr<TextTrack> >* tracks = 0; | 203 Vector<RefPtr<TextTrack> >* tracks = 0; |
204 RefPtr<InbandTextTrack> inbandTrack; | 204 RefPtr<InbandTextTrack> inbandTrack; |
205 | 205 |
206 if (track->trackType() == TextTrack::TrackElement) { | 206 if (track->trackType() == TextTrack::TrackElement) { |
207 tracks = &m_elementTracks; | 207 tracks = &m_elementTracks; |
208 } else if (track->trackType() == TextTrack::AddTrack) { | 208 } else if (track->trackType() == TextTrack::AddTrack) { |
209 tracks = &m_addTrackTracks; | 209 tracks = &m_addTrackTracks; |
210 } else if (track->trackType() == TextTrack::InBand) { | 210 } else if (track->trackType() == TextTrack::InBand) { |
211 tracks = &m_inbandTracks; | 211 tracks = &m_inbandTracks; |
212 inbandTrack = static_cast<InbandTextTrack*>(track); | 212 inbandTrack = static_cast<InbandTextTrack*>(track); |
213 } else { | 213 } else { |
214 ASSERT_NOT_REACHED(); | 214 ASSERT_NOT_REACHED(); |
215 } | 215 } |
216 | 216 |
217 size_t index = tracks->find(track); | 217 size_t index = tracks->find(track); |
218 if (index == kNotFound) | 218 if (index == kNotFound) |
219 return; | 219 return; |
220 | 220 |
221 invalidateTrackIndexesAfterTrack(track); | 221 invalidateTrackIndexesAfterTrack(track); |
222 | 222 |
223 ASSERT(track->mediaElement() == m_owner); | 223 ASSERT(track->trackList() == this); |
224 track->setMediaElement(0); | 224 track->setTrackList(0); |
225 | 225 |
226 tracks->remove(index); | 226 tracks->remove(index); |
227 | 227 |
228 if (inbandTrack) | 228 if (inbandTrack) |
229 inbandTrack->trackRemoved(); | 229 inbandTrack->trackRemoved(); |
230 | 230 |
231 scheduleRemoveTrackEvent(track); | 231 scheduleRemoveTrackEvent(track); |
232 } | 232 } |
233 | 233 |
234 bool TextTrackList::contains(TextTrack* track) const | 234 bool TextTrackList::contains(TextTrack* track) const |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
307 // interface, with the track attribute initialized to the text track's | 307 // interface, with the track attribute initialized to the text track's |
308 // TextTrack object, at the media element's textTracks attribute's | 308 // TextTrack object, at the media element's textTracks attribute's |
309 // TextTrackList object. | 309 // TextTrackList object. |
310 scheduleTrackEvent(EventTypeNames::removetrack, track); | 310 scheduleTrackEvent(EventTypeNames::removetrack, track); |
311 } | 311 } |
312 | 312 |
313 Node* TextTrackList::owner() const | 313 Node* TextTrackList::owner() const |
314 { | 314 { |
315 return m_owner; | 315 return m_owner; |
316 } | 316 } |
OLD | NEW |