| 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 // Default to not logging warnings about excessive drift in the cached media tim
e because it adds a | 115 // Default to not logging warnings about excessive drift in the cached media tim
e because it adds a |
| 116 // fair amount of overhead and logging. | 116 // fair amount of overhead and logging. |
| 117 #define LOG_CACHED_TIME_WARNINGS 0 | 117 #define LOG_CACHED_TIME_WARNINGS 0 |
| 118 #endif | 118 #endif |
| 119 | 119 |
| 120 // URL protocol used to signal that the media source API is being used. | 120 // URL protocol used to signal that the media source API is being used. |
| 121 static const char mediaSourceBlobProtocol[] = "blob"; | 121 static const char mediaSourceBlobProtocol[] = "blob"; |
| 122 | 122 |
| 123 using namespace HTMLNames; | 123 using namespace HTMLNames; |
| 124 | 124 |
| 125 typedef WillBeHeapHashSet<RawPtrWillBeWeakMember<HTMLMediaElement>> WeakMediaEle
mentSet; | 125 typedef HeapHashSet<WeakMember<HTMLMediaElement>> WeakMediaElementSet; |
| 126 typedef WillBeHeapHashMap<RawPtrWillBeWeakMember<Document>, WeakMediaElementSet>
DocumentElementSetMap; | 126 typedef HeapHashMap<WeakMember<Document>, WeakMediaElementSet> DocumentElementSe
tMap; |
| 127 static DocumentElementSetMap& documentToElementSetMap() | 127 static DocumentElementSetMap& documentToElementSetMap() |
| 128 { | 128 { |
| 129 DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<DocumentElementSetMap>, map, (ado
ptPtrWillBeNoop(new DocumentElementSetMap()))); | 129 DEFINE_STATIC_LOCAL(Persistent<DocumentElementSetMap>, map, ((new DocumentEl
ementSetMap()))); |
| 130 return *map; | 130 return *map; |
| 131 } | 131 } |
| 132 | 132 |
| 133 static void addElementToDocumentMap(HTMLMediaElement* element, Document* documen
t) | 133 static void addElementToDocumentMap(HTMLMediaElement* element, Document* documen
t) |
| 134 { | 134 { |
| 135 DocumentElementSetMap& map = documentToElementSetMap(); | 135 DocumentElementSetMap& map = documentToElementSetMap(); |
| 136 WeakMediaElementSet set = map.take(document); | 136 WeakMediaElementSet set = map.take(document); |
| 137 set.add(element); | 137 set.add(element); |
| 138 map.add(document, set); | 138 map.add(document, set); |
| 139 } | 139 } |
| (...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 // Schedule the timer to try the next <source> element WITHOUT resetting sta
te ala prepareForLoad. | 588 // Schedule the timer to try the next <source> element WITHOUT resetting sta
te ala prepareForLoad. |
| 589 m_pendingActionFlags |= LoadMediaResource; | 589 m_pendingActionFlags |= LoadMediaResource; |
| 590 m_loadTimer.startOneShot(0, BLINK_FROM_HERE); | 590 m_loadTimer.startOneShot(0, BLINK_FROM_HERE); |
| 591 } | 591 } |
| 592 | 592 |
| 593 void HTMLMediaElement::scheduleEvent(const AtomicString& eventName) | 593 void HTMLMediaElement::scheduleEvent(const AtomicString& eventName) |
| 594 { | 594 { |
| 595 scheduleEvent(Event::createCancelable(eventName)); | 595 scheduleEvent(Event::createCancelable(eventName)); |
| 596 } | 596 } |
| 597 | 597 |
| 598 void HTMLMediaElement::scheduleEvent(PassRefPtrWillBeRawPtr<Event> event) | 598 void HTMLMediaElement::scheduleEvent(RawPtr<Event> event) |
| 599 { | 599 { |
| 600 #if LOG_MEDIA_EVENTS | 600 #if LOG_MEDIA_EVENTS |
| 601 WTF_LOG(Media, "HTMLMediaElement::scheduleEvent(%p) - scheduling '%s'", this
, event->type().ascii().data()); | 601 WTF_LOG(Media, "HTMLMediaElement::scheduleEvent(%p) - scheduling '%s'", this
, event->type().ascii().data()); |
| 602 #endif | 602 #endif |
| 603 m_asyncEventQueue->enqueueEvent(event); | 603 m_asyncEventQueue->enqueueEvent(event); |
| 604 } | 604 } |
| 605 | 605 |
| 606 void HTMLMediaElement::loadTimerFired(Timer<HTMLMediaElement>*) | 606 void HTMLMediaElement::loadTimerFired(Timer<HTMLMediaElement>*) |
| 607 { | 607 { |
| 608 if (m_pendingActionFlags & LoadTextTrackResource) | 608 if (m_pendingActionFlags & LoadTextTrackResource) |
| (...skipping 1900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2509 AutomaticTrackSelection trackSelection(configuration); | 2509 AutomaticTrackSelection trackSelection(configuration); |
| 2510 trackSelection.perform(*m_textTracks); | 2510 trackSelection.perform(*m_textTracks); |
| 2511 | 2511 |
| 2512 textTracksChanged(); | 2512 textTracksChanged(); |
| 2513 } | 2513 } |
| 2514 | 2514 |
| 2515 bool HTMLMediaElement::havePotentialSourceChild() | 2515 bool HTMLMediaElement::havePotentialSourceChild() |
| 2516 { | 2516 { |
| 2517 // Stash the current <source> node and next nodes so we can restore them aft
er checking | 2517 // Stash the current <source> node and next nodes so we can restore them aft
er checking |
| 2518 // to see there is another potential. | 2518 // to see there is another potential. |
| 2519 RefPtrWillBeRawPtr<HTMLSourceElement> currentSourceNode = m_currentSourceNod
e; | 2519 RawPtr<HTMLSourceElement> currentSourceNode = m_currentSourceNode; |
| 2520 RefPtrWillBeRawPtr<Node> nextNode = m_nextChildNodeToConsider; | 2520 RawPtr<Node> nextNode = m_nextChildNodeToConsider; |
| 2521 | 2521 |
| 2522 KURL nextURL = selectNextSourceChild(0, 0, DoNothing); | 2522 KURL nextURL = selectNextSourceChild(0, 0, DoNothing); |
| 2523 | 2523 |
| 2524 m_currentSourceNode = currentSourceNode; | 2524 m_currentSourceNode = currentSourceNode; |
| 2525 m_nextChildNodeToConsider = nextNode; | 2525 m_nextChildNodeToConsider = nextNode; |
| 2526 | 2526 |
| 2527 return nextURL.isValid(); | 2527 return nextURL.isValid(); |
| 2528 } | 2528 } |
| 2529 | 2529 |
| 2530 KURL HTMLMediaElement::selectNextSourceChild(ContentType* contentType, String* k
eySystem, InvalidURLAction actionIfInvalid) | 2530 KURL HTMLMediaElement::selectNextSourceChild(ContentType* contentType, String* k
eySystem, InvalidURLAction actionIfInvalid) |
| (...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3166 | 3166 |
| 3167 TextTrackContainer& HTMLMediaElement::ensureTextTrackContainer() | 3167 TextTrackContainer& HTMLMediaElement::ensureTextTrackContainer() |
| 3168 { | 3168 { |
| 3169 ShadowRoot& shadowRoot = ensureUserAgentShadowRoot(); | 3169 ShadowRoot& shadowRoot = ensureUserAgentShadowRoot(); |
| 3170 assertShadowRootChildren(shadowRoot); | 3170 assertShadowRootChildren(shadowRoot); |
| 3171 | 3171 |
| 3172 Node* firstChild = shadowRoot.firstChild(); | 3172 Node* firstChild = shadowRoot.firstChild(); |
| 3173 if (firstChild && firstChild->isTextTrackContainer()) | 3173 if (firstChild && firstChild->isTextTrackContainer()) |
| 3174 return toTextTrackContainer(*firstChild); | 3174 return toTextTrackContainer(*firstChild); |
| 3175 | 3175 |
| 3176 RefPtrWillBeRawPtr<TextTrackContainer> textTrackContainer = TextTrackContain
er::create(document()); | 3176 RawPtr<TextTrackContainer> textTrackContainer = TextTrackContainer::create(d
ocument()); |
| 3177 | 3177 |
| 3178 // The text track container should be inserted before the media controls, | 3178 // The text track container should be inserted before the media controls, |
| 3179 // so that they are rendered behind them. | 3179 // so that they are rendered behind them. |
| 3180 shadowRoot.insertBefore(textTrackContainer, firstChild); | 3180 shadowRoot.insertBefore(textTrackContainer, firstChild); |
| 3181 | 3181 |
| 3182 assertShadowRootChildren(shadowRoot); | 3182 assertShadowRootChildren(shadowRoot); |
| 3183 | 3183 |
| 3184 return *textTrackContainer; | 3184 return *textTrackContainer; |
| 3185 } | 3185 } |
| 3186 | 3186 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3308 } | 3308 } |
| 3309 | 3309 |
| 3310 return nullptr; | 3310 return nullptr; |
| 3311 } | 3311 } |
| 3312 | 3312 |
| 3313 void HTMLMediaElement::ensureMediaControls() | 3313 void HTMLMediaElement::ensureMediaControls() |
| 3314 { | 3314 { |
| 3315 if (mediaControls()) | 3315 if (mediaControls()) |
| 3316 return; | 3316 return; |
| 3317 | 3317 |
| 3318 RefPtrWillBeRawPtr<MediaControls> mediaControls = MediaControls::create(*thi
s); | 3318 RawPtr<MediaControls> mediaControls = MediaControls::create(*this); |
| 3319 | 3319 |
| 3320 mediaControls->reset(); | 3320 mediaControls->reset(); |
| 3321 if (isFullscreen()) | 3321 if (isFullscreen()) |
| 3322 mediaControls->enteredFullscreen(); | 3322 mediaControls->enteredFullscreen(); |
| 3323 | 3323 |
| 3324 ShadowRoot& shadowRoot = ensureUserAgentShadowRoot(); | 3324 ShadowRoot& shadowRoot = ensureUserAgentShadowRoot(); |
| 3325 assertShadowRootChildren(shadowRoot); | 3325 assertShadowRootChildren(shadowRoot); |
| 3326 | 3326 |
| 3327 // The media controls should be inserted after the text track container, | 3327 // The media controls should be inserted after the text track container, |
| 3328 // so that they are rendered in front of captions and subtitles. | 3328 // so that they are rendered in front of captions and subtitles. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 3346 mediaControls()->reset(); | 3346 mediaControls()->reset(); |
| 3347 if (shouldShowControls()) | 3347 if (shouldShowControls()) |
| 3348 mediaControls()->show(); | 3348 mediaControls()->show(); |
| 3349 else | 3349 else |
| 3350 mediaControls()->hide(); | 3350 mediaControls()->hide(); |
| 3351 } | 3351 } |
| 3352 | 3352 |
| 3353 CueTimeline& HTMLMediaElement::cueTimeline() | 3353 CueTimeline& HTMLMediaElement::cueTimeline() |
| 3354 { | 3354 { |
| 3355 if (!m_cueTimeline) | 3355 if (!m_cueTimeline) |
| 3356 m_cueTimeline = adoptPtrWillBeNoop(new CueTimeline(*this)); | 3356 m_cueTimeline = (new CueTimeline(*this)); |
| 3357 return *m_cueTimeline; | 3357 return *m_cueTimeline; |
| 3358 } | 3358 } |
| 3359 | 3359 |
| 3360 void HTMLMediaElement::configureTextTrackDisplay() | 3360 void HTMLMediaElement::configureTextTrackDisplay() |
| 3361 { | 3361 { |
| 3362 ASSERT(m_textTracks); | 3362 ASSERT(m_textTracks); |
| 3363 WTF_LOG(Media, "HTMLMediaElement::configureTextTrackDisplay(%p)", this); | 3363 WTF_LOG(Media, "HTMLMediaElement::configureTextTrackDisplay(%p)", this); |
| 3364 | 3364 |
| 3365 if (m_processingPreferenceChange) | 3365 if (m_processingPreferenceChange) |
| 3366 return; | 3366 return; |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3626 { | 3626 { |
| 3627 visitor->trace(m_client); | 3627 visitor->trace(m_client); |
| 3628 } | 3628 } |
| 3629 | 3629 |
| 3630 DEFINE_TRACE(HTMLMediaElement::AudioSourceProviderImpl) | 3630 DEFINE_TRACE(HTMLMediaElement::AudioSourceProviderImpl) |
| 3631 { | 3631 { |
| 3632 visitor->trace(m_client); | 3632 visitor->trace(m_client); |
| 3633 } | 3633 } |
| 3634 | 3634 |
| 3635 } // namespace blink | 3635 } // namespace blink |
| OLD | NEW |