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

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

Issue 294053006: Oilpan: Use transition types for HTMLMediaElement and make AudioSourceProviderClient a GC mixin. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: removed build fix Created 6 years, 6 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 | « Source/core/html/HTMLMediaElement.h ('k') | Source/modules/webaudio/MediaElementAudioSourceNode.h » ('j') | 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 af3e44e4494d0448e89dc1b8aefb4295c0965312..385f7ee088b0d2f72e17a66f06fe6ff430d477e0 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,13 @@ HTMLMediaElement::~HTMLMediaElement()
// crbug.com/378229
m_isFinalizing = true;
#endif
- clearMediaPlayerAndAudioSourceProviderClient();
+
+ // The m_audioSourceNode is either dead already or it is dying together with
+ // this HTMLMediaElement which it strongly keeps alive.
+#if !ENABLE(OILPAN)
+ ASSERT(!m_audioSourceNode);
+#endif
+ clearMediaPlayerAndAudioSourceProviderClientWithoutLocking();
#if !ENABLE(OILPAN)
document().decrementLoadEventDelayCount();
@@ -3119,22 +3125,13 @@ void HTMLMediaElement::userCancelledLoad()
updateActiveTextTrackCues(0);
}
-void HTMLMediaElement::clearMediaPlayerAndAudioSourceProviderClient()
+void HTMLMediaElement::clearMediaPlayerAndAudioSourceProviderClientWithoutLocking()
{
#if ENABLE(WEB_AUDIO)
- if (m_audioSourceNode)
- m_audioSourceNode->lock();
-
if (audioSourceProvider())
audioSourceProvider()->setClient(0);
#endif
-
m_player.clear();
-
-#if ENABLE(WEB_AUDIO)
- if (m_audioSourceNode)
- m_audioSourceNode->unlock();
-#endif
}
void HTMLMediaElement::clearMediaPlayer(int flags)
@@ -3145,7 +3142,17 @@ void HTMLMediaElement::clearMediaPlayer(int flags)
m_delayingLoadForPreloadNone = false;
- clearMediaPlayerAndAudioSourceProviderClient();
+#if ENABLE(WEB_AUDIO)
+ if (m_audioSourceNode)
+ m_audioSourceNode->lock();
+#endif
+
+ clearMediaPlayerAndAudioSourceProviderClientWithoutLocking();
+
+#if ENABLE(WEB_AUDIO)
+ if (m_audioSourceNode)
+ m_audioSourceNode->unlock();
+#endif
stopPeriodicTimers();
m_loadTimer.stop();
@@ -3657,8 +3664,19 @@ void HTMLMediaElement::trace(Visitor* visitor)
visitor->trace(m_textTracks);
visitor->trace(m_textTracksWhenResourceSelectionBegan);
visitor->trace(m_mediaController);
+#if ENABLE(WEB_AUDIO)
+ visitor->registerWeakMembers<HTMLMediaElement, &HTMLMediaElement::clearWeakMembers>(this);
+#endif
WillBeHeapSupplementable<HTMLMediaElement>::trace(visitor);
HTMLElement::trace(visitor);
}
+#if ENABLE(WEB_AUDIO)
+void HTMLMediaElement::clearWeakMembers(Visitor* visitor)
+{
+ if (!visitor->isAlive(m_audioSourceNode) && audioSourceProvider())
+ audioSourceProvider()->setClient(0);
+}
+#endif
+
}
« no previous file with comments | « Source/core/html/HTMLMediaElement.h ('k') | Source/modules/webaudio/MediaElementAudioSourceNode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698