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

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

Issue 552303006: Prevent more script-observable cases of HTMLMediaElement GC (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: cleanup 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
Index: Source/core/html/HTMLMediaElement.cpp
diff --git a/Source/core/html/HTMLMediaElement.cpp b/Source/core/html/HTMLMediaElement.cpp
index a709141682132ddc3829fd251ecc4500baed28bc..ca1b4f06ccd03b8f77fe2b9a4e4f603d4710818a 100644
--- a/Source/core/html/HTMLMediaElement.cpp
+++ b/Source/core/html/HTMLMediaElement.cpp
@@ -381,27 +381,14 @@ HTMLMediaElement::~HTMLMediaElement()
{
WTF_LOG(Media, "HTMLMediaElement::~HTMLMediaElement(%p)", this);
-#if ENABLE(OILPAN)
- // If the HTMLMediaElement dies with the document we are not
- // allowed to touch the document to adjust delay load event counts
- // because the document could have been already
- // destructed. However, if the HTMLMediaElement dies with the
- // document there is no need to change the delayed load counts
- // because no load event will fire anyway. If the document is
- // still alive we do have to decrement the load delay counts. We
- // determine if the document is alive via the ActiveDOMObject
- // which is a context lifecycle observer. If the Document has been
- // destructed ActiveDOMObject::executionContext() returns 0.
- if (ActiveDOMObject::executionContext())
- setShouldDelayLoadEvent(false);
-#else
+ ASSERT(!m_shouldDelayLoadEvent);
+
+#if !ENABLE(OILPAN)
// HTMLMediaElement and m_asyncEventQueue always become unreachable
// together. So HTMLMediaElemenet and m_asyncEventQueue are destructed in
// the same GC. We don't need to close it explicitly in Oilpan.
m_asyncEventQueue->close();
- setShouldDelayLoadEvent(false);
-
if (m_textTracks)
m_textTracks->clearOwner();
m_audioTracks->shutdown();
@@ -3468,7 +3455,28 @@ void HTMLMediaElement::stop()
bool HTMLMediaElement::hasPendingActivity() const
scherkus (not reviewing) 2014/09/12 19:05:00 nice!
{
- return (hasAudio() && isPlaying()) || m_asyncEventQueue->hasPendingEvents();
+ if (!document().isActive())
+ return false;
+
+ if (m_shouldDelayLoadEvent)
+ return true;
+
+ if (m_networkState == NETWORK_LOADING)
+ return true;
+
+ if (potentiallyPlaying())
+ return true;
+
+ if (m_seeking)
+ return true;
+
+ if (m_asyncEventQueue->hasPendingEvents())
+ return true;
+
+ if (m_mediaSource)
+ return true;
+
+ return false;
}
void HTMLMediaElement::contextDestroyed()
« LayoutTests/media/gc-while-seeking.html ('K') | « LayoutTests/media/track/track-remove-track.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698