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

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: Modify test to allow 1 block delay. 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
« no previous file with comments | « Source/modules/webaudio/AudioContext.h ('k') | Source/modules/webaudio/ScriptProcessorNode.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/webaudio/AudioContext.cpp
diff --git a/Source/modules/webaudio/AudioContext.cpp b/Source/modules/webaudio/AudioContext.cpp
index 04079801a32b1177350d21c4e373f2f0953b48f3..8e158420c3968f859fb1c0f0f9f52045cba40eaf 100644
--- a/Source/modules/webaudio/AudioContext.cpp
+++ b/Source/modules/webaudio/AudioContext.cpp
@@ -110,6 +110,7 @@ AudioContext::AudioContext(Document* document)
, m_audioThread(0)
, m_isOfflineContext(false)
, m_contextState(Suspended)
+ , m_cachedSampleFrame(0)
{
m_didInitializeContextGraphMutex = true;
m_destinationNode = DefaultAudioDestinationNode::create(this);
@@ -134,6 +135,7 @@ AudioContext::AudioContext(Document* document, unsigned numberOfChannels, size_t
, m_audioThread(0)
, m_isOfflineContext(true)
, m_contextState(Suspended)
+ , m_cachedSampleFrame(0)
{
m_didInitializeContextGraphMutex = true;
// Create a new destination for offline rendering.
@@ -556,6 +558,13 @@ PeriodicWave* AudioContext::createPeriodicWave(DOMFloat32Array* real, DOMFloat32
return PeriodicWave::create(sampleRate(), real, imag);
}
+size_t AudioContext::cachedSampleFrame() const
+{
+ ASSERT(isMainThread());
+
+ return m_cachedSampleFrame;
+}
+
String AudioContext::state() const
{
// These strings had better match the strings for AudioContextState in AudioContext.idl.
@@ -768,6 +777,9 @@ void AudioContext::handlePreRenderTasks()
updateAutomaticPullNodes();
resolvePromisesForResume();
+ // Update the cached sample frame value.
+ m_cachedSampleFrame = currentSampleFrame();
+
unlock();
}
}
« no previous file with comments | « Source/modules/webaudio/AudioContext.h ('k') | Source/modules/webaudio/ScriptProcessorNode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698