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

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: weak member 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 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);
+}
+
}
« 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