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

Unified Diff: third_party/WebKit/Source/modules/webaudio/PannerNode.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/PannerNode.cpp
diff --git a/third_party/WebKit/Source/modules/webaudio/PannerNode.cpp b/third_party/WebKit/Source/modules/webaudio/PannerNode.cpp
index 5754b0cf59ad26bab5003361c26dd4994dc3ab73..84bc042159045cd742188393ba412364d250ad4a 100644
--- a/third_party/WebKit/Source/modules/webaudio/PannerNode.cpp
+++ b/third_party/WebKit/Source/modules/webaudio/PannerNode.cpp
@@ -621,7 +621,7 @@ void PannerHandler::updateDirtyState()
}
// ----------------------------------------------------------------
-PannerNode::PannerNode(AbstractAudioContext& context, float sampleRate)
+PannerNode::PannerNode(AbstractAudioContext& context)
: AudioNode(context)
, m_positionX(AudioParam::create(context, ParamTypePannerPositionX, 0.0))
, m_positionY(AudioParam::create(context, ParamTypePannerPositionY, 0.0))
@@ -632,7 +632,7 @@ PannerNode::PannerNode(AbstractAudioContext& context, float sampleRate)
{
setHandler(PannerHandler::create(
*this,
- sampleRate,
+ context.sampleRate(),
m_positionX->handler(),
m_positionY->handler(),
m_positionZ->handler(),
@@ -641,9 +641,16 @@ PannerNode::PannerNode(AbstractAudioContext& context, float sampleRate)
m_orientationZ->handler()));
}
-PannerNode* PannerNode::create(AbstractAudioContext& context, float sampleRate)
+PannerNode* PannerNode::create(AbstractAudioContext& context, ExceptionState& exceptionState)
{
- return new PannerNode(context, sampleRate);
+ DCHECK(isMainThread());
+
+ if (context.isContextClosed()) {
+ context.throwExceptionForClosedState(exceptionState);
+ return nullptr;
+ }
+
+ return new PannerNode(context);
}
PannerHandler& PannerNode::pannerHandler() const
« no previous file with comments | « third_party/WebKit/Source/modules/webaudio/PannerNode.h ('k') | third_party/WebKit/Source/modules/webaudio/PeriodicWave.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698