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 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 // | 415 // |
416 // Work around that restriction by accessing the Document from | 416 // Work around that restriction by accessing the Document from |
417 // a prefinalizer action instead, updating its delayed load count. | 417 // a prefinalizer action instead, updating its delayed load count. |
418 // If needed - if the Document has been detached and informed its | 418 // If needed - if the Document has been detached and informed its |
419 // ContextLifecycleObservers (which HTMLMediaElement is) that | 419 // ContextLifecycleObservers (which HTMLMediaElement is) that |
420 // it is being destroyed, the connection to the Document will | 420 // it is being destroyed, the connection to the Document will |
421 // have been severed already, but in that case there is no need | 421 // have been severed already, but in that case there is no need |
422 // to update the delayed load count. But if the Document hasn't | 422 // to update the delayed load count. But if the Document hasn't |
423 // been detached cleanly from any frame or it isn't dying in the | 423 // been detached cleanly from any frame or it isn't dying in the |
424 // same GC, we do update the delayed load count from the prefinalizer. | 424 // same GC, we do update the delayed load count from the prefinalizer. |
425 if (ActiveDOMObject::executionContext()) | 425 if (ActiveDOMObject::getExecutionContext()) |
426 setShouldDelayLoadEvent(false); | 426 setShouldDelayLoadEvent(false); |
427 | 427 |
428 // If the MediaSource object survived, notify that the media element | 428 // If the MediaSource object survived, notify that the media element |
429 // didn't. | 429 // didn't. |
430 if (Heap::isHeapObjectAlive(m_mediaSource)) | 430 if (Heap::isHeapObjectAlive(m_mediaSource)) |
431 closeMediaSource(); | 431 closeMediaSource(); |
432 | 432 |
433 // Oilpan: the player must be released, but the player object | 433 // Oilpan: the player must be released, but the player object |
434 // cannot safely access this player client any longer as parts of | 434 // cannot safely access this player client any longer as parts of |
435 // it may have been finalized already (like the media element's | 435 // it may have been finalized already (like the media element's |
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1027 KURL kurl(ParsedURLString, requestURL); | 1027 KURL kurl(ParsedURLString, requestURL); |
1028 m_webMediaPlayer = frame->loader().client()->createWebMediaPlayer(*this, loa
dType(), kurl, this); | 1028 m_webMediaPlayer = frame->loader().client()->createWebMediaPlayer(*this, loa
dType(), kurl, this); |
1029 if (!m_webMediaPlayer) { | 1029 if (!m_webMediaPlayer) { |
1030 mediaLoadingFailed(WebMediaPlayer::NetworkStateFormatError); | 1030 mediaLoadingFailed(WebMediaPlayer::NetworkStateFormatError); |
1031 return; | 1031 return; |
1032 } | 1032 } |
1033 | 1033 |
1034 if (layoutObject()) | 1034 if (layoutObject()) |
1035 layoutObject()->setShouldDoFullPaintInvalidation(); | 1035 layoutObject()->setShouldDoFullPaintInvalidation(); |
1036 // Make sure if we create/re-create the WebMediaPlayer that we update our wr
apper. | 1036 // Make sure if we create/re-create the WebMediaPlayer that we update our wr
apper. |
1037 m_audioSourceProvider.wrap(m_webMediaPlayer->audioSourceProvider()); | 1037 m_audioSourceProvider.wrap(m_webMediaPlayer->getAudioSourceProvider()); |
1038 m_webMediaPlayer->setVolume(effectiveMediaVolume()); | 1038 m_webMediaPlayer->setVolume(effectiveMediaVolume()); |
1039 | 1039 |
1040 m_webMediaPlayer->setPoster(posterImageURL()); | 1040 m_webMediaPlayer->setPoster(posterImageURL()); |
1041 | 1041 |
1042 m_webMediaPlayer->setPreload(effectivePreloadType()); | 1042 m_webMediaPlayer->setPreload(effectivePreloadType()); |
1043 | 1043 |
1044 m_webMediaPlayer->load(loadType(), kurl, corsMode()); | 1044 m_webMediaPlayer->load(loadType(), kurl, corsMode()); |
1045 | 1045 |
1046 if (isFullscreen()) { | 1046 if (isFullscreen()) { |
1047 // This handles any transition to or from fullscreen overlay mode. | 1047 // This handles any transition to or from fullscreen overlay mode. |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1183 } | 1183 } |
1184 | 1184 |
1185 bool HTMLMediaElement::isSafeToLoadURL(const KURL& url, InvalidURLAction actionI
fInvalid) | 1185 bool HTMLMediaElement::isSafeToLoadURL(const KURL& url, InvalidURLAction actionI
fInvalid) |
1186 { | 1186 { |
1187 if (!url.isValid()) { | 1187 if (!url.isValid()) { |
1188 WTF_LOG(Media, "HTMLMediaElement::isSafeToLoadURL(%p, %s) -> FALSE becau
se url is invalid", this, urlForLoggingMedia(url).utf8().data()); | 1188 WTF_LOG(Media, "HTMLMediaElement::isSafeToLoadURL(%p, %s) -> FALSE becau
se url is invalid", this, urlForLoggingMedia(url).utf8().data()); |
1189 return false; | 1189 return false; |
1190 } | 1190 } |
1191 | 1191 |
1192 LocalFrame* frame = document().frame(); | 1192 LocalFrame* frame = document().frame(); |
1193 if (!frame || !document().securityOrigin()->canDisplay(url)) { | 1193 if (!frame || !document().getSecurityOrigin()->canDisplay(url)) { |
1194 if (actionIfInvalid == Complain) | 1194 if (actionIfInvalid == Complain) |
1195 FrameLoader::reportLocalLoadFailed(frame, url.elidedString()); | 1195 FrameLoader::reportLocalLoadFailed(frame, url.elidedString()); |
1196 WTF_LOG(Media, "HTMLMediaElement::isSafeToLoadURL(%p, %s) -> FALSE rejec
ted by SecurityOrigin", this, urlForLoggingMedia(url).utf8().data()); | 1196 WTF_LOG(Media, "HTMLMediaElement::isSafeToLoadURL(%p, %s) -> FALSE rejec
ted by SecurityOrigin", this, urlForLoggingMedia(url).utf8().data()); |
1197 return false; | 1197 return false; |
1198 } | 1198 } |
1199 | 1199 |
1200 if (!document().contentSecurityPolicy()->allowMediaFromSource(url)) { | 1200 if (!document().contentSecurityPolicy()->allowMediaFromSource(url)) { |
1201 WTF_LOG(Media, "HTMLMediaElement::isSafeToLoadURL(%p, %s) -> rejected by
Content Security Policy", this, urlForLoggingMedia(url).utf8().data()); | 1201 WTF_LOG(Media, "HTMLMediaElement::isSafeToLoadURL(%p, %s) -> rejected by
Content Security Policy", this, urlForLoggingMedia(url).utf8().data()); |
1202 return false; | 1202 return false; |
1203 } | 1203 } |
(...skipping 1858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3062 } | 3062 } |
3063 | 3063 |
3064 void HTMLMediaElement::stopPeriodicTimers() | 3064 void HTMLMediaElement::stopPeriodicTimers() |
3065 { | 3065 { |
3066 m_progressEventTimer.stop(); | 3066 m_progressEventTimer.stop(); |
3067 m_playbackProgressTimer.stop(); | 3067 m_playbackProgressTimer.stop(); |
3068 } | 3068 } |
3069 | 3069 |
3070 void HTMLMediaElement::clearMediaPlayerAndAudioSourceProviderClientWithoutLockin
g() | 3070 void HTMLMediaElement::clearMediaPlayerAndAudioSourceProviderClientWithoutLockin
g() |
3071 { | 3071 { |
3072 audioSourceProvider().setClient(nullptr); | 3072 getAudioSourceProvider().setClient(nullptr); |
3073 if (m_webMediaPlayer) { | 3073 if (m_webMediaPlayer) { |
3074 m_audioSourceProvider.wrap(nullptr); | 3074 m_audioSourceProvider.wrap(nullptr); |
3075 m_webMediaPlayer.clear(); | 3075 m_webMediaPlayer.clear(); |
3076 } | 3076 } |
3077 } | 3077 } |
3078 | 3078 |
3079 void HTMLMediaElement::clearMediaPlayer(int flags) | 3079 void HTMLMediaElement::clearMediaPlayer(int flags) |
3080 { | 3080 { |
3081 forgetResourceSpecificTracks(); | 3081 forgetResourceSpecificTracks(); |
3082 | 3082 |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3495 { | 3495 { |
3496 AudioSourceProviderClientLockScope scope(*this); | 3496 AudioSourceProviderClientLockScope scope(*this); |
3497 clearMediaPlayerAndAudioSourceProviderClientWithoutLocking(); | 3497 clearMediaPlayerAndAudioSourceProviderClientWithoutLocking(); |
3498 } | 3498 } |
3499 | 3499 |
3500 // We haven't yet found out if any remote routes are available. | 3500 // We haven't yet found out if any remote routes are available. |
3501 m_remoteRoutesAvailable = false; | 3501 m_remoteRoutesAvailable = false; |
3502 m_playingRemotely = false; | 3502 m_playingRemotely = false; |
3503 | 3503 |
3504 if (m_audioSourceNode) | 3504 if (m_audioSourceNode) |
3505 audioSourceProvider().setClient(m_audioSourceNode); | 3505 getAudioSourceProvider().setClient(m_audioSourceNode); |
3506 } | 3506 } |
3507 | 3507 |
3508 void HTMLMediaElement::setAudioSourceNode(AudioSourceProviderClient* sourceNode) | 3508 void HTMLMediaElement::setAudioSourceNode(AudioSourceProviderClient* sourceNode) |
3509 { | 3509 { |
3510 ASSERT(isMainThread()); | 3510 ASSERT(isMainThread()); |
3511 m_audioSourceNode = sourceNode; | 3511 m_audioSourceNode = sourceNode; |
3512 | 3512 |
3513 AudioSourceProviderClientLockScope scope(*this); | 3513 AudioSourceProviderClientLockScope scope(*this); |
3514 audioSourceProvider().setClient(m_audioSourceNode); | 3514 getAudioSourceProvider().setClient(m_audioSourceNode); |
3515 } | 3515 } |
3516 | 3516 |
3517 void HTMLMediaElement::setAllowHiddenVolumeControls(bool allow) | 3517 void HTMLMediaElement::setAllowHiddenVolumeControls(bool allow) |
3518 { | 3518 { |
3519 ensureMediaControls(); | 3519 ensureMediaControls(); |
3520 mediaControls()->setAllowHiddenVolumeControls(allow); | 3520 mediaControls()->setAllowHiddenVolumeControls(allow); |
3521 } | 3521 } |
3522 | 3522 |
3523 WebMediaPlayer::CORSMode HTMLMediaElement::corsMode() const | 3523 WebMediaPlayer::CORSMode HTMLMediaElement::corsMode() const |
3524 { | 3524 { |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3720 | 3720 |
3721 for (auto& resolver: m_playResolvers) | 3721 for (auto& resolver: m_playResolvers) |
3722 resolver->reject(DOMException::create(code, message)); | 3722 resolver->reject(DOMException::create(code, message)); |
3723 | 3723 |
3724 m_playResolvers.clear(); | 3724 m_playResolvers.clear(); |
3725 } | 3725 } |
3726 | 3726 |
3727 void HTMLMediaElement::clearWeakMembers(Visitor* visitor) | 3727 void HTMLMediaElement::clearWeakMembers(Visitor* visitor) |
3728 { | 3728 { |
3729 if (!Heap::isHeapObjectAlive(m_audioSourceNode)) | 3729 if (!Heap::isHeapObjectAlive(m_audioSourceNode)) |
3730 audioSourceProvider().setClient(nullptr); | 3730 getAudioSourceProvider().setClient(nullptr); |
3731 } | 3731 } |
3732 | 3732 |
3733 void HTMLMediaElement::AudioSourceProviderImpl::wrap(WebAudioSourceProvider* pro
vider) | 3733 void HTMLMediaElement::AudioSourceProviderImpl::wrap(WebAudioSourceProvider* pro
vider) |
3734 { | 3734 { |
3735 MutexLocker locker(provideInputLock); | 3735 MutexLocker locker(provideInputLock); |
3736 | 3736 |
3737 if (m_webAudioSourceProvider && provider != m_webAudioSourceProvider) | 3737 if (m_webAudioSourceProvider && provider != m_webAudioSourceProvider) |
3738 m_webAudioSourceProvider->setClient(nullptr); | 3738 m_webAudioSourceProvider->setClient(nullptr); |
3739 | 3739 |
3740 m_webAudioSourceProvider = provider; | 3740 m_webAudioSourceProvider = provider; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3784 { | 3784 { |
3785 visitor->trace(m_client); | 3785 visitor->trace(m_client); |
3786 } | 3786 } |
3787 | 3787 |
3788 DEFINE_TRACE(HTMLMediaElement::AudioSourceProviderImpl) | 3788 DEFINE_TRACE(HTMLMediaElement::AudioSourceProviderImpl) |
3789 { | 3789 { |
3790 visitor->trace(m_client); | 3790 visitor->trace(m_client); |
3791 } | 3791 } |
3792 | 3792 |
3793 } // namespace blink | 3793 } // namespace blink |
OLD | NEW |