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

Unified Diff: Source/modules/webaudio/AudioContext.cpp

Issue 773273002: Update the current frame count in a safe place (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years 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: Source/modules/webaudio/AudioContext.cpp
diff --git a/Source/modules/webaudio/AudioContext.cpp b/Source/modules/webaudio/AudioContext.cpp
index fde9cf2c51d36e4aea01626108c36d93ef42d011..81d06b4110e417210f3df9a393c6b9a2f833ec04 100644
--- a/Source/modules/webaudio/AudioContext.cpp
+++ b/Source/modules/webaudio/AudioContext.cpp
@@ -109,6 +109,7 @@ AudioContext::AudioContext(Document* document)
, m_audioThread(0)
, m_isOfflineContext(false)
, m_contextState(Suspended)
+ , m_shadowCurrentSampleFrame(0)
{
m_referencedNodes = new HeapVector<Member<AudioNode>>();
m_destinationNode = DefaultAudioDestinationNode::create(this);
@@ -132,6 +133,7 @@ AudioContext::AudioContext(Document* document, unsigned numberOfChannels, size_t
, m_audioThread(0)
, m_isOfflineContext(true)
, m_contextState(Suspended)
+ , m_shadowCurrentSampleFrame(0)
{
m_referencedNodes = new HeapVector<Member<AudioNode>>();
// Create a new destination for offline rendering.
@@ -553,6 +555,13 @@ PeriodicWave* AudioContext::createPeriodicWave(DOMFloat32Array* real, DOMFloat32
return PeriodicWave::create(sampleRate(), real, imag);
}
+size_t AudioContext::sampleFrame() const
+{
+ ASSERT(isMainThread());
+
+ return m_shadowCurrentSampleFrame;
+}
+
String AudioContext::state() const
{
// These strings had better match the strings for AudioContextState in AudioContext.idl.
@@ -765,6 +774,9 @@ void AudioContext::handlePreRenderTasks()
updateAutomaticPullNodes();
resolvePromisesForResume();
+ // Update the shadow frame value.
+ m_shadowCurrentSampleFrame = currentSampleFrame();
+
unlock();
}
}

Powered by Google App Engine
This is Rietveld 408576698