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

Unified Diff: third_party/WebKit/Source/modules/webaudio/AnalyserNode.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/AnalyserNode.cpp
diff --git a/third_party/WebKit/Source/modules/webaudio/AnalyserNode.cpp b/third_party/WebKit/Source/modules/webaudio/AnalyserNode.cpp
index d98f25cddbbf10c36a79eaa381d13be588c24906..434036446f7697f70133e783440698ab7c97cf8a 100644
--- a/third_party/WebKit/Source/modules/webaudio/AnalyserNode.cpp
+++ b/third_party/WebKit/Source/modules/webaudio/AnalyserNode.cpp
@@ -113,15 +113,22 @@ void AnalyserHandler::setSmoothingTimeConstant(double k, ExceptionState& excepti
// ----------------------------------------------------------------
-AnalyserNode::AnalyserNode(AbstractAudioContext& context, float sampleRate)
+AnalyserNode::AnalyserNode(AbstractAudioContext& context)
: AudioBasicInspectorNode(context)
{
- setHandler(AnalyserHandler::create(*this, sampleRate));
+ setHandler(AnalyserHandler::create(*this, context.sampleRate()));
}
-AnalyserNode* AnalyserNode::create(AbstractAudioContext& context, float sampleRate)
+AnalyserNode* AnalyserNode::create(AbstractAudioContext& context, ExceptionState& exceptionState)
{
- return new AnalyserNode(context, sampleRate);
+ DCHECK(isMainThread());
+
+ if (context.isContextClosed()) {
+ context.throwExceptionForClosedState(exceptionState);
+ return nullptr;
+ }
+
+ return new AnalyserNode(context);
}
AnalyserHandler& AnalyserNode::analyserHandler() const

Powered by Google App Engine
This is Rietveld 408576698