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

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

Issue 208493002: Remove {,un}setPendingActivity from AudioContext. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fix Created 6 years, 9 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 | « Source/modules/webaudio/AudioContext.h ('k') | no next file » | 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 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);
« no previous file with comments | « Source/modules/webaudio/AudioContext.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698