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

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: update as per review 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
« no previous file with comments | « third_party/WebKit/LayoutTests/media/video-move-to-new-document-crash.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 3025 matching lines...) Expand 10 before | Expand all | Expand 10 after
3036 } 3036 }
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 // Reset m_readyState and m_readyStateMaximum since m_webMediaPlayer is gone .
3047 ReadyState readyState = m_readyState;
3048 m_readyState = HAVE_NOTHING;
3049 m_readyStateMaximum = HAVE_NOTHING;
3046 3050
3051 // TODO(srirama.m): Investigate if this condition can be dropped entirely wi thout any issues.
3047 if (m_networkState == NETWORK_EMPTY || m_completelyLoaded || m_isFinalizing) 3052 if (m_networkState == NETWORK_EMPTY || m_completelyLoaded || m_isFinalizing)
3048 return; 3053 return;
3049 3054
3050 // 2 - Set the error attribute to a new MediaError object whose code attribu te is set to MEDIA_ERR_ABORTED. 3055 // 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); 3056 m_error = MediaError::create(MediaError::MEDIA_ERR_ABORTED);
3052 3057
3053 // 3 - Queue a task to fire a simple event named error at the media element. 3058 // 3 - Queue a task to fire a simple event named error at the media element.
3054 scheduleEvent(EventTypeNames::abort); 3059 scheduleEvent(EventTypeNames::abort);
3055 3060
3056 // 4 - If the media element's readyState attribute has a value equal to HAVE _NOTHING, set the 3061 // 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 3062 // 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 3063 // simple event named emptied at the element. Otherwise, set the element's n etworkState
3059 // attribute to the NETWORK_IDLE value. 3064 // attribute to the NETWORK_IDLE value.
3060 if (m_readyState == HAVE_NOTHING) { 3065 if (readyState == HAVE_NOTHING) {
3061 m_networkState = NETWORK_EMPTY; 3066 m_networkState = NETWORK_EMPTY;
3062 scheduleEvent(EventTypeNames::emptied); 3067 scheduleEvent(EventTypeNames::emptied);
3063 } else { 3068 } else {
3064 m_networkState = NETWORK_IDLE; 3069 m_networkState = NETWORK_IDLE;
3065 } 3070 }
3066 3071
3067 // 5 - Set the element's delaying-the-load-event flag to false. This stops d elaying the load event. 3072 // 5 - Set the element's delaying-the-load-event flag to false. This stops d elaying the load event.
3068 setShouldDelayLoadEvent(false); 3073 setShouldDelayLoadEvent(false);
3069 3074
3070 // 6 - Abort the overall resource selection algorithm. 3075 // 6 - Abort the overall resource selection algorithm.
3071 m_currentSourceNode = nullptr; 3076 m_currentSourceNode = nullptr;
3072 3077
3073 // Reset m_readyState since m_webMediaPlayer is gone.
3074 m_readyState = HAVE_NOTHING;
3075 invalidateCachedTime(); 3078 invalidateCachedTime();
3076 updateMediaController(); 3079 updateMediaController();
3077 cueTimeline().updateActiveCues(0); 3080 cueTimeline().updateActiveCues(0);
3078 } 3081 }
3079 3082
3080 void HTMLMediaElement::clearMediaPlayerAndAudioSourceProviderClientWithoutLockin g() 3083 void HTMLMediaElement::clearMediaPlayerAndAudioSourceProviderClientWithoutLockin g()
3081 { 3084 {
3082 #if ENABLE(WEB_AUDIO) 3085 #if ENABLE(WEB_AUDIO)
3083 audioSourceProvider().setClient(nullptr); 3086 audioSourceProvider().setClient(nullptr);
3084 #endif 3087 #endif
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after
3814 visitor->trace(m_client); 3817 visitor->trace(m_client);
3815 } 3818 }
3816 3819
3817 DEFINE_TRACE(HTMLMediaElement::AudioSourceProviderImpl) 3820 DEFINE_TRACE(HTMLMediaElement::AudioSourceProviderImpl)
3818 { 3821 {
3819 visitor->trace(m_client); 3822 visitor->trace(m_client);
3820 } 3823 }
3821 #endif 3824 #endif
3822 3825
3823 } 3826 }
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/media/video-move-to-new-document-crash.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698