OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple 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 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
525 | 525 |
526 void HTMLMediaElement::scheduleDelayedAction(DelayedActionType actionType) | 526 void HTMLMediaElement::scheduleDelayedAction(DelayedActionType actionType) |
527 { | 527 { |
528 LOG(Media, "HTMLMediaElement::scheduleDelayedAction"); | 528 LOG(Media, "HTMLMediaElement::scheduleDelayedAction"); |
529 | 529 |
530 if ((actionType & LoadMediaResource) && !(m_pendingActionFlags & LoadMediaRe source)) { | 530 if ((actionType & LoadMediaResource) && !(m_pendingActionFlags & LoadMediaRe source)) { |
531 prepareForLoad(); | 531 prepareForLoad(); |
532 m_pendingActionFlags |= LoadMediaResource; | 532 m_pendingActionFlags |= LoadMediaResource; |
533 } | 533 } |
534 | 534 |
535 if (RuntimeEnabledFeatures::videoTrackEnabled() && (actionType & LoadTextTra ckResource)) | 535 if (actionType & LoadTextTrackResource) { |
536 ASSERT(RuntimeEnabledFeatures::videoTrackEnabled()); | |
536 m_pendingActionFlags |= LoadTextTrackResource; | 537 m_pendingActionFlags |= LoadTextTrackResource; |
538 } | |
537 | 539 |
538 if (!m_loadTimer.isActive()) | 540 if (!m_loadTimer.isActive()) |
539 m_loadTimer.startOneShot(0); | 541 m_loadTimer.startOneShot(0); |
540 } | 542 } |
541 | 543 |
542 void HTMLMediaElement::scheduleNextSourceChild() | 544 void HTMLMediaElement::scheduleNextSourceChild() |
543 { | 545 { |
544 // Schedule the timer to try the next <source> element WITHOUT resetting sta te ala prepareForLoad. | 546 // Schedule the timer to try the next <source> element WITHOUT resetting sta te ala prepareForLoad. |
545 m_pendingActionFlags |= LoadMediaResource; | 547 m_pendingActionFlags |= LoadMediaResource; |
546 m_loadTimer.startOneShot(0); | 548 m_loadTimer.startOneShot(0); |
547 } | 549 } |
548 | 550 |
549 void HTMLMediaElement::scheduleEvent(const AtomicString& eventName) | 551 void HTMLMediaElement::scheduleEvent(const AtomicString& eventName) |
550 { | 552 { |
551 #if LOG_MEDIA_EVENTS | 553 #if LOG_MEDIA_EVENTS |
552 LOG(Media, "HTMLMediaElement::scheduleEvent - scheduling '%s'", eventName.st ring().ascii().data()); | 554 LOG(Media, "HTMLMediaElement::scheduleEvent - scheduling '%s'", eventName.st ring().ascii().data()); |
553 #endif | 555 #endif |
554 m_asyncEventQueue->enqueueEvent(Event::createCancelable(eventName)); | 556 m_asyncEventQueue->enqueueEvent(Event::createCancelable(eventName)); |
555 } | 557 } |
556 | 558 |
557 void HTMLMediaElement::loadTimerFired(Timer<HTMLMediaElement>*) | 559 void HTMLMediaElement::loadTimerFired(Timer<HTMLMediaElement>*) |
558 { | 560 { |
559 RefPtr<HTMLMediaElement> protect(this); // loadNextSourceChild may fire 'bef oreload', which can make arbitrary DOM mutations. | 561 RefPtr<HTMLMediaElement> protect(this); // loadNextSourceChild may fire 'bef oreload', which can make arbitrary DOM mutations. |
560 | 562 |
561 if (RuntimeEnabledFeatures::videoTrackEnabled() && (m_pendingActionFlags & L oadTextTrackResource)) | 563 if (m_pendingActionFlags & LoadTextTrackResource) { |
564 ASSERT(RuntimeEnabledFeatures::videoTrackEnabled()); | |
adamk
2013/11/08 19:25:17
Will this ASSERT ever be exercised? That is, do we
philipj_slow
2013/11/08 19:53:02
This assert in particular won't be reached even if
adamk
2013/11/08 20:15:00
Sorry, it's not this particular assert I'm curious
philipj_slow
2013/11/08 20:42:47
Hmm, so the reason that I changed this was because
| |
562 configureTextTracks(); | 565 configureTextTracks(); |
566 } | |
563 | 567 |
564 if (m_pendingActionFlags & LoadMediaResource) { | 568 if (m_pendingActionFlags & LoadMediaResource) { |
565 if (m_loadState == LoadingFromSourceElement) | 569 if (m_loadState == LoadingFromSourceElement) |
566 loadNextSourceChild(); | 570 loadNextSourceChild(); |
567 else | 571 else |
568 loadInternal(); | 572 loadInternal(); |
569 } | 573 } |
570 | 574 |
571 m_pendingActionFlags = 0; | 575 m_pendingActionFlags = 0; |
572 } | 576 } |
(...skipping 1954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2527 for (int i = m_textTracks->length() - 1; i >= 0; --i) { | 2531 for (int i = m_textTracks->length() - 1; i >= 0; --i) { |
2528 TextTrack* track = m_textTracks->item(i); | 2532 TextTrack* track = m_textTracks->item(i); |
2529 | 2533 |
2530 if (track->trackType() == TextTrack::InBand) | 2534 if (track->trackType() == TextTrack::InBand) |
2531 removeTrack(track); | 2535 removeTrack(track); |
2532 } | 2536 } |
2533 } | 2537 } |
2534 | 2538 |
2535 PassRefPtr<TextTrack> HTMLMediaElement::addTextTrack(const String& kind, const S tring& label, const String& language, ExceptionState& es) | 2539 PassRefPtr<TextTrack> HTMLMediaElement::addTextTrack(const String& kind, const S tring& label, const String& language, ExceptionState& es) |
2536 { | 2540 { |
2537 if (!RuntimeEnabledFeatures::videoTrackEnabled()) | 2541 ASSERT(RuntimeEnabledFeatures::videoTrackEnabled()); |
2538 return 0; | |
2539 | 2542 |
2540 // 4.8.10.12.4 Text track API | 2543 // 4.8.10.12.4 Text track API |
2541 // The addTextTrack(kind, label, language) method of media elements, when in voked, must run the following steps: | 2544 // The addTextTrack(kind, label, language) method of media elements, when in voked, must run the following steps: |
2542 | 2545 |
2543 // 1. If kind is not one of the following strings, then throw a SyntaxError exception and abort these steps | 2546 // 1. If kind is not one of the following strings, then throw a SyntaxError exception and abort these steps |
2544 if (!TextTrack::isValidKindKeyword(kind)) { | 2547 if (!TextTrack::isValidKindKeyword(kind)) { |
2545 es.throwUninformativeAndGenericDOMException(SyntaxError); | 2548 es.throwUninformativeAndGenericDOMException(SyntaxError); |
2546 return 0; | 2549 return 0; |
2547 } | 2550 } |
2548 | 2551 |
(...skipping 15 matching lines...) Expand all Loading... | |
2564 textTrack->setReadinessState(TextTrack::Loaded); | 2567 textTrack->setReadinessState(TextTrack::Loaded); |
2565 | 2568 |
2566 // ... its text track mode to the text track hidden mode, and its text track list of cues to an empty list ... | 2569 // ... its text track mode to the text track hidden mode, and its text track list of cues to an empty list ... |
2567 textTrack->setMode(TextTrack::hiddenKeyword()); | 2570 textTrack->setMode(TextTrack::hiddenKeyword()); |
2568 | 2571 |
2569 return textTrack.release(); | 2572 return textTrack.release(); |
2570 } | 2573 } |
2571 | 2574 |
2572 TextTrackList* HTMLMediaElement::textTracks() | 2575 TextTrackList* HTMLMediaElement::textTracks() |
2573 { | 2576 { |
2574 if (!RuntimeEnabledFeatures::videoTrackEnabled()) | 2577 ASSERT(RuntimeEnabledFeatures::videoTrackEnabled()); |
2575 return 0; | |
2576 | 2578 |
2577 if (!m_textTracks) | 2579 if (!m_textTracks) |
2578 m_textTracks = TextTrackList::create(this); | 2580 m_textTracks = TextTrackList::create(this); |
2579 | 2581 |
2580 return m_textTracks.get(); | 2582 return m_textTracks.get(); |
2581 } | 2583 } |
2582 | 2584 |
2583 void HTMLMediaElement::didAddTrack(HTMLTrackElement* trackElement) | 2585 void HTMLMediaElement::didAddTrack(HTMLTrackElement* trackElement) |
2584 { | 2586 { |
2585 ASSERT(trackElement->hasTagName(trackTag)); | 2587 ASSERT(trackElement->hasTagName(trackTag)); |
2586 | 2588 ASSERT(RuntimeEnabledFeatures::videoTrackEnabled()); |
2587 if (!RuntimeEnabledFeatures::videoTrackEnabled()) | |
2588 return; | |
2589 | 2589 |
2590 // 4.8.10.12.3 Sourcing out-of-band text tracks | 2590 // 4.8.10.12.3 Sourcing out-of-band text tracks |
2591 // When a track element's parent element changes and the new parent is a med ia element, | 2591 // When a track element's parent element changes and the new parent is a med ia element, |
2592 // then the user agent must add the track element's corresponding text track to the | 2592 // then the user agent must add the track element's corresponding text track to the |
2593 // media element's list of text tracks ... [continues in TextTrackList::appe nd] | 2593 // media element's list of text tracks ... [continues in TextTrackList::appe nd] |
2594 RefPtr<TextTrack> textTrack = trackElement->track(); | 2594 RefPtr<TextTrack> textTrack = trackElement->track(); |
2595 if (!textTrack) | 2595 if (!textTrack) |
2596 return; | 2596 return; |
2597 | 2597 |
2598 addTrack(textTrack.get()); | 2598 addTrack(textTrack.get()); |
2599 | 2599 |
2600 // Do not schedule the track loading until parsing finishes so we don't star t before all tracks | 2600 // Do not schedule the track loading until parsing finishes so we don't star t before all tracks |
2601 // in the markup have been added. | 2601 // in the markup have been added. |
2602 if (!m_parsingInProgress) | 2602 if (!m_parsingInProgress) |
2603 scheduleDelayedAction(LoadTextTrackResource); | 2603 scheduleDelayedAction(LoadTextTrackResource); |
2604 | 2604 |
2605 if (hasMediaControls()) | 2605 if (hasMediaControls()) |
2606 mediaControls()->closedCaptionTracksChanged(); | 2606 mediaControls()->closedCaptionTracksChanged(); |
2607 } | 2607 } |
2608 | 2608 |
2609 void HTMLMediaElement::didRemoveTrack(HTMLTrackElement* trackElement) | 2609 void HTMLMediaElement::didRemoveTrack(HTMLTrackElement* trackElement) |
2610 { | 2610 { |
2611 ASSERT(trackElement->hasTagName(trackTag)); | 2611 ASSERT(trackElement->hasTagName(trackTag)); |
2612 | 2612 ASSERT(RuntimeEnabledFeatures::videoTrackEnabled()); |
2613 if (!RuntimeEnabledFeatures::videoTrackEnabled()) | |
2614 return; | |
2615 | 2613 |
2616 #if !LOG_DISABLED | 2614 #if !LOG_DISABLED |
2617 if (trackElement->hasTagName(trackTag)) { | 2615 if (trackElement->hasTagName(trackTag)) { |
2618 KURL url = trackElement->getNonEmptyURLAttribute(srcAttr); | 2616 KURL url = trackElement->getNonEmptyURLAttribute(srcAttr); |
2619 LOG(Media, "HTMLMediaElement::didRemoveTrack - 'src' is %s", urlForLoggi ngMedia(url).utf8().data()); | 2617 LOG(Media, "HTMLMediaElement::didRemoveTrack - 'src' is %s", urlForLoggi ngMedia(url).utf8().data()); |
2620 } | 2618 } |
2621 #endif | 2619 #endif |
2622 | 2620 |
2623 RefPtr<TextTrack> textTrack = trackElement->track(); | 2621 RefPtr<TextTrack> textTrack = trackElement->track(); |
2624 if (!textTrack) | 2622 if (!textTrack) |
(...skipping 1246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3871 { | 3869 { |
3872 scheduleLayerUpdate(); | 3870 scheduleLayerUpdate(); |
3873 } | 3871 } |
3874 | 3872 |
3875 bool HTMLMediaElement::isInteractiveContent() const | 3873 bool HTMLMediaElement::isInteractiveContent() const |
3876 { | 3874 { |
3877 return fastHasAttribute(controlsAttr); | 3875 return fastHasAttribute(controlsAttr); |
3878 } | 3876 } |
3879 | 3877 |
3880 } | 3878 } |
OLD | NEW |