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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLMediaElement.cpp

Issue 1406183003: Reset readystates when webmediaplayer is cleared (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 unified diff | Download patch
OLDNEW
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 3026 matching lines...) Expand 10 before | Expand all | Expand 10 after
3037 3037
3038 void HTMLMediaElement::userCancelledLoad() 3038 void HTMLMediaElement::userCancelledLoad()
3039 { 3039 {
3040 WTF_LOG(Media, "HTMLMediaElement::userCancelledLoad(%p)", this); 3040 WTF_LOG(Media, "HTMLMediaElement::userCancelledLoad(%p)", this);
3041 3041
3042 // If the media data fetching process is aborted by the user: 3042 // If the media data fetching process is aborted by the user:
3043 3043
3044 // 1 - The user agent should cancel the fetching process. 3044 // 1 - The user agent should cancel the fetching process.
3045 clearMediaPlayer(-1); 3045 clearMediaPlayer(-1);
3046 3046
3047 if (m_networkState == NETWORK_EMPTY || m_completelyLoaded || m_isFinalizing) 3047 if (m_networkState == NETWORK_EMPTY || m_completelyLoaded || m_isFinalizing) {
3048 m_readyState = HAVE_NOTHING;
philipj_slow 2015/10/20 11:24:53 Shouldn't the readyState be reset unconditionally?
Srirama 2015/10/20 11:31:34 I thought about that, but it will affect step4 in
philipj_slow 2015/10/20 11:52:00 Oh, that's annoying. I think the problem here is t
3049 m_readyStateMaximum = HAVE_NOTHING;
3048 return; 3050 return;
3051 }
3049 3052
3050 // 2 - Set the error attribute to a new MediaError object whose code attribu te is set to MEDIA_ERR_ABORTED. 3053 // 2 - Set the error attribute to a new MediaError object whose code attribu te is set to MEDIA_ERR_ABORTED.
3051 m_error = MediaError::create(MediaError::MEDIA_ERR_ABORTED); 3054 m_error = MediaError::create(MediaError::MEDIA_ERR_ABORTED);
3052 3055
3053 // 3 - Queue a task to fire a simple event named error at the media element. 3056 // 3 - Queue a task to fire a simple event named error at the media element.
3054 scheduleEvent(EventTypeNames::abort); 3057 scheduleEvent(EventTypeNames::abort);
3055 3058
3056 // 4 - If the media element's readyState attribute has a value equal to HAVE _NOTHING, set the 3059 // 4 - If the media element's readyState attribute has a value equal to HAVE _NOTHING, set the
3057 // element's networkState attribute to the NETWORK_EMPTY value and queue a t ask to fire a 3060 // element's networkState attribute to the NETWORK_EMPTY value and queue a t ask to fire a
3058 // simple event named emptied at the element. Otherwise, set the element's n etworkState 3061 // simple event named emptied at the element. Otherwise, set the element's n etworkState
3059 // attribute to the NETWORK_IDLE value. 3062 // attribute to the NETWORK_IDLE value.
3060 if (m_readyState == HAVE_NOTHING) { 3063 if (m_readyState == HAVE_NOTHING) {
3061 m_networkState = NETWORK_EMPTY; 3064 m_networkState = NETWORK_EMPTY;
3062 scheduleEvent(EventTypeNames::emptied); 3065 scheduleEvent(EventTypeNames::emptied);
3063 } else { 3066 } else {
3064 m_networkState = NETWORK_IDLE; 3067 m_networkState = NETWORK_IDLE;
3065 } 3068 }
3066 3069
3067 // 5 - Set the element's delaying-the-load-event flag to false. This stops d elaying the load event. 3070 // 5 - Set the element's delaying-the-load-event flag to false. This stops d elaying the load event.
3068 setShouldDelayLoadEvent(false); 3071 setShouldDelayLoadEvent(false);
3069 3072
3070 // 6 - Abort the overall resource selection algorithm. 3073 // 6 - Abort the overall resource selection algorithm.
3071 m_currentSourceNode = nullptr; 3074 m_currentSourceNode = nullptr;
3072 3075
3073 // Reset m_readyState since m_webMediaPlayer is gone. 3076 // Reset m_readyState since m_webMediaPlayer is gone.
3074 m_readyState = HAVE_NOTHING; 3077 m_readyState = HAVE_NOTHING;
3078 m_readyStateMaximum = HAVE_NOTHING;
3075 invalidateCachedTime(); 3079 invalidateCachedTime();
3076 updateMediaController(); 3080 updateMediaController();
3077 cueTimeline().updateActiveCues(0); 3081 cueTimeline().updateActiveCues(0);
3078 } 3082 }
3079 3083
3080 void HTMLMediaElement::clearMediaPlayerAndAudioSourceProviderClientWithoutLockin g() 3084 void HTMLMediaElement::clearMediaPlayerAndAudioSourceProviderClientWithoutLockin g()
3081 { 3085 {
3082 #if ENABLE(WEB_AUDIO) 3086 #if ENABLE(WEB_AUDIO)
3083 audioSourceProvider().setClient(nullptr); 3087 audioSourceProvider().setClient(nullptr);
3084 #endif 3088 #endif
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after
3814 visitor->trace(m_client); 3818 visitor->trace(m_client);
3815 } 3819 }
3816 3820
3817 DEFINE_TRACE(HTMLMediaElement::AudioSourceProviderImpl) 3821 DEFINE_TRACE(HTMLMediaElement::AudioSourceProviderImpl)
3818 { 3822 {
3819 visitor->trace(m_client); 3823 visitor->trace(m_client);
3820 } 3824 }
3821 #endif 3825 #endif
3822 3826
3823 } 3827 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698