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

Side by Side Diff: Source/core/html/track/LoadableTextTrack.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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 // origin of the media element's Document, and the default origin behaviour set to fail. 104 // origin of the media element's Document, and the default origin behaviour set to fail.
105 m_loader = TextTrackLoader::create(*this, m_trackElement->document()); 105 m_loader = TextTrackLoader::create(*this, m_trackElement->document());
106 if (!m_loader->load(m_url, m_trackElement->mediaElementCrossOriginAttribute( ))) 106 if (!m_loader->load(m_url, m_trackElement->mediaElementCrossOriginAttribute( )))
107 m_trackElement->didCompleteLoad(HTMLTrackElement::Failure); 107 m_trackElement->didCompleteLoad(HTMLTrackElement::Failure);
108 } 108 }
109 109
110 void LoadableTextTrack::newCuesAvailable(TextTrackLoader* loader) 110 void LoadableTextTrack::newCuesAvailable(TextTrackLoader* loader)
111 { 111 {
112 ASSERT_UNUSED(loader, m_loader == loader); 112 ASSERT_UNUSED(loader, m_loader == loader);
113 113
114 Vector<RefPtr<VTTCue> > newCues; 114 WillBeHeapVector<RefPtrWillBeMember<VTTCue> > newCues;
115 m_loader->getNewCues(newCues); 115 m_loader->getNewCues(newCues);
116 116
117 if (!m_cues) 117 if (!m_cues)
118 m_cues = TextTrackCueList::create(); 118 m_cues = TextTrackCueList::create();
119 119
120 for (size_t i = 0; i < newCues.size(); ++i) { 120 for (size_t i = 0; i < newCues.size(); ++i) {
121 newCues[i]->setTrack(this); 121 newCues[i]->setTrack(this);
122 m_cues->add(newCues[i]); 122 m_cues->add(newCues[i].release());
123 } 123 }
124 124
125 if (mediaElement()) 125 if (mediaElement())
126 mediaElement()->textTrackAddCues(this, m_cues.get()); 126 mediaElement()->textTrackAddCues(this, m_cues.get());
127 } 127 }
128 128
129 void LoadableTextTrack::cueLoadingCompleted(TextTrackLoader* loader, bool loadin gFailed) 129 void LoadableTextTrack::cueLoadingCompleted(TextTrackLoader* loader, bool loadin gFailed)
130 { 130 {
131 ASSERT_UNUSED(loader, m_loader == loader); 131 ASSERT_UNUSED(loader, m_loader == loader);
132 132
133 if (!m_trackElement) 133 if (!m_trackElement)
134 return; 134 return;
135 135
136 m_trackElement->didCompleteLoad(loadingFailed ? HTMLTrackElement::Failure : HTMLTrackElement::Success); 136 m_trackElement->didCompleteLoad(loadingFailed ? HTMLTrackElement::Failure : HTMLTrackElement::Success);
137 } 137 }
138 138
139 void LoadableTextTrack::newRegionsAvailable(TextTrackLoader* loader) 139 void LoadableTextTrack::newRegionsAvailable(TextTrackLoader* loader)
140 { 140 {
141 ASSERT_UNUSED(loader, m_loader == loader); 141 ASSERT_UNUSED(loader, m_loader == loader);
142 142
143 Vector<RefPtr<VTTRegion> > newRegions; 143 WillBeHeapVector<RefPtrWillBeMember<VTTRegion> > newRegions;
144 m_loader->getNewRegions(newRegions); 144 m_loader->getNewRegions(newRegions);
145 145
146 for (size_t i = 0; i < newRegions.size(); ++i) { 146 for (size_t i = 0; i < newRegions.size(); ++i) {
147 newRegions[i]->setTrack(this); 147 newRegions[i]->setTrack(this);
148 regions()->add(newRegions[i]); 148 regions()->add(newRegions[i]);
149 } 149 }
150 } 150 }
151 151
152 size_t LoadableTextTrack::trackElementIndex() 152 size_t LoadableTextTrack::trackElementIndex()
153 { 153 {
154 ASSERT(m_trackElement); 154 ASSERT(m_trackElement);
155 ASSERT(m_trackElement->parentNode()); 155 ASSERT(m_trackElement->parentNode());
156 156
157 size_t index = 0; 157 size_t index = 0;
158 for (HTMLTrackElement* track = Traversal<HTMLTrackElement>::firstChild(*m_tr ackElement->parentNode()); track; track = Traversal<HTMLTrackElement>::nextSibli ng(*track)) { 158 for (HTMLTrackElement* track = Traversal<HTMLTrackElement>::firstChild(*m_tr ackElement->parentNode()); track; track = Traversal<HTMLTrackElement>::nextSibli ng(*track)) {
159 if (!track->parentNode()) 159 if (!track->parentNode())
160 continue; 160 continue;
161 if (track == m_trackElement) 161 if (track == m_trackElement)
162 return index; 162 return index;
163 ++index; 163 ++index;
164 } 164 }
165 ASSERT_NOT_REACHED(); 165 ASSERT_NOT_REACHED();
166 166
167 return 0; 167 return 0;
168 } 168 }
169 169
170 void LoadableTextTrack::trace(Visitor* visitor)
171 {
172 visitor->trace(m_loader);
173 TextTrack::trace(visitor);
174 }
175
170 } // namespace WebCore 176 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698