Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1056)

Unified Diff: Source/core/html/HTMLMediaElement.cpp

Issue 327553002: Transition networkState back to NETWORK_IDLE on fetch if preload=none (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/html/HTMLMediaElement.cpp
diff --git a/Source/core/html/HTMLMediaElement.cpp b/Source/core/html/HTMLMediaElement.cpp
index 3b781bf062425814208b18e67bcd5c3da9712c68..881e47b1ef83bd78bad759eb8ac16f115749044a 100644
--- a/Source/core/html/HTMLMediaElement.cpp
+++ b/Source/core/html/HTMLMediaElement.cpp
@@ -892,6 +892,15 @@ void HTMLMediaElement::loadResource(const KURL& url, ContentType& contentType, c
if (!m_havePreparedToPlay && !autoplay() && m_preload == MediaPlayer::None) {
WTF_LOG(Media, "HTMLMediaElement::loadResource : Delaying load because preload == 'none'");
m_delayingLoadForPreloadNone = true;
+ // This implements the "optional" step 3 from the resource fetch algorithm.
+ // 1. Set the networkState to NETWORK_IDLE.
+ // 2. Queue a task to fire a simple event named suspend at the element.
+ 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
+ // 3. Queue a task to set the element's delaying-the-load-event
+ // flag to false. This stops delaying the load event.
+ // 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
+ setShouldDelayLoadEvent(false);
+ // Continued in startDelayedLoad().
} else {
startPlayerLoad();
}
@@ -943,7 +952,18 @@ void HTMLMediaElement::startDelayedLoad()
{
ASSERT(m_delayingLoadForPreloadNone);
+ // resource fetch algorithm step 3 - continued from loadResource().
+
+ // 5. Wait for an implementation-defined event (e.g. the user requesting that the media element begin playback).
+ // This is assumed to be whatever 'event' ended up calling this method.
m_delayingLoadForPreloadNone = false;
+ // 6. Set the element's delaying-the-load-event flag back to true (this
+ // delays the load event again, in case it hasn't been fired yet).
+ setShouldDelayLoadEvent(true);
+ // 7. Set the networkState to NETWORK_LOADING.
+ m_networkState = NETWORK_LOADING;
+
+ startProgressEventTimer();
startPlayerLoad();
}

Powered by Google App Engine
This is Rietveld 408576698