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..8aed76fad7238afca3fd23dd125d0f139ba31679 100644 |
--- a/Source/core/html/track/TextTrackCue.cpp |
+++ b/Source/core/html/track/TextTrackCue.cpp |
@@ -40,13 +40,13 @@ |
namespace blink { |
-static const int invalidCueIndex = -1; |
+static const unsigned invalidCueIndex = UINT_MAX; |
TextTrackCue::TextTrackCue(double start, double end) |
: m_startTime(start) |
, m_endTime(end) |
- , m_cueIndex(invalidCueIndex) |
, m_track(nullptr) |
+ , m_cueIndex(invalidCueIndex) |
, m_isActive(false) |
, m_pauseOnExit(false) |
{ |
@@ -121,17 +121,20 @@ void TextTrackCue::setPauseOnExit(bool value) |
cueDidChange(); |
} |
-int TextTrackCue::cueIndex() |
+void TextTrackCue::invalidateCueIndex() |
{ |
- if (m_cueIndex == invalidCueIndex) |
- m_cueIndex = track()->cues()->getCueIndex(this); |
- |
- return m_cueIndex; |
+ m_cueIndex = invalidCueIndex; |
} |
-void TextTrackCue::invalidateCueIndex() |
+unsigned TextTrackCue::cueIndex() |
{ |
- m_cueIndex = invalidCueIndex; |
+ // This method can only be called on cues while they are associated with |
+ // a(n enabled) track (and hence that track's list of cues should exist.) |
+ ASSERT(track() && track()->cues()); |
+ TextTrackCueList* cueList = track()->cues(); |
+ if (!cueList->isCueIndexValid(m_cueIndex)) |
+ cueList->validateCueIndexes(); |
+ return m_cueIndex; |
} |
bool TextTrackCue::dispatchEvent(PassRefPtrWillBeRawPtr<Event> event) |