Index: Source/modules/webaudio/AudioContext.cpp |
diff --git a/Source/modules/webaudio/AudioContext.cpp b/Source/modules/webaudio/AudioContext.cpp |
index 1fa9d78d1487be98833b4ca9eed55da21e13c2ac..e56fd31859923874d0c0011c5ad39600ecbc019a 100644 |
--- a/Source/modules/webaudio/AudioContext.cpp |
+++ b/Source/modules/webaudio/AudioContext.cpp |
@@ -114,6 +114,7 @@ PassRefPtr<AudioContext> AudioContext::create(Document& document, unsigned numbe |
AudioContext::AudioContext(Document* document) |
: ActiveDOMObject(document) |
, m_isStopScheduled(false) |
+ , m_isCleared(false) |
, m_isInitialized(false) |
, m_isAudioThreadFinished(false) |
, m_destinationNode(nullptr) |
@@ -134,6 +135,7 @@ AudioContext::AudioContext(Document* document) |
AudioContext::AudioContext(Document* document, unsigned numberOfChannels, size_t numberOfFrames, float sampleRate) |
: ActiveDOMObject(document) |
, m_isStopScheduled(false) |
+ , m_isCleared(false) |
, m_isInitialized(false) |
, m_isAudioThreadFinished(false) |
, m_destinationNode(nullptr) |
@@ -155,9 +157,6 @@ AudioContext::AudioContext(Document* document, unsigned numberOfChannels, size_t |
void AudioContext::constructCommon() |
{ |
ScriptWrappable::init(this); |
- // According to spec AudioContext must die only after page navigate. |
- // Lets mark it as ActiveDOMObject with pending activity and unmark it in clear method. |
- setPendingActivity(this); |
FFTFrame::initialize(); |
@@ -171,7 +170,6 @@ AudioContext::~AudioContext() |
#endif |
// AudioNodes keep a reference to their context, so there should be no way to be in the destructor if there are still AudioNodes around. |
ASSERT(!m_isInitialized); |
- ASSERT(m_isStopScheduled); |
ASSERT(!m_nodesToDelete.size()); |
ASSERT(!m_referencedNodes.size()); |
ASSERT(!m_finishedNodes.size()); |
@@ -218,8 +216,7 @@ void AudioContext::clear() |
m_nodesMarkedForDeletion.clear(); |
} while (m_nodesToDelete.size()); |
- // It was set in constructCommon. |
- unsetPendingActivity(this); |
+ m_isCleared = true; |
} |
void AudioContext::uninitialize() |
@@ -276,6 +273,12 @@ void AudioContext::stop() |
callOnMainThread(stopDispatch, this); |
} |
+bool AudioContext::hasPendingActivity() const |
+{ |
+ // According to spec AudioContext must die only after page navigates. |
+ return !m_isCleared; |
+} |
+ |
PassRefPtr<AudioBuffer> AudioContext::createBuffer(unsigned numberOfChannels, size_t numberOfFrames, float sampleRate, ExceptionState& exceptionState) |
{ |
RefPtr<AudioBuffer> audioBuffer = AudioBuffer::create(numberOfChannels, numberOfFrames, sampleRate); |