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

Unified Diff: third_party/WebKit/Source/modules/webaudio/AbstractAudioContext.cpp

Issue 1405413004: Implement suspend() and resume() for OfflineAudioContext (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updating UseCounter.h after L-G-T-M Created 5 years, 1 month 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
Index: third_party/WebKit/Source/modules/webaudio/AbstractAudioContext.cpp
diff --git a/third_party/WebKit/Source/modules/webaudio/AbstractAudioContext.cpp b/third_party/WebKit/Source/modules/webaudio/AbstractAudioContext.cpp
index fbf90f8e91b377b04d600dd0541c95c3d1b0a99a..9b627c3fd9f540e636430a9b9931115bafceecf0 100644
--- a/third_party/WebKit/Source/modules/webaudio/AbstractAudioContext.cpp
+++ b/third_party/WebKit/Source/modules/webaudio/AbstractAudioContext.cpp
@@ -82,8 +82,8 @@ AbstractAudioContext* AbstractAudioContext::create(Document& document, Exception
// Constructor for rendering to the audio hardware.
AbstractAudioContext::AbstractAudioContext(Document* document)
: ActiveDOMObject(document)
- , m_isCleared(false)
, m_destinationNode(nullptr)
+ , m_isCleared(false)
, m_isResolvingResumePromises(false)
, m_connectionCount(0)
, m_didInitializeContextGraphMutex(false)
@@ -99,8 +99,8 @@ AbstractAudioContext::AbstractAudioContext(Document* document)
// Constructor for offline (non-realtime) rendering.
AbstractAudioContext::AbstractAudioContext(Document* document, unsigned numberOfChannels, size_t numberOfFrames, float sampleRate)
: ActiveDOMObject(document)
- , m_isCleared(false)
, m_destinationNode(nullptr)
+ , m_isCleared(false)
, m_isResolvingResumePromises(false)
, m_connectionCount(0)
, m_didInitializeContextGraphMutex(false)
@@ -108,12 +108,6 @@ AbstractAudioContext::AbstractAudioContext(Document* document, unsigned numberOf
, m_contextState(Suspended)
{
m_didInitializeContextGraphMutex = true;
- // Create a new destination for offline rendering.
- m_renderTarget = AudioBuffer::create(numberOfChannels, numberOfFrames, sampleRate);
- if (m_renderTarget.get())
- m_destinationNode = OfflineAudioDestinationNode::create(this, m_renderTarget.get());
-
- initialize();
}
AbstractAudioContext::~AbstractAudioContext()
@@ -804,34 +798,8 @@ void AbstractAudioContext::startRendering()
}
}
-void AbstractAudioContext::fireCompletionEvent()
-{
- ASSERT(isMainThread());
- if (!isMainThread())
- return;
-
- AudioBuffer* renderedBuffer = m_renderTarget.get();
-
- // For an offline context, we set the state to closed here so that the oncomplete handler sees
- // that the context has been closed.
- setContextState(Closed);
-
- ASSERT(renderedBuffer);
- if (!renderedBuffer)
- return;
-
- // Avoid firing the event if the document has already gone away.
- if (executionContext()) {
- // Call the offline rendering completion event listener and resolve the promise too.
- dispatchEvent(OfflineAudioCompletionEvent::create(renderedBuffer));
- m_offlineResolver->resolve(renderedBuffer);
- }
-}
-
DEFINE_TRACE(AbstractAudioContext)
{
- visitor->trace(m_offlineResolver);
- visitor->trace(m_renderTarget);
visitor->trace(m_destinationNode);
visitor->trace(m_listener);
// trace() can be called in AbstractAudioContext constructor, and

Powered by Google App Engine
This is Rietveld 408576698