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

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: Rebase. 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
« no previous file with comments | « Source/core/html/track/TextTrackCue.h ('k') | Source/core/html/track/TextTrackCueList.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
« no previous file with comments | « Source/core/html/track/TextTrackCue.h ('k') | Source/core/html/track/TextTrackCueList.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698