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

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

Issue 1952793002: Move the exception logic to the AudioNode creator (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments Created 4 years, 7 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: third_party/WebKit/Source/modules/webaudio/GainNode.cpp
diff --git a/third_party/WebKit/Source/modules/webaudio/GainNode.cpp b/third_party/WebKit/Source/modules/webaudio/GainNode.cpp
index 6c8ad44f22c19bbfa9e88346b24fbcc099cf33ab..bada5970788b44c481b88a1e4286507de4adf35f 100644
--- a/third_party/WebKit/Source/modules/webaudio/GainNode.cpp
+++ b/third_party/WebKit/Source/modules/webaudio/GainNode.cpp
@@ -114,16 +114,23 @@ void GainHandler::checkNumberOfChannelsForInput(AudioNodeInput* input)
// ----------------------------------------------------------------
-GainNode::GainNode(AbstractAudioContext& context, float sampleRate)
+GainNode::GainNode(AbstractAudioContext& context)
: AudioNode(context)
, m_gain(AudioParam::create(context, ParamTypeGainGain, 1.0))
{
- setHandler(GainHandler::create(*this, sampleRate, m_gain->handler()));
+ setHandler(GainHandler::create(*this, context.sampleRate(), m_gain->handler()));
}
-GainNode* GainNode::create(AbstractAudioContext& context, float sampleRate)
+GainNode* GainNode::create(AbstractAudioContext& context, ExceptionState& exceptionState)
{
- return new GainNode(context, sampleRate);
+ DCHECK(isMainThread());
+
+ if (context.isContextClosed()) {
+ context.throwExceptionForClosedState(exceptionState);
+ return nullptr;
+ }
+
+ return new GainNode(context);
}
AudioParam* GainNode::gain() const
« no previous file with comments | « third_party/WebKit/Source/modules/webaudio/GainNode.h ('k') | third_party/WebKit/Source/modules/webaudio/IIRFilterNode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698