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

Unified Diff: Source/core/html/track/TextTrackCue.cpp

Issue 956323002: Tweak the TextTrackCue "cue index" management (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 side-by-side diff with in-line comments
Download patch
Index: Source/core/html/track/TextTrackCue.cpp
diff --git a/Source/core/html/track/TextTrackCue.cpp b/Source/core/html/track/TextTrackCue.cpp
index 500cfa10b19b904f5085943a647178ad6c3d6853..439a1963d3b43400331f45036f5c40c9bb0f06ec 100644
--- a/Source/core/html/track/TextTrackCue.cpp
+++ b/Source/core/html/track/TextTrackCue.cpp
@@ -40,13 +40,11 @@
namespace blink {
-static const int invalidCueIndex = -1;
-
TextTrackCue::TextTrackCue(double start, double end)
: m_startTime(start)
, m_endTime(end)
- , m_cueIndex(invalidCueIndex)
, m_track(nullptr)
+ , m_cueIndex(UINT_MAX)
, m_isActive(false)
, m_pauseOnExit(false)
{
@@ -121,19 +119,17 @@ void TextTrackCue::setPauseOnExit(bool value)
cueDidChange();
}
-int TextTrackCue::cueIndex()
+unsigned TextTrackCue::cueIndex()
{
- if (m_cueIndex == invalidCueIndex)
- m_cueIndex = track()->cues()->getCueIndex(this);
-
+ // This method can only be called on cues while they are associated with
+ // a(n enabled) track (and hence that tracks list of cues should exist.)
philipj_slow 2015/02/26 15:43:12 s/tracks/track's/
fs 2015/02/26 16:09:34 Done.
+ ASSERT(track() && track()->cues());
+ TextTrackCueList* cueList = track()->cues();
+ if (!cueList->isCueIndexValid(m_cueIndex))
+ cueList->validateCueIndexes();
return m_cueIndex;
}
-void TextTrackCue::invalidateCueIndex()
-{
- m_cueIndex = invalidCueIndex;
-}
-
bool TextTrackCue::dispatchEvent(PassRefPtrWillBeRawPtr<Event> event)
{
// When a TextTrack's mode is disabled: no cues are active, no events fired.

Powered by Google App Engine
This is Rietveld 408576698