OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 #include "core/html/track/CueTimeline.h" | 6 #include "core/html/track/CueTimeline.h" |
7 | 7 |
8 #include "core/events/Event.h" | 8 #include "core/events/Event.h" |
9 #include "core/html/HTMLMediaElement.h" | 9 #include "core/html/HTMLMediaElement.h" |
10 #include "core/html/HTMLTrackElement.h" | 10 #include "core/html/HTMLTrackElement.h" |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 // 4.8.10.8 Playing the media resource | 125 // 4.8.10.8 Playing the media resource |
126 | 126 |
127 // If the current playback position changes while the steps are running, | 127 // If the current playback position changes while the steps are running, |
128 // then the user agent must wait for the steps to complete, and then must | 128 // then the user agent must wait for the steps to complete, and then must |
129 // immediately rerun the steps. | 129 // immediately rerun the steps. |
130 if (ignoreUpdateRequests()) | 130 if (ignoreUpdateRequests()) |
131 return; | 131 return; |
132 | 132 |
133 HTMLMediaElement& mediaElement = this->mediaElement(); | 133 HTMLMediaElement& mediaElement = this->mediaElement(); |
134 | 134 |
| 135 #if !ENABLE(OILPAN) |
| 136 // Don't run the "time marches on" algorithm if the document has been |
| 137 // detached. This primarily guards against dispatch of events w/ |
| 138 // HTMLTrackElement targets. |
| 139 if (mediaElement.document().isDetached()) |
| 140 return; |
| 141 #endif |
| 142 |
135 // https://html.spec.whatwg.org/#time-marches-on | 143 // https://html.spec.whatwg.org/#time-marches-on |
136 | 144 |
137 // 1 - Let current cues be a list of cues, initialized to contain all the | 145 // 1 - Let current cues be a list of cues, initialized to contain all the |
138 // cues of all the hidden, showing, or showing by default text tracks of the | 146 // cues of all the hidden, showing, or showing by default text tracks of the |
139 // media element (not the disabled ones) whose start times are less than or | 147 // media element (not the disabled ones) whose start times are less than or |
140 // equal to the current playback position and whose end times are greater | 148 // equal to the current playback position and whose end times are greater |
141 // than the current playback position. | 149 // than the current playback position. |
142 CueList currentCues; | 150 CueList currentCues; |
143 | 151 |
144 // The user agent must synchronously unset [the text track cue active] flag | 152 // The user agent must synchronously unset [the text track cue active] flag |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 | 349 |
342 void CueTimeline::beginIgnoringUpdateRequests() | 350 void CueTimeline::beginIgnoringUpdateRequests() |
343 { | 351 { |
344 ++m_ignoreUpdate; | 352 ++m_ignoreUpdate; |
345 } | 353 } |
346 | 354 |
347 void CueTimeline::endIgnoringUpdateRequests() | 355 void CueTimeline::endIgnoringUpdateRequests() |
348 { | 356 { |
349 ASSERT(m_ignoreUpdate); | 357 ASSERT(m_ignoreUpdate); |
350 --m_ignoreUpdate; | 358 --m_ignoreUpdate; |
351 if (!m_ignoreUpdate && mediaElement().inActiveDocument()) | 359 if (!m_ignoreUpdate) |
352 updateActiveCues(mediaElement().currentTime()); | 360 updateActiveCues(mediaElement().currentTime()); |
353 } | 361 } |
354 | 362 |
355 DEFINE_TRACE(CueTimeline) | 363 DEFINE_TRACE(CueTimeline) |
356 { | 364 { |
357 visitor->trace(m_mediaElement); | 365 visitor->trace(m_mediaElement); |
358 } | 366 } |
359 | 367 |
360 } // namespace blink | 368 } // namespace blink |
OLD | NEW |