Index: Source/core/html/HTMLMediaElement.cpp |
diff --git a/Source/core/html/HTMLMediaElement.cpp b/Source/core/html/HTMLMediaElement.cpp |
index 3b781bf062425814208b18e67bcd5c3da9712c68..b58d7e71d0d53929f002425986b430c05b97720d 100644 |
--- a/Source/core/html/HTMLMediaElement.cpp |
+++ b/Source/core/html/HTMLMediaElement.cpp |
@@ -284,7 +284,7 @@ HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, Document& docum |
, m_textTracks(nullptr) |
, m_ignoreTrackDisplayUpdate(0) |
#if ENABLE(WEB_AUDIO) |
- , m_audioSourceNode(0) |
+ , m_audioSourceNode(nullptr) |
#endif |
{ |
ASSERT(RuntimeEnabledFeatures::mediaEnabled()); |
@@ -372,7 +372,11 @@ HTMLMediaElement::~HTMLMediaElement() |
// crbug.com/378229 |
m_isFinalizing = true; |
#endif |
- clearMediaPlayerAndAudioSourceProviderClient(); |
+ |
+#if !ENABLE(OILPAN) |
+ ASSERT(!m_audioSourceNode); |
+#endif |
+ clearMediaPlayerAndAudioSourceProviderClientWithoutLocking(); |
acolwell GONE FROM CHROMIUM
2014/06/10 17:07:17
This makes me nervous. This is safe because we can
zerny-chromium
2014/06/10 19:42:29
Yes. The HTMLMediaElement can only die after the M
|
#if !ENABLE(OILPAN) |
document().decrementLoadEventDelayCount(); |
@@ -3119,17 +3123,23 @@ void HTMLMediaElement::userCancelledLoad() |
updateActiveTextTrackCues(0); |
} |
+void HTMLMediaElement::clearMediaPlayerAndAudioSourceProviderClientWithoutLocking() |
+{ |
+#if ENABLE(WEB_AUDIO) |
+ if (audioSourceProvider()) |
+ audioSourceProvider()->setClient(0); |
+#endif |
+ m_player.clear(); |
+} |
+ |
void HTMLMediaElement::clearMediaPlayerAndAudioSourceProviderClient() |
acolwell GONE FROM CHROMIUM
2014/06/10 17:07:17
nit: How about just moving the body of this functi
zerny-chromium
2014/06/10 19:42:29
Done.
|
{ |
#if ENABLE(WEB_AUDIO) |
if (m_audioSourceNode) |
m_audioSourceNode->lock(); |
- |
- if (audioSourceProvider()) |
- audioSourceProvider()->setClient(0); |
#endif |
- m_player.clear(); |
+ clearMediaPlayerAndAudioSourceProviderClientWithoutLocking(); |
#if ENABLE(WEB_AUDIO) |
if (m_audioSourceNode) |
@@ -3656,8 +3666,15 @@ void HTMLMediaElement::trace(Visitor* visitor) |
visitor->trace(m_nextChildNodeToConsider); |
visitor->trace(m_textTracks); |
visitor->trace(m_textTracksWhenResourceSelectionBegan); |
+ visitor->registerWeakMembers<HTMLMediaElement, &HTMLMediaElement::clearWeakMembers>(this); |
WillBeHeapSupplementable<HTMLMediaElement>::trace(visitor); |
HTMLElement::trace(visitor); |
} |
+void HTMLMediaElement::clearWeakMembers(Visitor* visitor) |
+{ |
+ if (!visitor->isAlive(m_audioSourceNode) && audioSourceProvider()) |
+ audioSourceProvider()->setClient(0); |
+} |
+ |
} |