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

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

Issue 910843002: Hoist checks for 'disabled' tracks out of textTrackAddCue{,s} (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Missed a spot. 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/LoadableTextTrack.cpp » ('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) 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 1465 matching lines...) Expand 10 before | Expand all | Expand 10 after
1476 { 1476 {
1477 ASSERT(m_ignoreTrackDisplayUpdate); 1477 ASSERT(m_ignoreTrackDisplayUpdate);
1478 --m_ignoreTrackDisplayUpdate; 1478 --m_ignoreTrackDisplayUpdate;
1479 if (!m_ignoreTrackDisplayUpdate && inActiveDocument()) 1479 if (!m_ignoreTrackDisplayUpdate && inActiveDocument())
1480 updateActiveTextTrackCues(currentTime()); 1480 updateActiveTextTrackCues(currentTime());
1481 } 1481 }
1482 1482
1483 void HTMLMediaElement::textTrackAddCues(TextTrack* track, const TextTrackCueList * cues) 1483 void HTMLMediaElement::textTrackAddCues(TextTrack* track, const TextTrackCueList * cues)
1484 { 1484 {
1485 WTF_LOG(Media, "HTMLMediaElement::textTrackAddCues(%p)", this); 1485 WTF_LOG(Media, "HTMLMediaElement::textTrackAddCues(%p)", this);
1486 if (track->mode() == TextTrack::disabledKeyword()) 1486 ASSERT(track->mode() != TextTrack::disabledKeyword());
1487 return;
1488 1487
1489 TrackDisplayUpdateScope scope(this); 1488 TrackDisplayUpdateScope scope(this);
1490 for (size_t i = 0; i < cues->length(); ++i) 1489 for (size_t i = 0; i < cues->length(); ++i)
1491 textTrackAddCue(cues->item(i)->track(), cues->item(i)); 1490 textTrackAddCue(cues->item(i)->track(), cues->item(i));
1492 } 1491 }
1493 1492
1494 void HTMLMediaElement::textTrackRemoveCues(TextTrack*, const TextTrackCueList* c ues) 1493 void HTMLMediaElement::textTrackRemoveCues(TextTrack*, const TextTrackCueList* c ues)
1495 { 1494 {
1496 WTF_LOG(Media, "HTMLMediaElement::textTrackRemoveCues(%p)", this); 1495 WTF_LOG(Media, "HTMLMediaElement::textTrackRemoveCues(%p)", this);
1497 1496
1498 TrackDisplayUpdateScope scope(this); 1497 TrackDisplayUpdateScope scope(this);
1499 for (size_t i = 0; i < cues->length(); ++i) 1498 for (size_t i = 0; i < cues->length(); ++i)
1500 textTrackRemoveCue(cues->item(i)->track(), cues->item(i)); 1499 textTrackRemoveCue(cues->item(i)->track(), cues->item(i));
1501 } 1500 }
1502 1501
1503 void HTMLMediaElement::textTrackAddCue(TextTrack* track, PassRefPtrWillBeRawPtr< TextTrackCue> cue) 1502 void HTMLMediaElement::textTrackAddCue(TextTrack* track, PassRefPtrWillBeRawPtr< TextTrackCue> cue)
1504 { 1503 {
1505 if (track->mode() == TextTrack::disabledKeyword()) 1504 ASSERT(track->mode() != TextTrack::disabledKeyword());
1506 return;
1507 1505
1508 // Negative duration cues need be treated in the interval tree as 1506 // Negative duration cues need be treated in the interval tree as
1509 // zero-length cues. 1507 // zero-length cues.
1510 double endTime = std::max(cue->startTime(), cue->endTime()); 1508 double endTime = std::max(cue->startTime(), cue->endTime());
1511 1509
1512 CueInterval interval = m_cueTree.createInterval(cue->startTime(), endTime, c ue.get()); 1510 CueInterval interval = m_cueTree.createInterval(cue->startTime(), endTime, c ue.get());
1513 if (!m_cueTree.contains(interval)) 1511 if (!m_cueTree.contains(interval))
1514 m_cueTree.add(interval); 1512 m_cueTree.add(interval);
1515 updateActiveTextTrackCues(currentTime()); 1513 updateActiveTextTrackCues(currentTime());
1516 } 1514 }
(...skipping 2606 matching lines...) Expand 10 before | Expand all | Expand 10 after
4123 4121
4124 #if ENABLE(WEB_AUDIO) 4122 #if ENABLE(WEB_AUDIO)
4125 void HTMLMediaElement::clearWeakMembers(Visitor* visitor) 4123 void HTMLMediaElement::clearWeakMembers(Visitor* visitor)
4126 { 4124 {
4127 if (!visitor->isAlive(m_audioSourceNode) && audioSourceProvider()) 4125 if (!visitor->isAlive(m_audioSourceNode) && audioSourceProvider())
4128 audioSourceProvider()->setClient(nullptr); 4126 audioSourceProvider()->setClient(nullptr);
4129 } 4127 }
4130 #endif 4128 #endif
4131 4129
4132 } 4130 }
OLDNEW
« no previous file with comments | « no previous file | Source/core/html/track/LoadableTextTrack.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698