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

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: Move more things to Node::create() 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..2e4d2f35b379286c81b7a0745cd924b6e0efcb96 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);
+ ASSERT(isMainThread());
hongchan 2016/05/13 01:20:12 DCHECK.
Raymond Toy 2016/05/20 23:12:00 Done.
+
+ if (context.isContextClosed()) {
+ context.throwExceptionForClosedState(exceptionState);
+ return nullptr;
+ }
+
+ return new GainNode(context);
}
AudioParam* GainNode::gain() const

Powered by Google App Engine
This is Rietveld 408576698