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

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

Issue 1149913002: Access current frame counter carefully and remove m_cachedSampleFrame. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove workaround in scriptprocessornode test Created 5 years, 7 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 | « LayoutTests/webaudio/scriptprocessornode.html ('k') | Source/modules/webaudio/AudioContext.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/webaudio/AudioContext.h
diff --git a/Source/modules/webaudio/AudioContext.h b/Source/modules/webaudio/AudioContext.h
index 9ea7dd20da78526b65d5dd0672f0bbab69918f50..bfb33051c35606bc57ea36da3a23eabdf796e336 100644
--- a/Source/modules/webaudio/AudioContext.h
+++ b/Source/modules/webaudio/AudioContext.h
@@ -108,12 +108,15 @@ public:
AudioDestinationNode* destination() { return m_destinationNode.get(); }
- // currentSampleFrame() and currentTime() can be called from both the main
- // thread and the audio thread. Note that, however, they return the cached
- // value instead of actual current ones when they are accessed from the main
- // thread. See: crbug.com/431874
- size_t currentSampleFrame() const;
- double currentTime() const;
+ size_t currentSampleFrame() const
+ {
+ return m_destinationNode ? m_destinationNode->audioDestinationHandler().currentSampleFrame() : 0;
+ }
+
+ double currentTime() const
+ {
+ return m_destinationNode ? m_destinationNode->audioDestinationHandler().currentTime() : 0;
+ }
float sampleRate() const { return m_destinationNode ? m_destinationNode->handler().sampleRate() : 0; }
@@ -311,9 +314,6 @@ private:
// The Promise that is returned by close();
RefPtrWillBeMember<ScriptPromiseResolver> m_closeResolver;
- // Follows the destination's currentSampleFrame, but might be slightly behind due to locking.
- size_t m_cachedSampleFrame;
-
// Tries to handle AudioBufferSourceNodes that were started but became disconnected or was never
// connected. Because these never get pulled anymore, they will stay around forever. So if we
// can, try to stop them so they can be collected.
« no previous file with comments | « LayoutTests/webaudio/scriptprocessornode.html ('k') | Source/modules/webaudio/AudioContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698