| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google 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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 // 5. Top: Await a stable state. The synchronous section consists of the fol
lowing steps. (The steps in the | 166 // 5. Top: Await a stable state. The synchronous section consists of the fol
lowing steps. (The steps in the |
| 167 // synchronous section are marked with [X]) | 167 // synchronous section are marked with [X]) |
| 168 // FIXME: We use a timer to approximate a "stable state" - i.e. this is not
100% per spec. | 168 // FIXME: We use a timer to approximate a "stable state" - i.e. this is not
100% per spec. |
| 169 } | 169 } |
| 170 | 170 |
| 171 void HTMLTrackElement::loadTimerFired(TimerBase*) | 171 void HTMLTrackElement::loadTimerFired(TimerBase*) |
| 172 { | 172 { |
| 173 DVLOG(TRACK_LOG_LEVEL) << "loadTimerFired"; | 173 DVLOG(TRACK_LOG_LEVEL) << "loadTimerFired"; |
| 174 | 174 |
| 175 // 6. [X] Set the text track readiness state to loading. | 175 // 6. [X] Set the text track readiness state to loading. |
| 176 setReadyState(LOADING); | 176 setReadyState(kLoading); |
| 177 | 177 |
| 178 // 7. [X] Let URL be the track URL of the track element. | 178 // 7. [X] Let URL be the track URL of the track element. |
| 179 KURL url = getNonEmptyURLAttribute(srcAttr); | 179 KURL url = getNonEmptyURLAttribute(srcAttr); |
| 180 | 180 |
| 181 // 8. [X] If the track element's parent is a media element then let CORS mod
e be the state of the parent media | 181 // 8. [X] If the track element's parent is a media element then let CORS mod
e be the state of the parent media |
| 182 // element's crossorigin content attribute. Otherwise, let CORS mode be No C
ORS. | 182 // element's crossorigin content attribute. Otherwise, let CORS mode be No C
ORS. |
| 183 const AtomicString& corsMode = mediaElementCrossOriginAttribute(); | 183 const AtomicString& corsMode = mediaElementCrossOriginAttribute(); |
| 184 | 184 |
| 185 // 9. End the synchronous section, continuing the remaining steps in paralle
l. | 185 // 9. End the synchronous section, continuing the remaining steps in paralle
l. |
| 186 | 186 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 // (Note: We don't "queue a task" here because this method will only be call
ed from a timer - m_loadTimer or | 250 // (Note: We don't "queue a task" here because this method will only be call
ed from a timer - m_loadTimer or |
| 251 // TextTrackLoader::m_cueLoadTimer - which should be a reasonable, and hopef
ully non-observable, approximation of | 251 // TextTrackLoader::m_cueLoadTimer - which should be a reasonable, and hopef
ully non-observable, approximation of |
| 252 // the spec text. I.e we could consider this to be run from the "networking
task source".) | 252 // the spec text. I.e we could consider this to be run from the "networking
task source".) |
| 253 // | 253 // |
| 254 // If the fetching algorithm does not fail, but the type of the resource is
not a supported text track format, or | 254 // If the fetching algorithm does not fail, but the type of the resource is
not a supported text track format, or |
| 255 // the file was not successfully processed (e.g. the format in question is a
n XML format and the file contained a | 255 // the file was not successfully processed (e.g. the format in question is a
n XML format and the file contained a |
| 256 // well-formedness error that the XML specification requires be detected and
reported to the application), then the | 256 // well-formedness error that the XML specification requires be detected and
reported to the application), then the |
| 257 // task that is queued by the networking task source in which the aforementi
oned problem is found must change the | 257 // task that is queued by the networking task source in which the aforementi
oned problem is found must change the |
| 258 // text track readiness state to failed to load and fire a simple event name
d error at the track element. | 258 // text track readiness state to failed to load and fire a simple event name
d error at the track element. |
| 259 if (status == Failure) { | 259 if (status == Failure) { |
| 260 setReadyState(TRACK_ERROR); | 260 setReadyState(kError); |
| 261 dispatchEvent(Event::create(EventTypeNames::error)); | 261 dispatchEvent(Event::create(EventTypeNames::error)); |
| 262 return; | 262 return; |
| 263 } | 263 } |
| 264 | 264 |
| 265 // If the fetching algorithm does not fail, and the file was successfully pr
ocessed, then the final task that is | 265 // If the fetching algorithm does not fail, and the file was successfully pr
ocessed, then the final task that is |
| 266 // queued by the networking task source, after it has finished parsing the d
ata, must change the text track | 266 // queued by the networking task source, after it has finished parsing the d
ata, must change the text track |
| 267 // readiness state to loaded, and fire a simple event named load at the trac
k element. | 267 // readiness state to loaded, and fire a simple event named load at the trac
k element. |
| 268 setReadyState(LOADED); | 268 setReadyState(kLoaded); |
| 269 dispatchEvent(Event::create(EventTypeNames::load)); | 269 dispatchEvent(Event::create(EventTypeNames::load)); |
| 270 } | 270 } |
| 271 | 271 |
| 272 void HTMLTrackElement::newCuesAvailable(TextTrackLoader* loader) | 272 void HTMLTrackElement::newCuesAvailable(TextTrackLoader* loader) |
| 273 { | 273 { |
| 274 DCHECK_EQ(m_loader, loader); | 274 DCHECK_EQ(m_loader, loader); |
| 275 DCHECK(m_track); | 275 DCHECK(m_track); |
| 276 | 276 |
| 277 HeapVector<Member<TextTrackCue>> newCues; | 277 HeapVector<Member<TextTrackCue>> newCues; |
| 278 m_loader->getNewCues(newCues); | 278 m_loader->getNewCues(newCues); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 292 } | 292 } |
| 293 | 293 |
| 294 void HTMLTrackElement::cueLoadingCompleted(TextTrackLoader* loader, bool loading
Failed) | 294 void HTMLTrackElement::cueLoadingCompleted(TextTrackLoader* loader, bool loading
Failed) |
| 295 { | 295 { |
| 296 DCHECK_EQ(m_loader, loader); | 296 DCHECK_EQ(m_loader, loader); |
| 297 | 297 |
| 298 didCompleteLoad(loadingFailed ? Failure : Success); | 298 didCompleteLoad(loadingFailed ? Failure : Success); |
| 299 } | 299 } |
| 300 | 300 |
| 301 // NOTE: The values in the TextTrack::ReadinessState enum must stay in sync with
those in HTMLTrackElement::ReadyState. | 301 // NOTE: The values in the TextTrack::ReadinessState enum must stay in sync with
those in HTMLTrackElement::ReadyState. |
| 302 static_assert(HTMLTrackElement::NONE == static_cast<HTMLTrackElement::ReadyState
>(TextTrack::NotLoaded), "HTMLTrackElement::NONE should be in sync with TextTrac
k::NotLoaded"); | 302 static_assert(HTMLTrackElement::kNone == static_cast<HTMLTrackElement::ReadyStat
e>(TextTrack::NotLoaded), "HTMLTrackElement::kNone should be in sync with TextTr
ack::NotLoaded"); |
| 303 static_assert(HTMLTrackElement::LOADING == static_cast<HTMLTrackElement::ReadySt
ate>(TextTrack::Loading), "HTMLTrackElement::LOADING should be in sync with Text
Track::Loading"); | 303 static_assert(HTMLTrackElement::kLoading == static_cast<HTMLTrackElement::ReadyS
tate>(TextTrack::Loading), "HTMLTrackElement::kLoading should be in sync with Te
xtTrack::Loading"); |
| 304 static_assert(HTMLTrackElement::LOADED == static_cast<HTMLTrackElement::ReadySta
te>(TextTrack::Loaded), "HTMLTrackElement::LOADED should be in sync with TextTra
ck::Loaded"); | 304 static_assert(HTMLTrackElement::kLoaded == static_cast<HTMLTrackElement::ReadySt
ate>(TextTrack::Loaded), "HTMLTrackElement::kLoaded should be in sync with TextT
rack::Loaded"); |
| 305 static_assert(HTMLTrackElement::TRACK_ERROR == static_cast<HTMLTrackElement::Rea
dyState>(TextTrack::FailedToLoad), "HTMLTrackElement::TRACK_ERROR should be in s
ync with TextTrack::FailedToLoad"); | 305 static_assert(HTMLTrackElement::kError == static_cast<HTMLTrackElement::ReadySta
te>(TextTrack::FailedToLoad), "HTMLTrackElement::kError should be in sync with T
extTrack::FailedToLoad"); |
| 306 | 306 |
| 307 void HTMLTrackElement::setReadyState(ReadyState state) | 307 void HTMLTrackElement::setReadyState(ReadyState state) |
| 308 { | 308 { |
| 309 ensureTrack()->setReadinessState(static_cast<TextTrack::ReadinessState>(stat
e)); | 309 ensureTrack()->setReadinessState(static_cast<TextTrack::ReadinessState>(stat
e)); |
| 310 if (HTMLMediaElement* parent = mediaElement()) | 310 if (HTMLMediaElement* parent = mediaElement()) |
| 311 return parent->textTrackReadyStateChanged(m_track.get()); | 311 return parent->textTrackReadyStateChanged(m_track.get()); |
| 312 } | 312 } |
| 313 | 313 |
| 314 HTMLTrackElement::ReadyState HTMLTrackElement::getReadyState() | 314 HTMLTrackElement::ReadyState HTMLTrackElement::getReadyState() |
| 315 { | 315 { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 333 } | 333 } |
| 334 | 334 |
| 335 DEFINE_TRACE(HTMLTrackElement) | 335 DEFINE_TRACE(HTMLTrackElement) |
| 336 { | 336 { |
| 337 visitor->trace(m_track); | 337 visitor->trace(m_track); |
| 338 visitor->trace(m_loader); | 338 visitor->trace(m_loader); |
| 339 HTMLElement::trace(visitor); | 339 HTMLElement::trace(visitor); |
| 340 } | 340 } |
| 341 | 341 |
| 342 } // namespace blink | 342 } // namespace blink |
| OLD | NEW |