OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #include "core/html/track/CueTimeline.h" | 5 #include "core/html/track/CueTimeline.h" |
6 | 6 |
7 #include "core/events/Event.h" | 7 #include "core/events/Event.h" |
8 #include "core/html/HTMLMediaElement.h" | 8 #include "core/html/HTMLMediaElement.h" |
9 #include "core/html/HTMLTrackElement.h" | 9 #include "core/html/HTMLTrackElement.h" |
10 #include "core/html/track/LoadableTextTrack.h" | 10 #include "core/html/track/LoadableTextTrack.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 // zero-length cues. | 58 // zero-length cues. |
59 double endTime = std::max(cue->startTime(), cue->endTime()); | 59 double endTime = std::max(cue->startTime(), cue->endTime()); |
60 | 60 |
61 CueInterval interval = | 61 CueInterval interval = |
62 m_cueTree.createInterval(cue->startTime(), endTime, cue); | 62 m_cueTree.createInterval(cue->startTime(), endTime, cue); |
63 m_cueTree.remove(interval); | 63 m_cueTree.remove(interval); |
64 | 64 |
65 size_t index = m_currentlyActiveCues.find(interval); | 65 size_t index = m_currentlyActiveCues.find(interval); |
66 if (index != kNotFound) { | 66 if (index != kNotFound) { |
67 DCHECK(cue->isActive()); | 67 DCHECK(cue->isActive()); |
68 m_currentlyActiveCues.remove(index); | 68 m_currentlyActiveCues.erase(index); |
69 cue->setIsActive(false); | 69 cue->setIsActive(false); |
70 // Since the cue will be removed from the media element and likely the | 70 // Since the cue will be removed from the media element and likely the |
71 // TextTrack might also be destructed, notifying the region of the cue | 71 // TextTrack might also be destructed, notifying the region of the cue |
72 // removal shouldn't be done. | 72 // removal shouldn't be done. |
73 cue->removeDisplayTree(TextTrackCue::DontNotifyRegion); | 73 cue->removeDisplayTree(TextTrackCue::DontNotifyRegion); |
74 } | 74 } |
75 } | 75 } |
76 | 76 |
77 void CueTimeline::hideCues(TextTrack*, const TextTrackCueList* cues) { | 77 void CueTimeline::hideCues(TextTrack*, const TextTrackCueList* cues) { |
78 for (size_t i = 0; i < cues->length(); ++i) | 78 for (size_t i = 0; i < cues->length(); ++i) |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 --m_ignoreUpdate; | 362 --m_ignoreUpdate; |
363 if (!m_ignoreUpdate) | 363 if (!m_ignoreUpdate) |
364 updateActiveCues(mediaElement().currentTime()); | 364 updateActiveCues(mediaElement().currentTime()); |
365 } | 365 } |
366 | 366 |
367 DEFINE_TRACE(CueTimeline) { | 367 DEFINE_TRACE(CueTimeline) { |
368 visitor->trace(m_mediaElement); | 368 visitor->trace(m_mediaElement); |
369 } | 369 } |
370 | 370 |
371 } // namespace blink | 371 } // namespace blink |
OLD | NEW |