Chromium Code Reviews| 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 736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 747 scheduleEvent(EventTypeNames::abort); | 747 scheduleEvent(EventTypeNames::abort); |
| 748 | 748 |
| 749 resetMediaPlayerAndMediaSource(); | 749 resetMediaPlayerAndMediaSource(); |
| 750 | 750 |
| 751 // 4 - If the media element's networkState is not set to NETWORK_EMPTY, then run these substeps | 751 // 4 - If the media element's networkState is not set to NETWORK_EMPTY, then run these substeps |
| 752 if (m_networkState != NETWORK_EMPTY) { | 752 if (m_networkState != NETWORK_EMPTY) { |
| 753 // 4.1 - Queue a task to fire a simple event named emptied at the media element. | 753 // 4.1 - Queue a task to fire a simple event named emptied at the media element. |
| 754 scheduleEvent(EventTypeNames::emptied); | 754 scheduleEvent(EventTypeNames::emptied); |
| 755 | 755 |
| 756 // 4.2 - If a fetching process is in progress for the media element, the user agent should stop it. | 756 // 4.2 - If a fetching process is in progress for the media element, the user agent should stop it. |
| 757 m_networkState = NETWORK_EMPTY; | 757 setNetworkState(NETWORK_EMPTY); |
| 758 | 758 |
| 759 // 4.3 - Forget the media element's media-resource-specific tracks. | 759 // 4.3 - Forget the media element's media-resource-specific tracks. |
| 760 forgetResourceSpecificTracks(); | 760 forgetResourceSpecificTracks(); |
| 761 | 761 |
| 762 // 4.4 - If readyState is not set to HAVE_NOTHING, then set it to that s tate. | 762 // 4.4 - If readyState is not set to HAVE_NOTHING, then set it to that s tate. |
| 763 m_readyState = HAVE_NOTHING; | 763 m_readyState = HAVE_NOTHING; |
| 764 m_readyStateMaximum = HAVE_NOTHING; | 764 m_readyStateMaximum = HAVE_NOTHING; |
| 765 | 765 |
| 766 // 4.5 - If the paused attribute is false, then set it to true. | 766 // 4.5 - If the paused attribute is false, then set it to true. |
| 767 m_paused = true; | 767 m_paused = true; |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 790 // 6 - Set the error attribute to null and the autoplaying flag to true. | 790 // 6 - Set the error attribute to null and the autoplaying flag to true. |
| 791 m_error = nullptr; | 791 m_error = nullptr; |
| 792 m_autoplaying = true; | 792 m_autoplaying = true; |
| 793 | 793 |
| 794 // 7 - Invoke the media element's resource selection algorithm. | 794 // 7 - Invoke the media element's resource selection algorithm. |
| 795 | 795 |
| 796 // 8 - Note: Playback of any previously playing media resource for this elem ent stops. | 796 // 8 - Note: Playback of any previously playing media resource for this elem ent stops. |
| 797 | 797 |
| 798 // The resource selection algorithm | 798 // The resource selection algorithm |
| 799 // 1 - Set the networkState to NETWORK_NO_SOURCE | 799 // 1 - Set the networkState to NETWORK_NO_SOURCE |
| 800 m_networkState = NETWORK_NO_SOURCE; | 800 setNetworkState(NETWORK_NO_SOURCE); |
| 801 | 801 |
| 802 // 2 - Asynchronously await a stable state. | 802 // 2 - Asynchronously await a stable state. |
| 803 | 803 |
| 804 m_playedTimeRanges = TimeRanges::create(); | 804 m_playedTimeRanges = TimeRanges::create(); |
| 805 | 805 |
| 806 // FIXME: Investigate whether these can be moved into m_networkState != NETW ORK_EMPTY block above | 806 // FIXME: Investigate whether these can be moved into m_networkState != NETW ORK_EMPTY block above |
| 807 // so they are closer to the relevant spec steps. | 807 // so they are closer to the relevant spec steps. |
| 808 m_lastSeekTime = 0; | 808 m_lastSeekTime = 0; |
| 809 m_duration = std::numeric_limits<double>::quiet_NaN(); | 809 m_duration = std::numeric_limits<double>::quiet_NaN(); |
| 810 | 810 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 847 if (HTMLSourceElement* element = Traversal<HTMLSourceElement>::firstChil d(*this)) { | 847 if (HTMLSourceElement* element = Traversal<HTMLSourceElement>::firstChil d(*this)) { |
| 848 mode = children; | 848 mode = children; |
| 849 m_nextChildNodeToConsider = element; | 849 m_nextChildNodeToConsider = element; |
| 850 m_currentSourceNode = nullptr; | 850 m_currentSourceNode = nullptr; |
| 851 } else { | 851 } else { |
| 852 // Otherwise the media element has neither a src attribute nor a sou rce element | 852 // Otherwise the media element has neither a src attribute nor a sou rce element |
| 853 // child: set the networkState to NETWORK_EMPTY, and abort these ste ps; the | 853 // child: set the networkState to NETWORK_EMPTY, and abort these ste ps; the |
| 854 // synchronous section ends. | 854 // synchronous section ends. |
| 855 m_loadState = WaitingForSource; | 855 m_loadState = WaitingForSource; |
| 856 setShouldDelayLoadEvent(false); | 856 setShouldDelayLoadEvent(false); |
| 857 m_networkState = NETWORK_EMPTY; | 857 setNetworkState(NETWORK_EMPTY); |
| 858 updateDisplayState(); | 858 updateDisplayState(); |
| 859 | 859 |
| 860 WTF_LOG(Media, "HTMLMediaElement::selectMediaResource(%p), nothing t o load", this); | 860 WTF_LOG(Media, "HTMLMediaElement::selectMediaResource(%p), nothing t o load", this); |
| 861 return; | 861 return; |
| 862 } | 862 } |
| 863 } | 863 } |
| 864 | 864 |
| 865 // 4 - Set the media element's delaying-the-load-event flag to true (this de lays the load event), | 865 // 4 - Set the media element's delaying-the-load-event flag to true (this de lays the load event), |
| 866 // and set its networkState to NETWORK_LOADING. | 866 // and set its networkState to NETWORK_LOADING. |
| 867 setShouldDelayLoadEvent(true); | 867 setShouldDelayLoadEvent(true); |
| 868 m_networkState = NETWORK_LOADING; | 868 setNetworkState(NETWORK_LOADING); |
| 869 | 869 |
| 870 // 5 - Queue a task to fire a simple event named loadstart at the media elem ent. | 870 // 5 - Queue a task to fire a simple event named loadstart at the media elem ent. |
| 871 scheduleEvent(EventTypeNames::loadstart); | 871 scheduleEvent(EventTypeNames::loadstart); |
| 872 | 872 |
| 873 // 6 - If mode is attribute, then run these substeps | 873 // 6 - If mode is attribute, then run these substeps |
| 874 if (mode == attribute) { | 874 if (mode == attribute) { |
| 875 m_loadState = LoadingFromSrcAttr; | 875 m_loadState = LoadingFromSrcAttr; |
| 876 | 876 |
| 877 // If the src attribute's value is the empty string ... jump down to the failed step below | 877 // If the src attribute's value is the empty string ... jump down to the failed step below |
| 878 KURL mediaURL = getNonEmptyURLAttribute(srcAttr); | 878 KURL mediaURL = getNonEmptyURLAttribute(srcAttr); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 924 | 924 |
| 925 WTF_LOG(Media, "HTMLMediaElement::loadResource(%p, %s, %s, %s)", this, urlFo rLoggingMedia(url).utf8().data(), contentType.raw().utf8().data(), keySystem.utf 8().data()); | 925 WTF_LOG(Media, "HTMLMediaElement::loadResource(%p, %s, %s, %s)", this, urlFo rLoggingMedia(url).utf8().data(), contentType.raw().utf8().data(), keySystem.utf 8().data()); |
| 926 | 926 |
| 927 LocalFrame* frame = document().frame(); | 927 LocalFrame* frame = document().frame(); |
| 928 if (!frame) { | 928 if (!frame) { |
| 929 mediaLoadingFailed(WebMediaPlayer::NetworkStateFormatError); | 929 mediaLoadingFailed(WebMediaPlayer::NetworkStateFormatError); |
| 930 return; | 930 return; |
| 931 } | 931 } |
| 932 | 932 |
| 933 // The resource fetch algorithm | 933 // The resource fetch algorithm |
| 934 m_networkState = NETWORK_LOADING; | 934 setNetworkState(NETWORK_LOADING); |
| 935 | 935 |
| 936 // Set m_currentSrc *before* changing to the cache url, the fact that we are loading from the app | 936 // Set m_currentSrc *before* changing to the cache url, the fact that we are loading from the app |
| 937 // cache is an internal detail not exposed through the media element API. | 937 // cache is an internal detail not exposed through the media element API. |
| 938 m_currentSrc = url; | 938 m_currentSrc = url; |
| 939 | 939 |
| 940 #if ENABLE(WEB_AUDIO) | 940 #if ENABLE(WEB_AUDIO) |
| 941 if (m_audioSourceNode) | 941 if (m_audioSourceNode) |
| 942 m_audioSourceNode->onCurrentSrcChanged(m_currentSrc); | 942 m_audioSourceNode->onCurrentSrcChanged(m_currentSrc); |
| 943 #endif | 943 #endif |
| 944 | 944 |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1096 | 1096 |
| 1097 // resource fetch algorithm step 3 - continued from deferLoad(). | 1097 // resource fetch algorithm step 3 - continued from deferLoad(). |
| 1098 | 1098 |
| 1099 // 5. Wait for an implementation-defined event (e.g. the user requesting tha t the media element begin playback). | 1099 // 5. Wait for an implementation-defined event (e.g. the user requesting tha t the media element begin playback). |
| 1100 // This is assumed to be whatever 'event' ended up calling this method. | 1100 // This is assumed to be whatever 'event' ended up calling this method. |
| 1101 cancelDeferredLoad(); | 1101 cancelDeferredLoad(); |
| 1102 // 6. Set the element's delaying-the-load-event flag back to true (this | 1102 // 6. Set the element's delaying-the-load-event flag back to true (this |
| 1103 // delays the load event again, in case it hasn't been fired yet). | 1103 // delays the load event again, in case it hasn't been fired yet). |
| 1104 setShouldDelayLoadEvent(true); | 1104 setShouldDelayLoadEvent(true); |
| 1105 // 7. Set the networkState to NETWORK_LOADING. | 1105 // 7. Set the networkState to NETWORK_LOADING. |
| 1106 m_networkState = NETWORK_LOADING; | 1106 setNetworkState(NETWORK_LOADING); |
| 1107 | 1107 |
| 1108 startProgressEventTimer(); | 1108 startProgressEventTimer(); |
| 1109 | 1109 |
| 1110 startPlayerLoad(); | 1110 startPlayerLoad(); |
| 1111 } | 1111 } |
| 1112 | 1112 |
| 1113 void HTMLMediaElement::startDeferredLoad() | 1113 void HTMLMediaElement::startDeferredLoad() |
| 1114 { | 1114 { |
| 1115 if (m_deferredLoadState == WaitingForTrigger) { | 1115 if (m_deferredLoadState == WaitingForTrigger) { |
| 1116 executeDeferredLoad(); | 1116 executeDeferredLoad(); |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1231 } | 1231 } |
| 1232 | 1232 |
| 1233 void HTMLMediaElement::waitForSourceChange() | 1233 void HTMLMediaElement::waitForSourceChange() |
| 1234 { | 1234 { |
| 1235 WTF_LOG(Media, "HTMLMediaElement::waitForSourceChange(%p)", this); | 1235 WTF_LOG(Media, "HTMLMediaElement::waitForSourceChange(%p)", this); |
| 1236 | 1236 |
| 1237 stopPeriodicTimers(); | 1237 stopPeriodicTimers(); |
| 1238 m_loadState = WaitingForSource; | 1238 m_loadState = WaitingForSource; |
| 1239 | 1239 |
| 1240 // 6.17 - Waiting: Set the element's networkState attribute to the NETWORK_N O_SOURCE value | 1240 // 6.17 - Waiting: Set the element's networkState attribute to the NETWORK_N O_SOURCE value |
| 1241 m_networkState = NETWORK_NO_SOURCE; | 1241 setNetworkState(NETWORK_NO_SOURCE); |
| 1242 | 1242 |
| 1243 // 6.18 - Set the element's delaying-the-load-event flag to false. This stop s delaying the load event. | 1243 // 6.18 - Set the element's delaying-the-load-event flag to false. This stop s delaying the load event. |
| 1244 setShouldDelayLoadEvent(false); | 1244 setShouldDelayLoadEvent(false); |
| 1245 | 1245 |
| 1246 updateDisplayState(); | 1246 updateDisplayState(); |
| 1247 | 1247 |
| 1248 if (layoutObject()) | 1248 if (layoutObject()) |
| 1249 layoutObject()->updateFromElement(); | 1249 layoutObject()->updateFromElement(); |
| 1250 } | 1250 } |
| 1251 | 1251 |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 1262 // URL could not be resolved. In one atomic operation, run the following ste ps: | 1262 // URL could not be resolved. In one atomic operation, run the following ste ps: |
| 1263 | 1263 |
| 1264 // 6.1 - Set the error attribute to a new MediaError object whose code attri bute is set to | 1264 // 6.1 - Set the error attribute to a new MediaError object whose code attri bute is set to |
| 1265 // MEDIA_ERR_SRC_NOT_SUPPORTED. | 1265 // MEDIA_ERR_SRC_NOT_SUPPORTED. |
| 1266 m_error = MediaError::create(MediaError::MEDIA_ERR_SRC_NOT_SUPPORTED); | 1266 m_error = MediaError::create(MediaError::MEDIA_ERR_SRC_NOT_SUPPORTED); |
| 1267 | 1267 |
| 1268 // 6.2 - Forget the media element's media-resource-specific text tracks. | 1268 // 6.2 - Forget the media element's media-resource-specific text tracks. |
| 1269 forgetResourceSpecificTracks(); | 1269 forgetResourceSpecificTracks(); |
| 1270 | 1270 |
| 1271 // 6.3 - Set the element's networkState attribute to the NETWORK_NO_SOURCE v alue. | 1271 // 6.3 - Set the element's networkState attribute to the NETWORK_NO_SOURCE v alue. |
| 1272 m_networkState = NETWORK_NO_SOURCE; | 1272 setNetworkState(NETWORK_NO_SOURCE); |
| 1273 | 1273 |
| 1274 // 7 - Queue a task to fire a simple event named error at the media element. | 1274 // 7 - Queue a task to fire a simple event named error at the media element. |
| 1275 scheduleEvent(EventTypeNames::error); | 1275 scheduleEvent(EventTypeNames::error); |
| 1276 | 1276 |
| 1277 closeMediaSource(); | 1277 closeMediaSource(); |
| 1278 | 1278 |
| 1279 // 8 - Set the element's delaying-the-load-event flag to false. This stops d elaying the load event. | 1279 // 8 - Set the element's delaying-the-load-event flag to false. This stops d elaying the load event. |
| 1280 setShouldDelayLoadEvent(false); | 1280 setShouldDelayLoadEvent(false); |
| 1281 | 1281 |
| 1282 // 9 - Abort these steps. Until the load() method is invoked or the src attr ibute is changed, | 1282 // 9 - Abort these steps. Until the load() method is invoked or the src attr ibute is changed, |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 1298 m_loadState = WaitingForSource; | 1298 m_loadState = WaitingForSource; |
| 1299 | 1299 |
| 1300 // 2 - Set the error attribute to a new MediaError object whose code attribu te is | 1300 // 2 - Set the error attribute to a new MediaError object whose code attribu te is |
| 1301 // set to MEDIA_ERR_NETWORK/MEDIA_ERR_DECODE. | 1301 // set to MEDIA_ERR_NETWORK/MEDIA_ERR_DECODE. |
| 1302 m_error = err; | 1302 m_error = err; |
| 1303 | 1303 |
| 1304 // 3 - Queue a task to fire a simple event named error at the media element. | 1304 // 3 - Queue a task to fire a simple event named error at the media element. |
| 1305 scheduleEvent(EventTypeNames::error); | 1305 scheduleEvent(EventTypeNames::error); |
| 1306 | 1306 |
| 1307 // 4 - Set the element's networkState attribute to the NETWORK_IDLE value. | 1307 // 4 - Set the element's networkState attribute to the NETWORK_IDLE value. |
| 1308 m_networkState = NETWORK_IDLE; | 1308 setNetworkState(NETWORK_IDLE); |
| 1309 | 1309 |
| 1310 // 5 - Set the element's delaying-the-load-event flag to false. This stops d elaying the load event. | 1310 // 5 - Set the element's delaying-the-load-event flag to false. This stops d elaying the load event. |
| 1311 setShouldDelayLoadEvent(false); | 1311 setShouldDelayLoadEvent(false); |
| 1312 | 1312 |
| 1313 // 6 - Abort the overall resource selection algorithm. | 1313 // 6 - Abort the overall resource selection algorithm. |
| 1314 m_currentSourceNode = nullptr; | 1314 m_currentSourceNode = nullptr; |
| 1315 } | 1315 } |
| 1316 | 1316 |
| 1317 void HTMLMediaElement::cancelPendingEventsAndCallbacks() | 1317 void HTMLMediaElement::cancelPendingEventsAndCallbacks() |
| 1318 { | 1318 { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1372 if (mediaControls()) | 1372 if (mediaControls()) |
| 1373 mediaControls()->reset(); | 1373 mediaControls()->reset(); |
| 1374 } | 1374 } |
| 1375 | 1375 |
| 1376 void HTMLMediaElement::setNetworkState(WebMediaPlayer::NetworkState state) | 1376 void HTMLMediaElement::setNetworkState(WebMediaPlayer::NetworkState state) |
| 1377 { | 1377 { |
| 1378 WTF_LOG(Media, "HTMLMediaElement::setNetworkState(%p, %d) - current state is %d", this, static_cast<int>(state), static_cast<int>(m_networkState)); | 1378 WTF_LOG(Media, "HTMLMediaElement::setNetworkState(%p, %d) - current state is %d", this, static_cast<int>(state), static_cast<int>(m_networkState)); |
| 1379 | 1379 |
| 1380 if (state == WebMediaPlayer::NetworkStateEmpty) { | 1380 if (state == WebMediaPlayer::NetworkStateEmpty) { |
| 1381 // Just update the cached state and leave, we can't do anything. | 1381 // Just update the cached state and leave, we can't do anything. |
| 1382 m_networkState = NETWORK_EMPTY; | 1382 setNetworkState(NETWORK_EMPTY); |
| 1383 return; | 1383 return; |
| 1384 } | 1384 } |
| 1385 | 1385 |
| 1386 if (state == WebMediaPlayer::NetworkStateFormatError | 1386 if (state == WebMediaPlayer::NetworkStateFormatError |
| 1387 || state == WebMediaPlayer::NetworkStateNetworkError | 1387 || state == WebMediaPlayer::NetworkStateNetworkError |
| 1388 || state == WebMediaPlayer::NetworkStateDecodeError) { | 1388 || state == WebMediaPlayer::NetworkStateDecodeError) { |
| 1389 mediaLoadingFailed(state); | 1389 mediaLoadingFailed(state); |
| 1390 return; | 1390 return; |
| 1391 } | 1391 } |
| 1392 | 1392 |
| 1393 if (state == WebMediaPlayer::NetworkStateIdle) { | 1393 if (state == WebMediaPlayer::NetworkStateIdle) { |
| 1394 if (m_networkState > NETWORK_IDLE) { | 1394 if (m_networkState > NETWORK_IDLE) { |
| 1395 changeNetworkStateFromLoadingToIdle(); | 1395 changeNetworkStateFromLoadingToIdle(); |
| 1396 setShouldDelayLoadEvent(false); | 1396 setShouldDelayLoadEvent(false); |
| 1397 } else { | 1397 } else { |
| 1398 m_networkState = NETWORK_IDLE; | 1398 setNetworkState(NETWORK_IDLE); |
| 1399 } | 1399 } |
| 1400 } | 1400 } |
| 1401 | 1401 |
| 1402 if (state == WebMediaPlayer::NetworkStateLoading) { | 1402 if (state == WebMediaPlayer::NetworkStateLoading) { |
| 1403 if (m_networkState < NETWORK_LOADING || m_networkState == NETWORK_NO_SOU RCE) | 1403 if (m_networkState < NETWORK_LOADING || m_networkState == NETWORK_NO_SOU RCE) |
| 1404 startProgressEventTimer(); | 1404 startProgressEventTimer(); |
| 1405 m_networkState = NETWORK_LOADING; | 1405 setNetworkState(NETWORK_LOADING); |
| 1406 m_completelyLoaded = false; | 1406 m_completelyLoaded = false; |
| 1407 } | 1407 } |
| 1408 | 1408 |
| 1409 if (state == WebMediaPlayer::NetworkStateLoaded) { | 1409 if (state == WebMediaPlayer::NetworkStateLoaded) { |
| 1410 if (m_networkState != NETWORK_IDLE) | 1410 if (m_networkState != NETWORK_IDLE) |
| 1411 changeNetworkStateFromLoadingToIdle(); | 1411 changeNetworkStateFromLoadingToIdle(); |
| 1412 m_completelyLoaded = true; | 1412 m_completelyLoaded = true; |
| 1413 } | 1413 } |
| 1414 } | 1414 } |
| 1415 | 1415 |
| 1416 void HTMLMediaElement::changeNetworkStateFromLoadingToIdle() | 1416 void HTMLMediaElement::changeNetworkStateFromLoadingToIdle() |
| 1417 { | 1417 { |
| 1418 m_progressEventTimer.stop(); | 1418 m_progressEventTimer.stop(); |
| 1419 | 1419 |
| 1420 // Schedule one last progress event so we guarantee that at least one is fir ed | 1420 // Schedule one last progress event so we guarantee that at least one is fir ed |
| 1421 // for files that load very quickly. | 1421 // for files that load very quickly. |
| 1422 if (webMediaPlayer() && webMediaPlayer()->didLoadingProgress()) | 1422 if (webMediaPlayer() && webMediaPlayer()->didLoadingProgress()) |
| 1423 scheduleEvent(EventTypeNames::progress); | 1423 scheduleEvent(EventTypeNames::progress); |
| 1424 scheduleEvent(EventTypeNames::suspend); | 1424 scheduleEvent(EventTypeNames::suspend); |
| 1425 m_networkState = NETWORK_IDLE; | 1425 setNetworkState(NETWORK_IDLE); |
| 1426 } | 1426 } |
| 1427 | 1427 |
| 1428 void HTMLMediaElement::readyStateChanged() | 1428 void HTMLMediaElement::readyStateChanged() |
| 1429 { | 1429 { |
| 1430 setReadyState(static_cast<ReadyState>(webMediaPlayer()->readyState())); | 1430 setReadyState(static_cast<ReadyState>(webMediaPlayer()->readyState())); |
| 1431 } | 1431 } |
| 1432 | 1432 |
| 1433 void HTMLMediaElement::setReadyState(ReadyState state) | 1433 void HTMLMediaElement::setReadyState(ReadyState state) |
| 1434 { | 1434 { |
| 1435 WTF_LOG(Media, "HTMLMediaElement::setReadyState(%p, %d) - current state is % d,", this, static_cast<int>(state), static_cast<int>(m_readyState)); | 1435 WTF_LOG(Media, "HTMLMediaElement::setReadyState(%p, %d) - current state is % d,", this, static_cast<int>(state), static_cast<int>(m_readyState)); |
| (...skipping 1216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2652 return; | 2652 return; |
| 2653 | 2653 |
| 2654 // 4.8.9.5, resource selection algorithm, source elements section: | 2654 // 4.8.9.5, resource selection algorithm, source elements section: |
| 2655 // 21. Wait until the node after pointer is a node other than the end of the list. (This step might wait forever.) | 2655 // 21. Wait until the node after pointer is a node other than the end of the list. (This step might wait forever.) |
| 2656 // 22. Asynchronously await a stable state... | 2656 // 22. Asynchronously await a stable state... |
| 2657 // 23. Set the element's delaying-the-load-event flag back to true (this del ays the load event again, in case | 2657 // 23. Set the element's delaying-the-load-event flag back to true (this del ays the load event again, in case |
| 2658 // it hasn't been fired yet). | 2658 // it hasn't been fired yet). |
| 2659 setShouldDelayLoadEvent(true); | 2659 setShouldDelayLoadEvent(true); |
| 2660 | 2660 |
| 2661 // 24. Set the networkState back to NETWORK_LOADING. | 2661 // 24. Set the networkState back to NETWORK_LOADING. |
| 2662 m_networkState = NETWORK_LOADING; | 2662 setNetworkState(NETWORK_LOADING); |
| 2663 | 2663 |
| 2664 // 25. Jump back to the find next candidate step above. | 2664 // 25. Jump back to the find next candidate step above. |
| 2665 m_nextChildNodeToConsider = source; | 2665 m_nextChildNodeToConsider = source; |
| 2666 scheduleNextSourceChild(); | 2666 scheduleNextSourceChild(); |
| 2667 } | 2667 } |
| 2668 | 2668 |
| 2669 void HTMLMediaElement::sourceWasRemoved(HTMLSourceElement* source) | 2669 void HTMLMediaElement::sourceWasRemoved(HTMLSourceElement* source) |
| 2670 { | 2670 { |
| 2671 WTF_LOG(Media, "HTMLMediaElement::sourceWasRemoved(%p, %p)", this, source); | 2671 WTF_LOG(Media, "HTMLMediaElement::sourceWasRemoved(%p, %p)", this, source); |
| 2672 | 2672 |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2996 m_error = MediaError::create(MediaError::MEDIA_ERR_ABORTED); | 2996 m_error = MediaError::create(MediaError::MEDIA_ERR_ABORTED); |
| 2997 | 2997 |
| 2998 // 3 - Queue a task to fire a simple event named error at the media element. | 2998 // 3 - Queue a task to fire a simple event named error at the media element. |
| 2999 scheduleEvent(EventTypeNames::abort); | 2999 scheduleEvent(EventTypeNames::abort); |
| 3000 | 3000 |
| 3001 // 4 - If the media element's readyState attribute has a value equal to HAVE _NOTHING, set the | 3001 // 4 - If the media element's readyState attribute has a value equal to HAVE _NOTHING, set the |
| 3002 // element's networkState attribute to the NETWORK_EMPTY value and queue a t ask to fire a | 3002 // element's networkState attribute to the NETWORK_EMPTY value and queue a t ask to fire a |
| 3003 // simple event named emptied at the element. Otherwise, set the element's n etworkState | 3003 // simple event named emptied at the element. Otherwise, set the element's n etworkState |
| 3004 // attribute to the NETWORK_IDLE value. | 3004 // attribute to the NETWORK_IDLE value. |
| 3005 if (readyState == HAVE_NOTHING) { | 3005 if (readyState == HAVE_NOTHING) { |
| 3006 m_networkState = NETWORK_EMPTY; | 3006 setNetworkState(NETWORK_EMPTY); |
| 3007 scheduleEvent(EventTypeNames::emptied); | 3007 scheduleEvent(EventTypeNames::emptied); |
| 3008 } else { | 3008 } else { |
| 3009 m_networkState = NETWORK_IDLE; | 3009 setNetworkState(NETWORK_IDLE); |
| 3010 } | 3010 } |
| 3011 | 3011 |
| 3012 // 5 - Set the element's delaying-the-load-event flag to false. This stops d elaying the load event. | 3012 // 5 - Set the element's delaying-the-load-event flag to false. This stops d elaying the load event. |
| 3013 setShouldDelayLoadEvent(false); | 3013 setShouldDelayLoadEvent(false); |
| 3014 | 3014 |
| 3015 // 6 - Abort the overall resource selection algorithm. | 3015 // 6 - Abort the overall resource selection algorithm. |
| 3016 m_currentSourceNode = nullptr; | 3016 m_currentSourceNode = nullptr; |
| 3017 | 3017 |
| 3018 invalidateCachedTime(); | 3018 invalidateCachedTime(); |
| 3019 cueTimeline().updateActiveCues(0); | 3019 cueTimeline().updateActiveCues(0); |
| (...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3576 void HTMLMediaElement::removeUserGestureRequirement() | 3576 void HTMLMediaElement::removeUserGestureRequirement() |
| 3577 { | 3577 { |
| 3578 m_userGestureRequiredForPlay = false; | 3578 m_userGestureRequiredForPlay = false; |
| 3579 } | 3579 } |
| 3580 | 3580 |
| 3581 void HTMLMediaElement::setInitialPlayWithoutUserGestures(bool value) | 3581 void HTMLMediaElement::setInitialPlayWithoutUserGestures(bool value) |
| 3582 { | 3582 { |
| 3583 m_initialPlayWithoutUserGesture = value; | 3583 m_initialPlayWithoutUserGesture = value; |
| 3584 } | 3584 } |
| 3585 | 3585 |
| 3586 void HTMLMediaElement::setNetworkState(NetworkState state) | |
| 3587 { | |
| 3588 m_networkState = state; | |
| 3589 if (MediaControls* controls = mediaControls()) | |
|
philipj_slow
2015/10/28 15:14:02
I haven't investigated, but I wouldn't be too surp
liberato (no reviews please)
2015/10/29 16:10:26
Done.
| |
| 3590 controls->networkStateChanged(); | |
| 3591 } | |
| 3592 | |
| 3586 #if ENABLE(WEB_AUDIO) | 3593 #if ENABLE(WEB_AUDIO) |
| 3587 void HTMLMediaElement::clearWeakMembers(Visitor* visitor) | 3594 void HTMLMediaElement::clearWeakMembers(Visitor* visitor) |
| 3588 { | 3595 { |
| 3589 if (!Heap::isHeapObjectAlive(m_audioSourceNode)) | 3596 if (!Heap::isHeapObjectAlive(m_audioSourceNode)) |
| 3590 audioSourceProvider().setClient(nullptr); | 3597 audioSourceProvider().setClient(nullptr); |
| 3591 } | 3598 } |
| 3592 | 3599 |
| 3593 void HTMLMediaElement::AudioSourceProviderImpl::wrap(WebAudioSourceProvider* pro vider) | 3600 void HTMLMediaElement::AudioSourceProviderImpl::wrap(WebAudioSourceProvider* pro vider) |
| 3594 { | 3601 { |
| 3595 MutexLocker locker(provideInputLock); | 3602 MutexLocker locker(provideInputLock); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3645 visitor->trace(m_client); | 3652 visitor->trace(m_client); |
| 3646 } | 3653 } |
| 3647 | 3654 |
| 3648 DEFINE_TRACE(HTMLMediaElement::AudioSourceProviderImpl) | 3655 DEFINE_TRACE(HTMLMediaElement::AudioSourceProviderImpl) |
| 3649 { | 3656 { |
| 3650 visitor->trace(m_client); | 3657 visitor->trace(m_client); |
| 3651 } | 3658 } |
| 3652 #endif | 3659 #endif |
| 3653 | 3660 |
| 3654 } | 3661 } |
| OLD | NEW |