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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 | 186 |
187 // 10. If URL is not the empty string, perform a potentially CORS-enabled fe
tch of URL, with the mode being CORS | 187 // 10. If URL is not the empty string, perform a potentially CORS-enabled fe
tch of URL, with the mode being CORS |
188 // mode, the origin being the origin of the track element's node document, a
nd the default origin behaviour set to | 188 // mode, the origin being the origin of the track element's node document, a
nd the default origin behaviour set to |
189 // fail. | 189 // fail. |
190 if (!canLoadUrl(url)) { | 190 if (!canLoadUrl(url)) { |
191 didCompleteLoad(Failure); | 191 didCompleteLoad(Failure); |
192 return; | 192 return; |
193 } | 193 } |
194 | 194 |
195 if (url == m_url) { | 195 if (url == m_url) { |
196 ASSERT(m_loader); | 196 DCHECK(m_loader); |
197 switch (m_loader->loadState()) { | 197 switch (m_loader->loadState()) { |
198 case TextTrackLoader::Idle: | 198 case TextTrackLoader::Idle: |
199 case TextTrackLoader::Loading: | 199 case TextTrackLoader::Loading: |
200 // If loading of the resource from this URL is in progress, return e
arly. | 200 // If loading of the resource from this URL is in progress, return e
arly. |
201 break; | 201 break; |
202 case TextTrackLoader::Finished: | 202 case TextTrackLoader::Finished: |
203 didCompleteLoad(Success); | 203 didCompleteLoad(Success); |
204 break; | 204 break; |
205 case TextTrackLoader::Failed: | 205 case TextTrackLoader::Failed: |
206 didCompleteLoad(Failure); | 206 didCompleteLoad(Failure); |
207 break; | 207 break; |
208 default: | 208 default: |
209 ASSERT_NOT_REACHED(); | 209 NOTREACHED(); |
210 } | 210 } |
211 return; | 211 return; |
212 } | 212 } |
213 | 213 |
214 m_url = url; | 214 m_url = url; |
215 | 215 |
216 if (m_loader) | 216 if (m_loader) |
217 m_loader->cancelLoad(); | 217 m_loader->cancelLoad(); |
218 | 218 |
219 m_loader = TextTrackLoader::create(*this, document()); | 219 m_loader = TextTrackLoader::create(*this, document()); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(LOADED); |
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 ASSERT_UNUSED(loader, m_loader == loader); | 274 DCHECK_EQ(m_loader, loader); |
275 ASSERT(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); |
279 | 279 |
280 m_track->addListOfCues(newCues); | 280 m_track->addListOfCues(newCues); |
281 } | 281 } |
282 | 282 |
283 void HTMLTrackElement::newRegionsAvailable(TextTrackLoader* loader) | 283 void HTMLTrackElement::newRegionsAvailable(TextTrackLoader* loader) |
284 { | 284 { |
285 ASSERT_UNUSED(loader, m_loader == loader); | 285 DCHECK_EQ(m_loader, loader); |
286 ASSERT(m_track); | 286 DCHECK(m_track); |
287 | 287 |
288 HeapVector<Member<VTTRegion>> newRegions; | 288 HeapVector<Member<VTTRegion>> newRegions; |
289 m_loader->getNewRegions(newRegions); | 289 m_loader->getNewRegions(newRegions); |
290 | 290 |
291 m_track->addRegions(newRegions); | 291 m_track->addRegions(newRegions); |
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 ASSERT_UNUSED(loader, 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::NONE == static_cast<HTMLTrackElement::ReadyState
>(TextTrack::NotLoaded), "HTMLTrackElement::NONE should be in sync with TextTrac
k::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::LOADING == static_cast<HTMLTrackElement::ReadySt
ate>(TextTrack::Loading), "HTMLTrackElement::LOADING should be in sync with Text
Track::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::LOADED == static_cast<HTMLTrackElement::ReadySta
te>(TextTrack::Loaded), "HTMLTrackElement::LOADED should be in sync with TextTra
ck::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::TRACK_ERROR == static_cast<HTMLTrackElement::Rea
dyState>(TextTrack::FailedToLoad), "HTMLTrackElement::TRACK_ERROR should be in s
ync with TextTrack::FailedToLoad"); |
306 | 306 |
(...skipping 26 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 |