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

Side by Side Diff: Source/core/html/HTMLMediaElement.cpp

Issue 387313011: HTMLMediaElement::updateActiveTextTrackCues(): use on-heap local vectors (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 5 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
« no previous file with comments | « no previous file | no next file » | 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) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple 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 1217 matching lines...) Expand 10 before | Expand all | Expand 10 after
1228 } 1228 }
1229 1229
1230 for (size_t i = 0; !m_paused && i < missedCuesSize; ++i) { 1230 for (size_t i = 0; !m_paused && i < missedCuesSize; ++i) {
1231 if (missedCues[i].data()->pauseOnExit()) 1231 if (missedCues[i].data()->pauseOnExit())
1232 pause(); 1232 pause();
1233 } 1233 }
1234 1234
1235 // 8 - Let events be a list of tasks, initially empty. Each task in this 1235 // 8 - Let events be a list of tasks, initially empty. Each task in this
1236 // list will be associated with a text track, a text track cue, and a time, 1236 // list will be associated with a text track, a text track cue, and a time,
1237 // which are used to sort the list before the tasks are queued. 1237 // which are used to sort the list before the tasks are queued.
1238 Vector<std::pair<double, TextTrackCue*> > eventTasks; 1238 WillBeHeapVector<std::pair<double, RawPtrWillBeMember<TextTrackCue> > > even tTasks;
1239 1239
1240 // 8 - Let affected tracks be a list of text tracks, initially empty. 1240 // 8 - Let affected tracks be a list of text tracks, initially empty.
1241 Vector<TextTrack*> affectedTracks; 1241 WillBeHeapVector<RawPtrWillBeMember<TextTrack> > affectedTracks;
1242 1242
1243 for (size_t i = 0; i < missedCuesSize; ++i) { 1243 for (size_t i = 0; i < missedCuesSize; ++i) {
1244 // 9 - For each text track cue in missed cues, prepare an event named en ter 1244 // 9 - For each text track cue in missed cues, prepare an event named en ter
1245 // for the TextTrackCue object with the text track cue start time. 1245 // for the TextTrackCue object with the text track cue start time.
1246 eventTasks.append(std::make_pair(missedCues[i].data()->startTime(), 1246 eventTasks.append(std::make_pair(missedCues[i].data()->startTime(),
1247 missedCues[i].data())); 1247 missedCues[i].data()));
1248 1248
1249 // 10 - For each text track [...] in missed cues, prepare an event 1249 // 10 - For each text track [...] in missed cues, prepare an event
1250 // named exit for the TextTrackCue object with the with the later of 1250 // named exit for the TextTrackCue object with the with the later of
1251 // the text track cue end time and the text track cue start time. 1251 // the text track cue end time and the text track cue start time.
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
1321 for (size_t i = 0; i < affectedTracks.size(); ++i) { 1321 for (size_t i = 0; i < affectedTracks.size(); ++i) {
1322 RefPtrWillBeRawPtr<Event> event = Event::create(EventTypeNames::cuechang e); 1322 RefPtrWillBeRawPtr<Event> event = Event::create(EventTypeNames::cuechang e);
1323 event->setTarget(affectedTracks[i]); 1323 event->setTarget(affectedTracks[i]);
1324 1324
1325 m_asyncEventQueue->enqueueEvent(event.release()); 1325 m_asyncEventQueue->enqueueEvent(event.release());
1326 1326
1327 // ... if the text track has a corresponding track element, to then fire a 1327 // ... if the text track has a corresponding track element, to then fire a
1328 // simple event named cuechange at the track element as well. 1328 // simple event named cuechange at the track element as well.
1329 if (affectedTracks[i]->trackType() == TextTrack::TrackElement) { 1329 if (affectedTracks[i]->trackType() == TextTrack::TrackElement) {
1330 RefPtrWillBeRawPtr<Event> event = Event::create(EventTypeNames::cuec hange); 1330 RefPtrWillBeRawPtr<Event> event = Event::create(EventTypeNames::cuec hange);
1331 HTMLTrackElement* trackElement = static_cast<LoadableTextTrack*>(aff ectedTracks[i])->trackElement(); 1331 HTMLTrackElement* trackElement = static_cast<LoadableTextTrack*>(aff ectedTracks[i].get())->trackElement();
1332 ASSERT(trackElement); 1332 ASSERT(trackElement);
1333 event->setTarget(trackElement); 1333 event->setTarget(trackElement);
1334 1334
1335 m_asyncEventQueue->enqueueEvent(event.release()); 1335 m_asyncEventQueue->enqueueEvent(event.release());
1336 } 1336 }
1337 } 1337 }
1338 1338
1339 // 16 - Set the text track cue active flag of all the cues in the current 1339 // 16 - Set the text track cue active flag of all the cues in the current
1340 // cues, and unset the text track cue active flag of all the cues in the 1340 // cues, and unset the text track cue active flag of all the cues in the
1341 // other cues. 1341 // other cues.
(...skipping 2632 matching lines...) Expand 10 before | Expand all | Expand 10 after
3974 3974
3975 #if ENABLE(WEB_AUDIO) 3975 #if ENABLE(WEB_AUDIO)
3976 void HTMLMediaElement::clearWeakMembers(Visitor* visitor) 3976 void HTMLMediaElement::clearWeakMembers(Visitor* visitor)
3977 { 3977 {
3978 if (!visitor->isAlive(m_audioSourceNode) && audioSourceProvider()) 3978 if (!visitor->isAlive(m_audioSourceNode) && audioSourceProvider())
3979 audioSourceProvider()->setClient(0); 3979 audioSourceProvider()->setClient(0);
3980 } 3980 }
3981 #endif 3981 #endif
3982 3982
3983 } 3983 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698