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

Unified Diff: Source/core/html/HTMLMediaElement.cpp

Issue 244493002: Oilpan: add transition types to track interface objects. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Explicitly dispose of TextTrackList + fix handling of {Inband,Loadable}TextTrack Created 6 years, 8 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
Index: Source/core/html/HTMLMediaElement.cpp
diff --git a/Source/core/html/HTMLMediaElement.cpp b/Source/core/html/HTMLMediaElement.cpp
index e3552279e73c85d31676bb58f87f3071accbc726..f2614349f1259e6302253b1863d5e57307da4ebc 100644
--- a/Source/core/html/HTMLMediaElement.cpp
+++ b/Source/core/html/HTMLMediaElement.cpp
@@ -306,8 +306,10 @@ HTMLMediaElement::~HTMLMediaElement()
setShouldDelayLoadEvent(false);
- if (m_textTracks)
+ if (m_textTracks) {
m_textTracks->clearOwner();
+ m_textTracks->dispose();
haraken 2014/04/22 02:37:47 Can we merge clearOwner() into dispose()?
sof 2014/04/22 06:27:52 Done; dispose() remained.
+ }
if (m_mediaController) {
m_mediaController->removeMediaElement(this);
@@ -1261,7 +1263,7 @@ void HTMLMediaElement::textTrackRemoveCues(TextTrack*, const TextTrackCueList* c
textTrackRemoveCue(cues->item(i)->track(), cues->item(i));
}
-void HTMLMediaElement::textTrackAddCue(TextTrack* track, PassRefPtr<TextTrackCue> cue)
+void HTMLMediaElement::textTrackAddCue(TextTrack* track, PassRefPtrWillBeRawPtr<TextTrackCue> cue)
{
if (track->mode() == TextTrack::disabledKeyword())
return;
@@ -1276,7 +1278,7 @@ void HTMLMediaElement::textTrackAddCue(TextTrack* track, PassRefPtr<TextTrackCue
updateActiveTextTrackCues(currentTime());
}
-void HTMLMediaElement::textTrackRemoveCue(TextTrack*, PassRefPtr<TextTrackCue> cue)
+void HTMLMediaElement::textTrackRemoveCue(TextTrack*, PassRefPtrWillBeRawPtr<TextTrackCue> cue)
{
// Negative duration cues need to be treated in the interval tree as
// zero-length cues.
@@ -2296,7 +2298,7 @@ void HTMLMediaElement::forgetResourceSpecificTracks()
}
}
-PassRefPtr<TextTrack> HTMLMediaElement::addTextTrack(const AtomicString& kind, const AtomicString& label, const AtomicString& language, ExceptionState& exceptionState)
+PassRefPtrWillBeRawPtr<TextTrack> HTMLMediaElement::addTextTrack(const AtomicString& kind, const AtomicString& label, const AtomicString& language, ExceptionState& exceptionState)
{
// 4.8.10.12.4 Text track API
// The addTextTrack(kind, label, language) method of media elements, when invoked, must run the following steps:
@@ -2313,7 +2315,7 @@ PassRefPtr<TextTrack> HTMLMediaElement::addTextTrack(const AtomicString& kind, c
// 5. Create a new text track corresponding to the new object, and set its text track kind to kind, its text
// track label to label, its text track language to language...
- RefPtr<TextTrack> textTrack = TextTrack::create(document(), kind, label, language);
+ RefPtrWillBeRawPtr<TextTrack> textTrack = TextTrack::create(document(), kind, label, language);
// Note, due to side effects when changing track parameters, we have to
// first append the track to the text track list.
@@ -2344,7 +2346,7 @@ void HTMLMediaElement::didAddTrackElement(HTMLTrackElement* trackElement)
// When a track element's parent element changes and the new parent is a media element,
// then the user agent must add the track element's corresponding text track to the
// media element's list of text tracks ... [continues in TextTrackList::append]
- RefPtr<TextTrack> textTrack = trackElement->track();
+ RefPtrWillBeRawPtr<TextTrack> textTrack = trackElement->track();
if (!textTrack)
return;
@@ -2366,7 +2368,7 @@ void HTMLMediaElement::didRemoveTrackElement(HTMLTrackElement* trackElement)
WTF_LOG(Media, "HTMLMediaElement::didRemoveTrackElement - 'src' is %s", urlForLoggingMedia(url).utf8().data());
#endif
- RefPtr<TextTrack> textTrack = trackElement->track();
+ RefPtrWillBeRawPtr<TextTrack> textTrack = trackElement->track();
if (!textTrack)
return;
@@ -2428,13 +2430,13 @@ void HTMLMediaElement::configureTextTrackGroup(const TrackGroup& group)
Settings* settings = document().settings();
// First, find the track in the group that should be enabled (if any).
- Vector<RefPtr<TextTrack> > currentlyEnabledTracks;
- RefPtr<TextTrack> trackToEnable;
- RefPtr<TextTrack> defaultTrack;
- RefPtr<TextTrack> fallbackTrack;
+ WillBeHeapVector<RefPtrWillBeMember<TextTrack> > currentlyEnabledTracks;
+ RefPtrWillBeRawPtr<TextTrack> trackToEnable = nullptr;
+ RefPtrWillBeRawPtr<TextTrack> defaultTrack = nullptr;
+ RefPtrWillBeRawPtr<TextTrack> fallbackTrack = nullptr;
int highestTrackScore = 0;
for (size_t i = 0; i < group.tracks.size(); ++i) {
- RefPtr<TextTrack> textTrack = group.tracks[i];
+ RefPtrWillBeRawPtr<TextTrack> textTrack = group.tracks[i];
if (m_processingPreferenceChange && textTrack->mode() == TextTrack::showingKeyword())
currentlyEnabledTracks.append(textTrack);
@@ -2480,7 +2482,7 @@ void HTMLMediaElement::configureTextTrackGroup(const TrackGroup& group)
if (currentlyEnabledTracks.size()) {
for (size_t i = 0; i < currentlyEnabledTracks.size(); ++i) {
- RefPtr<TextTrack> textTrack = currentlyEnabledTracks[i];
+ RefPtrWillBeRawPtr<TextTrack> textTrack = currentlyEnabledTracks[i];
if (textTrack != trackToEnable)
textTrack->setMode(TextTrack::disabledKeyword());
}
@@ -2502,7 +2504,7 @@ void HTMLMediaElement::configureTextTracks()
return;
for (size_t i = 0; i < m_textTracks->length(); ++i) {
- RefPtr<TextTrack> textTrack = m_textTracks->item(i);
+ RefPtrWillBeRawPtr<TextTrack> textTrack = m_textTracks->item(i);
if (!textTrack)
continue;
@@ -3391,7 +3393,7 @@ void HTMLMediaElement::markCaptionAndSubtitleTracksAsUnconfigured()
// captions and non-default tracks should be displayed based on language
// preferences if the user has turned captions on).
for (unsigned i = 0; i < m_textTracks->length(); ++i) {
- RefPtr<TextTrack> textTrack = m_textTracks->item(i);
+ RefPtrWillBeRawPtr<TextTrack> textTrack = m_textTracks->item(i);
String kind = textTrack->kind();
if (kind == TextTrack::subtitlesKeyword() || kind == TextTrack::captionsKeyword())

Powered by Google App Engine
This is Rietveld 408576698