Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Unified Diff: Source/core/html/track/TextTrackList.cpp

Issue 177243018: Prevent 'removetrack' events from firing when all inband text tracks are removed. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove console messages Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/html/track/TextTrackList.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/track/TextTrackList.cpp
diff --git a/Source/core/html/track/TextTrackList.cpp b/Source/core/html/track/TextTrackList.cpp
index 588e3768c9aa5368e9406d72f08b47160df738bf..375b14a2858b70bcc09df2e5f84854934b86a229 100644
--- a/Source/core/html/track/TextTrackList.cpp
+++ b/Source/core/html/track/TextTrackList.cpp
@@ -201,7 +201,6 @@ void TextTrackList::append(PassRefPtr<TextTrack> prpTrack)
void TextTrackList::remove(TextTrack* track)
{
Vector<RefPtr<TextTrack> >* tracks = 0;
- RefPtr<InbandTextTrack> inbandTrack;
if (track->trackType() == TextTrack::TrackElement) {
tracks = &m_elementTracks;
@@ -209,7 +208,6 @@ void TextTrackList::remove(TextTrack* track)
tracks = &m_addTrackTracks;
} else if (track->trackType() == TextTrack::InBand) {
tracks = &m_inbandTracks;
- inbandTrack = static_cast<InbandTextTrack*>(track);
} else {
ASSERT_NOT_REACHED();
}
@@ -225,12 +223,18 @@ void TextTrackList::remove(TextTrack* track)
tracks->remove(index);
- if (inbandTrack)
- inbandTrack->trackRemoved();
-
scheduleRemoveTrackEvent(track);
}
+void TextTrackList::removeAllInbandTracks()
+{
+ for (unsigned i = 0; i < m_inbandTracks.size(); ++i) {
+ m_inbandTracks[i]->invalidateTrackIndex();
+ m_inbandTracks[i]->setTrackList(0);
+ }
+ m_inbandTracks.clear();
+}
+
bool TextTrackList::contains(TextTrack* track) const
{
const Vector<RefPtr<TextTrack> >* tracks = 0;
@@ -318,7 +322,7 @@ void TextTrackList::scheduleRemoveTrackEvent(PassRefPtr<TextTrack> track)
scheduleTrackEvent(EventTypeNames::removetrack, track);
}
-Node* TextTrackList::owner() const
+HTMLMediaElement* TextTrackList::owner() const
{
return m_owner;
}
« no previous file with comments | « Source/core/html/track/TextTrackList.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698