Index: third_party/WebKit/Source/core/html/HTMLMediaElement.cpp |
diff --git a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp |
index 3bae974c27f776b7d77c0d3f2de88d5fd937df28..b4c1f13459b79f44117ce9ef7bc3bbc1a4732d22 100644 |
--- a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp |
+++ b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp |
@@ -384,13 +384,6 @@ HTMLMediaElement::~HTMLMediaElement() |
removeElementFromDocumentMap(this, &document()); |
// Destroying the player may cause a resource load to be canceled, |
- // which could result in userCancelledLoad() being called back. |
- // Setting m_isFinalizing ensures that such a call will not cause |
- // us to dispatch an abort event, which would result in a crash. |
- // See http://crbug.com/233654 for more details. |
- m_isFinalizing = true; |
- |
- // Destroying the player may cause a resource load to be canceled, |
// which could result in Document::dispatchWindowLoadEvent() being |
// called via ResourceFetch::didLoadResource() then |
// FrameLoader::checkCompleted(). To prevent load event dispatching during |
@@ -477,7 +470,8 @@ void HTMLMediaElement::didMoveToNewDocument(Document& oldDocument) |
// previous document. A proper fix would provide a mechanism to allow this |
// object to refresh the MediaPlayer's LocalFrame and FrameLoader references on |
// document changes so that playback can be resumed properly. |
- userCancelledLoad(); |
+ clearMediaPlayer(LoadMediaResource); |
philipj_slow
2015/12/02 14:02:14
Perhaps document that this restarts the load, as i
Srirama
2015/12/02 14:39:18
Done.
|
+ scheduleDelayedAction(LoadMediaResource); |
// Decrement the load event delay count on oldDocument now that m_webMediaPlayer has been destroyed |
// and there is no risk of dispatching a load event from within the destructor. |
@@ -2975,50 +2969,6 @@ void HTMLMediaElement::stopPeriodicTimers() |
m_playbackProgressTimer.stop(); |
} |
-void HTMLMediaElement::userCancelledLoad() |
-{ |
- WTF_LOG(Media, "HTMLMediaElement::userCancelledLoad(%p)", this); |
- |
- // If the media data fetching process is aborted by the user: |
- |
- // 1 - The user agent should cancel the fetching process. |
- clearMediaPlayer(-1); |
- // Reset m_readyState and m_readyStateMaximum since m_webMediaPlayer is gone. |
- ReadyState readyState = m_readyState; |
- m_readyState = HAVE_NOTHING; |
- m_readyStateMaximum = HAVE_NOTHING; |
- |
- // TODO(srirama.m): Investigate if this condition can be dropped entirely without any issues. |
- if (m_networkState == NETWORK_EMPTY || m_completelyLoaded || m_isFinalizing) |
- return; |
- |
- // 2 - Set the error attribute to a new MediaError object whose code attribute is set to MEDIA_ERR_ABORTED. |
- m_error = MediaError::create(MediaError::MEDIA_ERR_ABORTED); |
- |
- // 3 - Queue a task to fire a simple event named error at the media element. |
- scheduleEvent(EventTypeNames::abort); |
- |
- // 4 - If the media element's readyState attribute has a value equal to HAVE_NOTHING, set the |
- // element's networkState attribute to the NETWORK_EMPTY value and queue a task to fire a |
- // simple event named emptied at the element. Otherwise, set the element's networkState |
- // attribute to the NETWORK_IDLE value. |
- if (readyState == HAVE_NOTHING) { |
- setNetworkState(NETWORK_EMPTY); |
- scheduleEvent(EventTypeNames::emptied); |
- } else { |
- setNetworkState(NETWORK_IDLE); |
- } |
- |
- // 5 - Set the element's delaying-the-load-event flag to false. This stops delaying the load event. |
- setShouldDelayLoadEvent(false); |
- |
- // 6 - Abort the overall resource selection algorithm. |
- m_currentSourceNode = nullptr; |
- |
- invalidateCachedTime(); |
- cueTimeline().updateActiveCues(0); |
-} |
- |
void HTMLMediaElement::clearMediaPlayerAndAudioSourceProviderClientWithoutLocking() |
{ |
#if ENABLE(WEB_AUDIO) |
@@ -3067,13 +3017,14 @@ void HTMLMediaElement::stop() |
recordMetricsIfPausing(); |
- // Close the async event queue so that no events are enqueued by userCancelledLoad. |
+ // Close the async event queue so that no events are enqueued. |
cancelPendingEventsAndCallbacks(); |
m_asyncEventQueue->close(); |
- userCancelledLoad(); |
- |
// Stop the playback without generating events |
+ clearMediaPlayer(-1); |
+ setNetworkState(NETWORK_EMPTY); |
philipj_slow
2015/12/02 14:02:14
Better also clear m_readyState and m_readyStateMax
Srirama
2015/12/02 14:39:18
Done.
|
+ setShouldDelayLoadEvent(false); |
m_playing = false; |
m_paused = true; |
m_seeking = false; |