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

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

Issue 27037002: Get rid of custom bindings for AudioContext's constructor (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 2 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
Index: Source/modules/webaudio/AudioContext.cpp
diff --git a/Source/modules/webaudio/AudioContext.cpp b/Source/modules/webaudio/AudioContext.cpp
index fb7d57ef55602524189f2cbec2740afddcc99c6b..9c62d830c4fea446e396f200f33ce69a05217b28 100644
--- a/Source/modules/webaudio/AudioContext.cpp
+++ b/Source/modules/webaudio/AudioContext.cpp
@@ -58,6 +58,7 @@
#include "modules/webaudio/MediaStreamAudioDestinationNode.h"
#include "modules/webaudio/MediaStreamAudioSourceNode.h"
#include "modules/webaudio/OfflineAudioCompletionEvent.h"
+#include "modules/webaudio/OfflineAudioContext.h"
#include "modules/webaudio/OfflineAudioDestinationNode.h"
#include "modules/webaudio/OscillatorNode.h"
#include "modules/webaudio/PannerNode.h"
@@ -95,18 +96,23 @@ bool AudioContext::isSampleRateRangeGood(float sampleRate)
const unsigned MaxHardwareContexts = 4;
unsigned AudioContext::s_hardwareContextCount = 0;
-PassRefPtr<AudioContext> AudioContext::create(Document* document)
+PassRefPtr<AudioContext> AudioContext::create(Document& document, ExceptionState&)
{
- ASSERT(document);
ASSERT(isMainThread());
if (s_hardwareContextCount >= MaxHardwareContexts)
return 0;
- RefPtr<AudioContext> audioContext(adoptRef(new AudioContext(document)));
+ RefPtr<AudioContext> audioContext(adoptRef(new AudioContext(&document)));
audioContext->suspendIfNeeded();
return audioContext.release();
}
+PassRefPtr<AudioContext> AudioContext::create(Document& document, unsigned numberOfChannels, size_t numberOfFrames, float sampleRate, ExceptionState& es)
+{
+ document.addConsoleMessage(JSMessageSource, WarningMessageLevel, "Deprecated AudioContext constructor: use OfflineAudioContext instead");
+ return OfflineAudioContext::create(&document, numberOfChannels, numberOfFrames, sampleRate, es);
+}
+
// Constructor for rendering to the audio hardware.
AudioContext::AudioContext(Document* document)
: ActiveDOMObject(document)

Powered by Google App Engine
This is Rietveld 408576698