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

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: assert only for oilpan 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/track/track-remove-track.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 a709141682132ddc3829fd251ecc4500baed28bc..5d8bdfb0ddaa645c120f81e14aca23b09bcdba21 100644
--- a/Source/core/html/HTMLMediaElement.cpp
+++ b/Source/core/html/HTMLMediaElement.cpp
@@ -382,18 +382,7 @@ HTMLMediaElement::~HTMLMediaElement()
WTF_LOG(Media, "HTMLMediaElement::~HTMLMediaElement(%p)", this);
#if ENABLE(OILPAN)
- // If the HTMLMediaElement dies with the document we are not
Mads Ager (chromium) 2014/09/15 07:01:18 From an Oilpan perspective it is really nice to ge
philipj_slow 2014/09/15 13:07:44 No, loading can start without a wrapper, all you n
- // 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);
+ ASSERT(!m_shouldDelayLoadEvent);
#else
// HTMLMediaElement and m_asyncEventQueue always become unreachable
// together. So HTMLMediaElemenet and m_asyncEventQueue are destructed in
@@ -3468,7 +3457,28 @@ void HTMLMediaElement::stop()
bool HTMLMediaElement::hasPendingActivity() const
{
- 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()
« no previous file with comments | « 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