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

Side by Side Diff: Source/core/html/track/TextTrack.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 | « Source/core/html/track/TextTrack.h ('k') | Source/core/html/track/vtt/VTTParser.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 * Copyright (C) 2011, 2012, 2013 Apple Inc. All rights reserved. 3 * Copyright (C) 2011, 2012, 2013 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 203
204 if (cueTimeline()) 204 if (cueTimeline())
205 cueTimeline()->removeCues(this, m_cues.get()); 205 cueTimeline()->removeCues(this, m_cues.get());
206 206
207 for (size_t i = 0; i < m_cues->length(); ++i) 207 for (size_t i = 0; i < m_cues->length(); ++i)
208 m_cues->item(i)->setTrack(0); 208 m_cues->item(i)->setTrack(0);
209 209
210 m_cues = nullptr; 210 m_cues = nullptr;
211 } 211 }
212 212
213 void TextTrack::addListOfCues(WillBeHeapVector<RefPtrWillBeMember<TextTrackCue>> & listOfNewCues)
214 {
215 TextTrackCueList* cues = ensureTextTrackCueList();
216
217 for (auto& newCue : listOfNewCues) {
218 newCue->setTrack(this);
219 cues->add(newCue.release());
220 }
221
222 if (cueTimeline() && mode() != disabledKeyword())
223 cueTimeline()->addCues(this, cues);
224 }
225
213 TextTrackCueList* TextTrack::activeCues() const 226 TextTrackCueList* TextTrack::activeCues() const
214 { 227 {
215 // 4.8.10.12.5 If the text track mode ... is not the text track disabled mod e, 228 // 4.8.10.12.5 If the text track mode ... is not the text track disabled mod e,
216 // then the activeCues attribute must return a live TextTrackCueList object ... 229 // then the activeCues attribute must return a live TextTrackCueList object ...
217 // ... whose active flag was set when the script started, in text track cue 230 // ... whose active flag was set when the script started, in text track cue
218 // order. Otherwise, it must return null. When an object is returned, the 231 // order. Otherwise, it must return null. When an object is returned, the
219 // same object must be returned each time. 232 // same object must be returned each time.
220 // http://www.whatwg.org/specs/web-apps/current-work/#dom-texttrack-activecu es 233 // http://www.whatwg.org/specs/web-apps/current-work/#dom-texttrack-activecu es
221 if (m_cues && m_mode != disabledKeyword()) 234 if (m_cues && m_mode != disabledKeyword())
222 return m_cues->activeCues(); 235 return m_cues->activeCues();
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 DEFINE_TRACE(TextTrack) 462 DEFINE_TRACE(TextTrack)
450 { 463 {
451 visitor->trace(m_cues); 464 visitor->trace(m_cues);
452 visitor->trace(m_regions); 465 visitor->trace(m_regions);
453 visitor->trace(m_trackList); 466 visitor->trace(m_trackList);
454 TrackBase::trace(visitor); 467 TrackBase::trace(visitor);
455 EventTargetWithInlineData::trace(visitor); 468 EventTargetWithInlineData::trace(visitor);
456 } 469 }
457 470
458 } // namespace blink 471 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/html/track/TextTrack.h ('k') | Source/core/html/track/vtt/VTTParser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698