| 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 11 matching lines...) Expand all Loading... |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #include "core/html/HTMLMediaElement.h" | 26 #include "core/html/HTMLMediaElement.h" |
| 27 | 27 |
| 28 #include "bindings/core/v8/ExceptionState.h" | 28 #include "bindings/core/v8/ExceptionState.h" |
| 29 #include "bindings/core/v8/ExceptionStatePlaceholder.h" | 29 #include "bindings/core/v8/ExceptionStatePlaceholder.h" |
| 30 #include "bindings/core/v8/ScriptController.h" | 30 #include "bindings/core/v8/ScriptController.h" |
| 31 #include "bindings/core/v8/ScriptEventListener.h" | 31 #include "bindings/core/v8/ScriptEventListener.h" |
| 32 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 32 #include "core/HTMLNames.h" | 33 #include "core/HTMLNames.h" |
| 33 #include "core/css/MediaList.h" | 34 #include "core/css/MediaList.h" |
| 34 #include "core/dom/Attribute.h" | 35 #include "core/dom/Attribute.h" |
| 35 #include "core/dom/ElementTraversal.h" | 36 #include "core/dom/ElementTraversal.h" |
| 36 #include "core/dom/ExceptionCode.h" | |
| 37 #include "core/dom/Fullscreen.h" | 37 #include "core/dom/Fullscreen.h" |
| 38 #include "core/dom/shadow/ShadowRoot.h" | 38 #include "core/dom/shadow/ShadowRoot.h" |
| 39 #include "core/events/Event.h" | 39 #include "core/events/Event.h" |
| 40 #include "core/frame/LocalFrame.h" | 40 #include "core/frame/LocalFrame.h" |
| 41 #include "core/frame/Settings.h" | 41 #include "core/frame/Settings.h" |
| 42 #include "core/frame/UseCounter.h" | 42 #include "core/frame/UseCounter.h" |
| 43 #include "core/frame/csp/ContentSecurityPolicy.h" | 43 #include "core/frame/csp/ContentSecurityPolicy.h" |
| 44 #include "core/html/HTMLMediaSource.h" | 44 #include "core/html/HTMLMediaSource.h" |
| 45 #include "core/html/HTMLSourceElement.h" | 45 #include "core/html/HTMLSourceElement.h" |
| 46 #include "core/html/HTMLTrackElement.h" | 46 #include "core/html/HTMLTrackElement.h" |
| (...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 726 m_displayMode = Unknown; | 726 m_displayMode = Unknown; |
| 727 | 727 |
| 728 // 1 - Abort any already-running instance of the resource selection algorith
m for this element. | 728 // 1 - Abort any already-running instance of the resource selection algorith
m for this element. |
| 729 m_loadState = WaitingForSource; | 729 m_loadState = WaitingForSource; |
| 730 m_currentSourceNode = nullptr; | 730 m_currentSourceNode = nullptr; |
| 731 | 731 |
| 732 // 2 - If there are any tasks from the media element's media element event t
ask source in | 732 // 2 - If there are any tasks from the media element's media element event t
ask source in |
| 733 // one of the task queues, then remove those tasks. | 733 // one of the task queues, then remove those tasks. |
| 734 cancelPendingEventsAndCallbacks(); | 734 cancelPendingEventsAndCallbacks(); |
| 735 | 735 |
| 736 rejectPlayPromises(AbortError, "The play() request was interrupted by a new
load request."); |
| 737 |
| 736 // 3 - If the media element's networkState is set to NETWORK_LOADING or NETW
ORK_IDLE, queue | 738 // 3 - If the media element's networkState is set to NETWORK_LOADING or NETW
ORK_IDLE, queue |
| 737 // a task to fire a simple event named abort at the media element. | 739 // a task to fire a simple event named abort at the media element. |
| 738 if (m_networkState == NETWORK_LOADING || m_networkState == NETWORK_IDLE) | 740 if (m_networkState == NETWORK_LOADING || m_networkState == NETWORK_IDLE) |
| 739 scheduleEvent(EventTypeNames::abort); | 741 scheduleEvent(EventTypeNames::abort); |
| 740 | 742 |
| 741 resetMediaPlayerAndMediaSource(); | 743 resetMediaPlayerAndMediaSource(); |
| 742 | 744 |
| 743 // 4 - If the media element's networkState is not set to NETWORK_EMPTY, then
run these substeps | 745 // 4 - If the media element's networkState is not set to NETWORK_EMPTY, then
run these substeps |
| 744 if (m_networkState != NETWORK_EMPTY) { | 746 if (m_networkState != NETWORK_EMPTY) { |
| 745 // 4.1 - Queue a task to fire a simple event named emptied at the media
element. | 747 // 4.1 - Queue a task to fire a simple event named emptied at the media
element. |
| (...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1238 } | 1240 } |
| 1239 | 1241 |
| 1240 void HTMLMediaElement::noneSupported() | 1242 void HTMLMediaElement::noneSupported() |
| 1241 { | 1243 { |
| 1242 WTF_LOG(Media, "HTMLMediaElement::noneSupported(%p)", this); | 1244 WTF_LOG(Media, "HTMLMediaElement::noneSupported(%p)", this); |
| 1243 | 1245 |
| 1244 stopPeriodicTimers(); | 1246 stopPeriodicTimers(); |
| 1245 m_loadState = WaitingForSource; | 1247 m_loadState = WaitingForSource; |
| 1246 m_currentSourceNode = nullptr; | 1248 m_currentSourceNode = nullptr; |
| 1247 | 1249 |
| 1248 // 4.8.10.5 | 1250 // 4.8.13.5 |
| 1249 // 6 - Reaching this step indicates that the media resource failed to load o
r that the given | 1251 // The dedicated media source failure steps are the following steps: |
| 1250 // URL could not be resolved. In one atomic operation, run the following ste
ps: | |
| 1251 | 1252 |
| 1252 // 6.1 - Set the error attribute to a new MediaError object whose code attri
bute is set to | 1253 // 1 - Set the error attribute to a new MediaError object whose code attribu
te is set to |
| 1253 // MEDIA_ERR_SRC_NOT_SUPPORTED. | 1254 // MEDIA_ERR_SRC_NOT_SUPPORTED. |
| 1254 m_error = MediaError::create(MediaError::MEDIA_ERR_SRC_NOT_SUPPORTED); | 1255 m_error = MediaError::create(MediaError::MEDIA_ERR_SRC_NOT_SUPPORTED); |
| 1255 | 1256 |
| 1256 // 6.2 - Forget the media element's media-resource-specific text tracks. | 1257 // 2 - Forget the media element's media-resource-specific text tracks. |
| 1257 forgetResourceSpecificTracks(); | 1258 forgetResourceSpecificTracks(); |
| 1258 | 1259 |
| 1259 // 6.3 - Set the element's networkState attribute to the NETWORK_NO_SOURCE v
alue. | 1260 // 3 - Set the element's networkState attribute to the NETWORK_NO_SOURCE val
ue. |
| 1260 setNetworkState(NETWORK_NO_SOURCE); | 1261 setNetworkState(NETWORK_NO_SOURCE); |
| 1261 | 1262 |
| 1262 // 7 - Queue a task to fire a simple event named error at the media element. | 1263 // 4 - Set the element's show poster flag to true. |
| 1264 updateDisplayState(); |
| 1265 |
| 1266 // 5 - Fire a simple event named error at the media element. |
| 1263 scheduleEvent(EventTypeNames::error); | 1267 scheduleEvent(EventTypeNames::error); |
| 1264 | 1268 |
| 1269 // 6 - Reject pending play promises with NotSupportedError. |
| 1270 scheduleRejectPlayPromises(NotSupportedError, "Failed to load because no sup
ported source was found."); |
| 1271 |
| 1265 closeMediaSource(); | 1272 closeMediaSource(); |
| 1266 | 1273 |
| 1267 // 8 - Set the element's delaying-the-load-event flag to false. This stops d
elaying the load event. | 1274 // 7 - Set the element's delaying-the-load-event flag to false. This stops d
elaying the load event. |
| 1268 setShouldDelayLoadEvent(false); | 1275 setShouldDelayLoadEvent(false); |
| 1269 | 1276 |
| 1270 // 9 - Abort these steps. Until the load() method is invoked or the src attr
ibute is changed, | |
| 1271 // the element won't attempt to load another resource. | |
| 1272 | |
| 1273 updateDisplayState(); | |
| 1274 | |
| 1275 if (layoutObject()) | 1277 if (layoutObject()) |
| 1276 layoutObject()->updateFromElement(); | 1278 layoutObject()->updateFromElement(); |
| 1277 } | 1279 } |
| 1278 | 1280 |
| 1279 void HTMLMediaElement::mediaEngineError(MediaError* err) | 1281 void HTMLMediaElement::mediaEngineError(MediaError* err) |
| 1280 { | 1282 { |
| 1281 ASSERT(m_readyState >= HAVE_METADATA); | 1283 ASSERT(m_readyState >= HAVE_METADATA); |
| 1282 WTF_LOG(Media, "HTMLMediaElement::mediaEngineError(%p, %d)", this, static_ca
st<int>(err->code())); | 1284 WTF_LOG(Media, "HTMLMediaElement::mediaEngineError(%p, %d)", this, static_ca
st<int>(err->code())); |
| 1283 | 1285 |
| 1284 // 1 - The user agent should cancel the fetching process. | 1286 // 1 - The user agent should cancel the fetching process. |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1513 m_haveFiredLoadedData = true; | 1515 m_haveFiredLoadedData = true; |
| 1514 shouldUpdateDisplayState = true; | 1516 shouldUpdateDisplayState = true; |
| 1515 scheduleEvent(EventTypeNames::loadeddata); | 1517 scheduleEvent(EventTypeNames::loadeddata); |
| 1516 setShouldDelayLoadEvent(false); | 1518 setShouldDelayLoadEvent(false); |
| 1517 } | 1519 } |
| 1518 | 1520 |
| 1519 bool isPotentiallyPlaying = potentiallyPlaying(); | 1521 bool isPotentiallyPlaying = potentiallyPlaying(); |
| 1520 if (m_readyState == HAVE_FUTURE_DATA && oldState <= HAVE_CURRENT_DATA && tra
cksAreReady) { | 1522 if (m_readyState == HAVE_FUTURE_DATA && oldState <= HAVE_CURRENT_DATA && tra
cksAreReady) { |
| 1521 scheduleEvent(EventTypeNames::canplay); | 1523 scheduleEvent(EventTypeNames::canplay); |
| 1522 if (isPotentiallyPlaying) | 1524 if (isPotentiallyPlaying) |
| 1523 scheduleEvent(EventTypeNames::playing); | 1525 scheduleNotifyPlaying(); |
| 1524 shouldUpdateDisplayState = true; | 1526 shouldUpdateDisplayState = true; |
| 1525 } | 1527 } |
| 1526 | 1528 |
| 1527 if (m_readyState == HAVE_ENOUGH_DATA && oldState < HAVE_ENOUGH_DATA && track
sAreReady) { | 1529 if (m_readyState == HAVE_ENOUGH_DATA && oldState < HAVE_ENOUGH_DATA && track
sAreReady) { |
| 1528 if (oldState <= HAVE_CURRENT_DATA) { | 1530 if (oldState <= HAVE_CURRENT_DATA) { |
| 1529 scheduleEvent(EventTypeNames::canplay); | 1531 scheduleEvent(EventTypeNames::canplay); |
| 1530 if (isPotentiallyPlaying) | 1532 if (isPotentiallyPlaying) |
| 1531 scheduleEvent(EventTypeNames::playing); | 1533 scheduleNotifyPlaying(); |
| 1532 } | 1534 } |
| 1533 | 1535 |
| 1534 // Check for autoplay, and record metrics about it if needed. | 1536 // Check for autoplay, and record metrics about it if needed. |
| 1535 if (shouldAutoplay(RecordMetricsBehavior::DoRecord)) { | 1537 if (shouldAutoplay(RecordMetricsBehavior::DoRecord)) { |
| 1536 // If the autoplay experiment says that it's okay to play now, | 1538 // If the autoplay experiment says that it's okay to play now, |
| 1537 // then don't require a user gesture. | 1539 // then don't require a user gesture. |
| 1538 m_autoplayHelper.becameReadyToPlay(); | 1540 m_autoplayHelper.becameReadyToPlay(); |
| 1539 | 1541 |
| 1540 if (!m_userGestureRequiredForPlay) { | 1542 if (!m_userGestureRequiredForPlay) { |
| 1541 m_paused = false; | 1543 m_paused = false; |
| 1542 invalidateCachedTime(); | 1544 invalidateCachedTime(); |
| 1543 scheduleEvent(EventTypeNames::play); | 1545 scheduleEvent(EventTypeNames::play); |
| 1544 scheduleEvent(EventTypeNames::playing); | 1546 scheduleNotifyPlaying(); |
| 1545 m_autoplaying = false; | 1547 m_autoplaying = false; |
| 1546 } | 1548 } |
| 1547 } | 1549 } |
| 1548 | 1550 |
| 1549 scheduleEvent(EventTypeNames::canplaythrough); | 1551 scheduleEvent(EventTypeNames::canplaythrough); |
| 1550 | 1552 |
| 1551 shouldUpdateDisplayState = true; | 1553 shouldUpdateDisplayState = true; |
| 1552 } | 1554 } |
| 1553 | 1555 |
| 1554 if (shouldUpdateDisplayState) { | 1556 if (shouldUpdateDisplayState) { |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1926 // https://crbug.com/310450 | 1928 // https://crbug.com/310450 |
| 1927 UseCounter::count(document(), UseCounter::HTMLMediaElementPreloadDefault); | 1929 UseCounter::count(document(), UseCounter::HTMLMediaElementPreloadDefault); |
| 1928 return WebMediaPlayer::PreloadAuto; | 1930 return WebMediaPlayer::PreloadAuto; |
| 1929 } | 1931 } |
| 1930 | 1932 |
| 1931 WebMediaPlayer::Preload HTMLMediaElement::effectivePreloadType() const | 1933 WebMediaPlayer::Preload HTMLMediaElement::effectivePreloadType() const |
| 1932 { | 1934 { |
| 1933 return autoplay() ? WebMediaPlayer::PreloadAuto : preloadType(); | 1935 return autoplay() ? WebMediaPlayer::PreloadAuto : preloadType(); |
| 1934 } | 1936 } |
| 1935 | 1937 |
| 1936 void HTMLMediaElement::play() | 1938 ScriptPromise HTMLMediaElement::playForBindings(ScriptState* scriptState) |
| 1939 { |
| 1940 Nullable<ExceptionCode> code = play(); |
| 1941 if (!code.isNull()) { |
| 1942 String message; |
| 1943 switch (code.get()) { |
| 1944 case NotAllowedError: |
| 1945 message = "play() can only be initiated by a user gesture."; |
| 1946 break; |
| 1947 case NotSupportedError: |
| 1948 message = "The element has no supported sources."; |
| 1949 break; |
| 1950 default: |
| 1951 ASSERT_NOT_REACHED(); |
| 1952 } |
| 1953 return ScriptPromise::rejectWithDOMException(scriptState, DOMException::
create(code.get(), message)); |
| 1954 } |
| 1955 |
| 1956 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState)
; |
| 1957 ScriptPromise promise = resolver->promise(); |
| 1958 |
| 1959 m_playResolvers.append(resolver); |
| 1960 return promise; |
| 1961 } |
| 1962 |
| 1963 Nullable<ExceptionCode> HTMLMediaElement::play() |
| 1937 { | 1964 { |
| 1938 WTF_LOG(Media, "HTMLMediaElement::play(%p)", this); | 1965 WTF_LOG(Media, "HTMLMediaElement::play(%p)", this); |
| 1939 | 1966 |
| 1940 m_autoplayHelper.playMethodCalled(); | 1967 m_autoplayHelper.playMethodCalled(); |
| 1941 | 1968 |
| 1942 if (!UserGestureIndicator::processingUserGesture()) { | 1969 if (!UserGestureIndicator::processingUserGesture()) { |
| 1943 autoplayMediaEncountered(); | 1970 autoplayMediaEncountered(); |
| 1944 | 1971 |
| 1945 if (m_userGestureRequiredForPlay) { | 1972 if (m_userGestureRequiredForPlay) { |
| 1946 recordAutoplayMetric(PlayMethodFailed); | 1973 recordAutoplayMetric(PlayMethodFailed); |
| 1947 String message = ExceptionMessages::failedToExecute("play", "HTMLMed
iaElement", "API can only be initiated by a user gesture."); | 1974 String message = ExceptionMessages::failedToExecute("play", "HTMLMed
iaElement", "API can only be initiated by a user gesture."); |
| 1948 document().addConsoleMessage(ConsoleMessage::create(JSMessageSource,
WarningMessageLevel, message)); | 1975 document().addConsoleMessage(ConsoleMessage::create(JSMessageSource,
WarningMessageLevel, message)); |
| 1949 return; | 1976 return NotAllowedError; |
| 1950 } | 1977 } |
| 1951 } else if (m_userGestureRequiredForPlay) { | 1978 } else if (m_userGestureRequiredForPlay) { |
| 1952 if (m_autoplayMediaCounted) | 1979 if (m_autoplayMediaCounted) |
| 1953 recordAutoplayMetric(AutoplayManualStart); | 1980 recordAutoplayMetric(AutoplayManualStart); |
| 1954 m_userGestureRequiredForPlay = false; | 1981 m_userGestureRequiredForPlay = false; |
| 1955 } | 1982 } |
| 1956 | 1983 |
| 1984 if (m_error && m_error->code() == MediaError::MEDIA_ERR_SRC_NOT_SUPPORTED) |
| 1985 return NotSupportedError; |
| 1986 |
| 1957 playInternal(); | 1987 playInternal(); |
| 1988 |
| 1989 return nullptr; |
| 1958 } | 1990 } |
| 1959 | 1991 |
| 1960 void HTMLMediaElement::playInternal() | 1992 void HTMLMediaElement::playInternal() |
| 1961 { | 1993 { |
| 1962 WTF_LOG(Media, "HTMLMediaElement::playInternal(%p)", this); | 1994 WTF_LOG(Media, "HTMLMediaElement::playInternal(%p)", this); |
| 1963 | 1995 |
| 1964 // Always return the buffering strategy to normal when not paused, | 1996 // Always return the buffering strategy to normal when not paused, |
| 1965 // regardless of the cause. (In contrast with aggressive buffering which is | 1997 // regardless of the cause. (In contrast with aggressive buffering which is |
| 1966 // only enabled by pause(), not pauseInternal().) | 1998 // only enabled by pause(), not pauseInternal().) |
| 1967 if (webMediaPlayer()) | 1999 if (webMediaPlayer()) |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1978 seek(0); | 2010 seek(0); |
| 1979 | 2011 |
| 1980 if (m_paused) { | 2012 if (m_paused) { |
| 1981 m_paused = false; | 2013 m_paused = false; |
| 1982 invalidateCachedTime(); | 2014 invalidateCachedTime(); |
| 1983 scheduleEvent(EventTypeNames::play); | 2015 scheduleEvent(EventTypeNames::play); |
| 1984 | 2016 |
| 1985 if (m_readyState <= HAVE_CURRENT_DATA) | 2017 if (m_readyState <= HAVE_CURRENT_DATA) |
| 1986 scheduleEvent(EventTypeNames::waiting); | 2018 scheduleEvent(EventTypeNames::waiting); |
| 1987 else if (m_readyState >= HAVE_FUTURE_DATA) | 2019 else if (m_readyState >= HAVE_FUTURE_DATA) |
| 1988 scheduleEvent(EventTypeNames::playing); | 2020 scheduleNotifyPlaying(); |
| 2021 } else if (m_readyState >= HAVE_FUTURE_DATA) { |
| 2022 scheduleResolvePlayPromises(); |
| 1989 } | 2023 } |
| 2024 |
| 1990 m_autoplaying = false; | 2025 m_autoplaying = false; |
| 1991 | 2026 |
| 1992 updatePlayState(); | 2027 updatePlayState(); |
| 1993 } | 2028 } |
| 1994 | 2029 |
| 1995 void HTMLMediaElement::autoplayMediaEncountered() | 2030 void HTMLMediaElement::autoplayMediaEncountered() |
| 1996 { | 2031 { |
| 1997 if (!m_autoplayMediaCounted) { | 2032 if (!m_autoplayMediaCounted) { |
| 1998 m_autoplayMediaCounted = true; | 2033 m_autoplayMediaCounted = true; |
| 1999 recordAutoplayMetric(AutoplayMediaFound); | 2034 recordAutoplayMetric(AutoplayMediaFound); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2034 m_autoplayHelper.pauseMethodCalled(); | 2069 m_autoplayHelper.pauseMethodCalled(); |
| 2035 | 2070 |
| 2036 m_autoplaying = false; | 2071 m_autoplaying = false; |
| 2037 | 2072 |
| 2038 if (!m_paused) { | 2073 if (!m_paused) { |
| 2039 recordMetricsIfPausing(); | 2074 recordMetricsIfPausing(); |
| 2040 | 2075 |
| 2041 m_paused = true; | 2076 m_paused = true; |
| 2042 scheduleTimeupdateEvent(false); | 2077 scheduleTimeupdateEvent(false); |
| 2043 scheduleEvent(EventTypeNames::pause); | 2078 scheduleEvent(EventTypeNames::pause); |
| 2079 scheduleRejectPlayPromises(AbortError, "The play() request was interrupt
ed by a call to pause()."); |
| 2044 } | 2080 } |
| 2045 | 2081 |
| 2046 updatePlayState(); | 2082 updatePlayState(); |
| 2047 } | 2083 } |
| 2048 | 2084 |
| 2049 void HTMLMediaElement::requestRemotePlayback() | 2085 void HTMLMediaElement::requestRemotePlayback() |
| 2050 { | 2086 { |
| 2051 ASSERT(m_remoteRoutesAvailable); | 2087 ASSERT(m_remoteRoutesAvailable); |
| 2052 webMediaPlayer()->requestRemotePlayback(); | 2088 webMediaPlayer()->requestRemotePlayback(); |
| 2053 } | 2089 } |
| (...skipping 1430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3484 visitor->trace(m_asyncEventQueue); | 3520 visitor->trace(m_asyncEventQueue); |
| 3485 visitor->trace(m_error); | 3521 visitor->trace(m_error); |
| 3486 visitor->trace(m_currentSourceNode); | 3522 visitor->trace(m_currentSourceNode); |
| 3487 visitor->trace(m_nextChildNodeToConsider); | 3523 visitor->trace(m_nextChildNodeToConsider); |
| 3488 visitor->trace(m_mediaSource); | 3524 visitor->trace(m_mediaSource); |
| 3489 visitor->trace(m_audioTracks); | 3525 visitor->trace(m_audioTracks); |
| 3490 visitor->trace(m_videoTracks); | 3526 visitor->trace(m_videoTracks); |
| 3491 visitor->trace(m_cueTimeline); | 3527 visitor->trace(m_cueTimeline); |
| 3492 visitor->trace(m_textTracks); | 3528 visitor->trace(m_textTracks); |
| 3493 visitor->trace(m_textTracksWhenResourceSelectionBegan); | 3529 visitor->trace(m_textTracksWhenResourceSelectionBegan); |
| 3530 visitor->trace(m_playResolvers); |
| 3494 visitor->trace(m_audioSourceProvider); | 3531 visitor->trace(m_audioSourceProvider); |
| 3495 visitor->template registerWeakMembers<HTMLMediaElement, &HTMLMediaElement::c
learWeakMembers>(this); | 3532 visitor->template registerWeakMembers<HTMLMediaElement, &HTMLMediaElement::c
learWeakMembers>(this); |
| 3496 visitor->trace(m_autoplayHelper); | 3533 visitor->trace(m_autoplayHelper); |
| 3497 HeapSupplementable<HTMLMediaElement>::trace(visitor); | 3534 HeapSupplementable<HTMLMediaElement>::trace(visitor); |
| 3498 #endif | 3535 #endif |
| 3499 HTMLElement::trace(visitor); | 3536 HTMLElement::trace(visitor); |
| 3500 ActiveDOMObject::trace(visitor); | 3537 ActiveDOMObject::trace(visitor); |
| 3501 } | 3538 } |
| 3502 | 3539 |
| 3503 void HTMLMediaElement::createPlaceholderTracksIfNecessary() | 3540 void HTMLMediaElement::createPlaceholderTracksIfNecessary() |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3561 { | 3598 { |
| 3562 m_autoplayHelper.updatePositionNotificationRegistration(); | 3599 m_autoplayHelper.updatePositionNotificationRegistration(); |
| 3563 } | 3600 } |
| 3564 | 3601 |
| 3565 // TODO(liberato): remove once autoplay gesture override experiment concludes. | 3602 // TODO(liberato): remove once autoplay gesture override experiment concludes. |
| 3566 void HTMLMediaElement::triggerAutoplayViewportCheckForTesting() | 3603 void HTMLMediaElement::triggerAutoplayViewportCheckForTesting() |
| 3567 { | 3604 { |
| 3568 m_autoplayHelper.triggerAutoplayViewportCheckForTesting(); | 3605 m_autoplayHelper.triggerAutoplayViewportCheckForTesting(); |
| 3569 } | 3606 } |
| 3570 | 3607 |
| 3608 void HTMLMediaElement::scheduleResolvePlayPromises() |
| 3609 { |
| 3610 Platform::current()->currentThread()->taskRunner()->postTask( |
| 3611 BLINK_FROM_HERE, WTF::bind(&HTMLMediaElement::resolvePlayPromises, PassR
efPtrWillBeRawPtr<HTMLMediaElement>(this))); |
| 3612 } |
| 3613 |
| 3614 void HTMLMediaElement::scheduleRejectPlayPromises(ExceptionCode code, const Stri
ng& message) |
| 3615 { |
| 3616 Platform::current()->currentThread()->taskRunner()->postTask( |
| 3617 BLINK_FROM_HERE, WTF::bind(&HTMLMediaElement::rejectPlayPromises, PassRe
fPtrWillBeRawPtr<HTMLMediaElement>(this), code, message)); |
| 3618 } |
| 3619 |
| 3620 void HTMLMediaElement::scheduleNotifyPlaying() |
| 3621 { |
| 3622 scheduleEvent(EventTypeNames::playing); |
| 3623 scheduleResolvePlayPromises(); |
| 3624 } |
| 3625 |
| 3626 void HTMLMediaElement::resolvePlayPromises() |
| 3627 { |
| 3628 for (auto& resolver: m_playResolvers) |
| 3629 resolver->resolve(); |
| 3630 |
| 3631 m_playResolvers.clear(); |
| 3632 } |
| 3633 |
| 3634 void HTMLMediaElement::rejectPlayPromises(ExceptionCode code, const String& mess
age) |
| 3635 { |
| 3636 ASSERT(code == AbortError || code == NotSupportedError); |
| 3637 |
| 3638 for (auto& resolver: m_playResolvers) |
| 3639 resolver->reject(DOMException::create(code, message)); |
| 3640 |
| 3641 m_playResolvers.clear(); |
| 3642 } |
| 3643 |
| 3571 void HTMLMediaElement::clearWeakMembers(Visitor* visitor) | 3644 void HTMLMediaElement::clearWeakMembers(Visitor* visitor) |
| 3572 { | 3645 { |
| 3573 if (!Heap::isHeapObjectAlive(m_audioSourceNode)) | 3646 if (!Heap::isHeapObjectAlive(m_audioSourceNode)) |
| 3574 audioSourceProvider().setClient(nullptr); | 3647 audioSourceProvider().setClient(nullptr); |
| 3575 } | 3648 } |
| 3576 | 3649 |
| 3577 void HTMLMediaElement::AudioSourceProviderImpl::wrap(WebAudioSourceProvider* pro
vider) | 3650 void HTMLMediaElement::AudioSourceProviderImpl::wrap(WebAudioSourceProvider* pro
vider) |
| 3578 { | 3651 { |
| 3579 MutexLocker locker(provideInputLock); | 3652 MutexLocker locker(provideInputLock); |
| 3580 | 3653 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3628 { | 3701 { |
| 3629 visitor->trace(m_client); | 3702 visitor->trace(m_client); |
| 3630 } | 3703 } |
| 3631 | 3704 |
| 3632 DEFINE_TRACE(HTMLMediaElement::AudioSourceProviderImpl) | 3705 DEFINE_TRACE(HTMLMediaElement::AudioSourceProviderImpl) |
| 3633 { | 3706 { |
| 3634 visitor->trace(m_client); | 3707 visitor->trace(m_client); |
| 3635 } | 3708 } |
| 3636 | 3709 |
| 3637 } // namespace blink | 3710 } // namespace blink |
| OLD | NEW |