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

Side by Side Diff: Source/core/html/track/LoadableTextTrack.cpp

Issue 941973005: Push cue timeline management out of LoadableTextTrack (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/core/html/track/TextTrack.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 11 matching lines...) Expand all
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 #include "config.h" 26 #include "config.h"
27 #include "core/html/track/LoadableTextTrack.h" 27 #include "core/html/track/LoadableTextTrack.h"
28 28
29 #include "core/dom/ElementTraversal.h" 29 #include "core/dom/ElementTraversal.h"
30 #include "core/html/HTMLMediaElement.h" 30 #include "core/html/HTMLMediaElement.h"
31 #include "core/html/HTMLTrackElement.h" 31 #include "core/html/HTMLTrackElement.h"
32 #include "core/html/track/CueTimeline.h"
33 #include "core/html/track/TextTrackCueList.h"
34 #include "core/html/track/vtt/VTTRegionList.h" 32 #include "core/html/track/vtt/VTTRegionList.h"
35 33
36 namespace blink { 34 namespace blink {
37 35
38 using namespace HTMLNames; 36 using namespace HTMLNames;
39 37
40 LoadableTextTrack::LoadableTextTrack(HTMLTrackElement* track) 38 LoadableTextTrack::LoadableTextTrack(HTMLTrackElement* track)
41 : TextTrack(emptyAtom, emptyAtom, emptyAtom, emptyAtom, TrackElement) 39 : TextTrack(emptyAtom, emptyAtom, emptyAtom, emptyAtom, TrackElement)
42 , m_trackElement(track) 40 , m_trackElement(track)
43 , m_loadTimer(this, &LoadableTextTrack::loadTimerFired) 41 , m_loadTimer(this, &LoadableTextTrack::loadTimerFired)
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 // origin of the media element's Document, and the default origin behaviour set to fail. 111 // origin of the media element's Document, and the default origin behaviour set to fail.
114 m_loader = TextTrackLoader::create(*this, m_trackElement->document()); 112 m_loader = TextTrackLoader::create(*this, m_trackElement->document());
115 if (!m_loader->load(m_url, m_trackElement->mediaElementCrossOriginAttribute( ))) 113 if (!m_loader->load(m_url, m_trackElement->mediaElementCrossOriginAttribute( )))
116 m_trackElement->didCompleteLoad(HTMLTrackElement::Failure); 114 m_trackElement->didCompleteLoad(HTMLTrackElement::Failure);
117 } 115 }
118 116
119 void LoadableTextTrack::newCuesAvailable(TextTrackLoader* loader) 117 void LoadableTextTrack::newCuesAvailable(TextTrackLoader* loader)
120 { 118 {
121 ASSERT_UNUSED(loader, m_loader == loader); 119 ASSERT_UNUSED(loader, m_loader == loader);
122 120
123 WillBeHeapVector<RefPtrWillBeMember<VTTCue>> newCues; 121 WillBeHeapVector<RefPtrWillBeMember<TextTrackCue>> newCues;
124 m_loader->getNewCues(newCues); 122 m_loader->getNewCues(newCues);
125 123
126 if (!m_cues) 124 addListOfCues(newCues);
127 m_cues = TextTrackCueList::create();
128
129 for (size_t i = 0; i < newCues.size(); ++i) {
130 newCues[i]->setTrack(this);
131 m_cues->add(newCues[i].release());
132 }
133
134 if (cueTimeline() && mode() != disabledKeyword())
135 cueTimeline()->addCues(this, m_cues.get());
136 } 125 }
137 126
138 void LoadableTextTrack::cueLoadingCompleted(TextTrackLoader* loader, bool loadin gFailed) 127 void LoadableTextTrack::cueLoadingCompleted(TextTrackLoader* loader, bool loadin gFailed)
139 { 128 {
140 ASSERT_UNUSED(loader, m_loader == loader); 129 ASSERT_UNUSED(loader, m_loader == loader);
141 130
142 #if !ENABLE(OILPAN) 131 #if !ENABLE(OILPAN)
143 if (!m_trackElement) 132 if (!m_trackElement)
144 return; 133 return;
145 #endif 134 #endif
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 } 168 }
180 169
181 DEFINE_TRACE(LoadableTextTrack) 170 DEFINE_TRACE(LoadableTextTrack)
182 { 171 {
183 visitor->trace(m_trackElement); 172 visitor->trace(m_trackElement);
184 visitor->trace(m_loader); 173 visitor->trace(m_loader);
185 TextTrack::trace(visitor); 174 TextTrack::trace(visitor);
186 } 175 }
187 176
188 } // namespace blink 177 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/core/html/track/TextTrack.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698