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 874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
885 } | 885 } |
886 } | 886 } |
887 } | 887 } |
888 | 888 |
889 if (attemptLoad && canLoadURL(url, contentType, keySystem)) { | 889 if (attemptLoad && canLoadURL(url, contentType, keySystem)) { |
890 ASSERT(!webMediaPlayer()); | 890 ASSERT(!webMediaPlayer()); |
891 | 891 |
892 if (!m_havePreparedToPlay && !autoplay() && m_preload == MediaPlayer::No ne) { | 892 if (!m_havePreparedToPlay && !autoplay() && m_preload == MediaPlayer::No ne) { |
893 WTF_LOG(Media, "HTMLMediaElement::loadResource : Delaying load becau se preload == 'none'"); | 893 WTF_LOG(Media, "HTMLMediaElement::loadResource : Delaying load becau se preload == 'none'"); |
894 m_delayingLoadForPreloadNone = true; | 894 m_delayingLoadForPreloadNone = true; |
895 // This implements the "optional" step 3 from the resource fetch alg orithm. | |
896 // 1. Set the networkState to NETWORK_IDLE. | |
897 // 2. Queue a task to fire a simple event named suspend at the eleme nt. | |
898 changeNetworkStateFromLoadingToIdle(); | |
fs
2014/06/09 16:12:23
This means that we'll also fire a progress event -
acolwell GONE FROM CHROMIUM
2014/06/09 17:54:17
I think we should avoid firing the progress event
fs
2014/06/10 12:36:24
Added gating of 'progress' dispatch on m_player->d
| |
899 // 3. Queue a task to set the element's delaying-the-load-event | |
900 // flag to false. This stops delaying the load event. | |
901 // 4. Wait for the task to be run. | |
fs
2014/06/09 16:12:23
Neither queuing a nor waiting for a task here, whi
acolwell GONE FROM CHROMIUM
2014/06/09 17:54:17
Why don't you just add a timer here to actually im
fs
2014/06/10 12:36:24
Done (PS3). But to facilitate the wait in step 4 s
| |
902 setShouldDelayLoadEvent(false); | |
903 // Continued in startDelayedLoad(). | |
895 } else { | 904 } else { |
896 startPlayerLoad(); | 905 startPlayerLoad(); |
897 } | 906 } |
898 } else { | 907 } else { |
899 mediaLoadingFailed(MediaPlayer::FormatError); | 908 mediaLoadingFailed(MediaPlayer::FormatError); |
900 } | 909 } |
901 | 910 |
902 // If there is no poster to display, allow the media engine to render video frames as soon as | 911 // If there is no poster to display, allow the media engine to render video frames as soon as |
903 // they are available. | 912 // they are available. |
904 updateDisplayState(); | 913 updateDisplayState(); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
936 m_player->setPreload(m_preload); | 945 m_player->setPreload(m_preload); |
937 | 946 |
938 if (m_delayingLoadForPreloadNone && m_preload != MediaPlayer::None) | 947 if (m_delayingLoadForPreloadNone && m_preload != MediaPlayer::None) |
939 startDelayedLoad(); | 948 startDelayedLoad(); |
940 } | 949 } |
941 | 950 |
942 void HTMLMediaElement::startDelayedLoad() | 951 void HTMLMediaElement::startDelayedLoad() |
943 { | 952 { |
944 ASSERT(m_delayingLoadForPreloadNone); | 953 ASSERT(m_delayingLoadForPreloadNone); |
945 | 954 |
955 // resource fetch algorithm step 3 - continued from loadResource(). | |
956 | |
957 // 5. Wait for an implementation-defined event (e.g. the user requesting tha t the media element begin playback). | |
958 // This is assumed to be whatever 'event' ended up calling this method. | |
946 m_delayingLoadForPreloadNone = false; | 959 m_delayingLoadForPreloadNone = false; |
960 // 6. Set the element's delaying-the-load-event flag back to true (this | |
961 // delays the load event again, in case it hasn't been fired yet). | |
962 setShouldDelayLoadEvent(true); | |
963 // 7. Set the networkState to NETWORK_LOADING. | |
964 m_networkState = NETWORK_LOADING; | |
965 | |
966 startProgressEventTimer(); | |
947 | 967 |
948 startPlayerLoad(); | 968 startPlayerLoad(); |
949 } | 969 } |
950 | 970 |
951 WebMediaPlayer::LoadType HTMLMediaElement::loadType() const | 971 WebMediaPlayer::LoadType HTMLMediaElement::loadType() const |
952 { | 972 { |
953 if (m_mediaSource) | 973 if (m_mediaSource) |
954 return WebMediaPlayer::LoadTypeMediaSource; | 974 return WebMediaPlayer::LoadTypeMediaSource; |
955 | 975 |
956 if (isMediaStreamURL(m_currentSrc.string())) | 976 if (isMediaStreamURL(m_currentSrc.string())) |
(...skipping 2697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3654 visitor->trace(m_error); | 3674 visitor->trace(m_error); |
3655 visitor->trace(m_currentSourceNode); | 3675 visitor->trace(m_currentSourceNode); |
3656 visitor->trace(m_nextChildNodeToConsider); | 3676 visitor->trace(m_nextChildNodeToConsider); |
3657 visitor->trace(m_textTracks); | 3677 visitor->trace(m_textTracks); |
3658 visitor->trace(m_textTracksWhenResourceSelectionBegan); | 3678 visitor->trace(m_textTracksWhenResourceSelectionBegan); |
3659 WillBeHeapSupplementable<HTMLMediaElement>::trace(visitor); | 3679 WillBeHeapSupplementable<HTMLMediaElement>::trace(visitor); |
3660 HTMLElement::trace(visitor); | 3680 HTMLElement::trace(visitor); |
3661 } | 3681 } |
3662 | 3682 |
3663 } | 3683 } |
OLD | NEW |