Chromium Code Reviews| 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; |
|
Ken Russell (switch to Gerrit)
2015/05/21 20:45:16
Is it safe to access the destination node's AudioD
Raymond Toy
2015/05/21 21:19:06
I believe this is safe. The purpose of the handler
tkent
2015/05/22 00:47:12
Yes, it's ok to touch handlers from the main threa
|
| + } |
| + |
| + 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. |