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

Unified Diff: third_party/WebKit/Source/modules/webaudio/AudioDestinationNode.cpp

Issue 2283053002: Fix BaseAudioContext::hasPendingActivity() to make it GCed correctly (Closed)
Patch Set: Created 4 years, 4 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: third_party/WebKit/Source/modules/webaudio/AudioDestinationNode.cpp
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioDestinationNode.cpp b/third_party/WebKit/Source/modules/webaudio/AudioDestinationNode.cpp
index f4a86ca65181ee9dc233c803168a815022438191..a02406807862e9e17b8bd26b83f85bb59a341156 100644
--- a/third_party/WebKit/Source/modules/webaudio/AudioDestinationNode.cpp
+++ b/third_party/WebKit/Source/modules/webaudio/AudioDestinationNode.cpp
@@ -35,6 +35,7 @@ namespace blink {
AudioDestinationHandler::AudioDestinationHandler(AudioNode& node, float sampleRate)
: AudioHandler(NodeTypeDestination, node, sampleRate)
, m_currentSampleFrame(0)
+ , m_numberOfConnections(0)
{
addInput();
}
@@ -103,6 +104,14 @@ void AudioDestinationHandler::render(AudioBus* sourceBus, AudioBus* destinationB
// Advance current sample-frame.
size_t newSampleFrame = m_currentSampleFrame + numberOfFrames;
releaseStore(&m_currentSampleFrame, newSampleFrame);
+
+ // Update connection status.
+ releaseStore(&m_numberOfConnections, input(0).numberOfRenderingConnections());
+}
+
+unsigned AudioDestinationHandler::numberOfConnections() const
+{
+ return acquireLoad(&m_numberOfConnections);
}
// ----------------------------------------------------------------
@@ -122,5 +131,10 @@ unsigned long AudioDestinationNode::maxChannelCount() const
return audioDestinationHandler().maxChannelCount();
}
+bool AudioDestinationNode::hasConnection() const
+{
+ return audioDestinationHandler().numberOfConnections() > 0;
+}
Raymond Toy 2016/08/26 20:12:15 Since AudioDestinationNode is an AudioNode with a
hongchan 2016/08/27 17:09:40 As we discussed offline, this structure is necessa
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698