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

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

Issue 587683002: Ensure that hasPendingActivity() is false for stopped media elements (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 3 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
« no previous file with comments | « LayoutTests/media/gc-pending-event-inactive-document.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLMediaElement.cpp
diff --git a/Source/core/html/HTMLMediaElement.cpp b/Source/core/html/HTMLMediaElement.cpp
index c84422593dd2d0288b17efe586c84891b6d990ee..b0c66c595aee4c68773af6c5ec4e52d032aa7635 100644
--- a/Source/core/html/HTMLMediaElement.cpp
+++ b/Source/core/html/HTMLMediaElement.cpp
@@ -3516,6 +3516,8 @@ void HTMLMediaElement::stop()
// Stop the playback without generating events
m_playing = false;
+ m_paused = true;
+ m_seeking = false;
setPausedInternal(true);
if (renderer())
@@ -3525,14 +3527,14 @@ void HTMLMediaElement::stop()
cancelPendingEventsAndCallbacks();
m_asyncEventQueue->close();
+
+ // Ensure that hasPendingActivity() is not preventing garbage collection, since otherwise this
+ // media element will simply leak.
+ ASSERT(!hasPendingActivity());
}
bool HTMLMediaElement::hasPendingActivity() const
{
- // After the document becomes inactive, no events can ever be fired.
- if (!document().isActive())
- return false;
-
// The delaying-the-load-event flag is set by resource selection algorithm when looking for a
// resource to load, before networkState has reached to NETWORK_LOADING.
if (m_shouldDelayLoadEvent)
« no previous file with comments | « LayoutTests/media/gc-pending-event-inactive-document.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698