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

Side by Side Diff: third_party/WebKit/Source/modules/webaudio/StereoPannerNode.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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/webaudio/StereoPannerNode.h" 5 #include "modules/webaudio/StereoPannerNode.h"
6 #include "bindings/core/v8/ExceptionMessages.h" 6 #include "bindings/core/v8/ExceptionMessages.h"
7 #include "bindings/core/v8/ExceptionState.h" 7 #include "bindings/core/v8/ExceptionState.h"
8 #include "core/dom/ExceptionCode.h" 8 #include "core/dom/ExceptionCode.h"
9 #include "core/dom/ExecutionContext.h" 9 #include "core/dom/ExecutionContext.h"
10 #include "modules/webaudio/AbstractAudioContext.h" 10 #include "modules/webaudio/AbstractAudioContext.h"
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 // Do nothing for other invalid values. 127 // Do nothing for other invalid values.
128 m_newChannelCountMode = oldMode; 128 m_newChannelCountMode = oldMode;
129 } 129 }
130 130
131 if (m_newChannelCountMode != oldMode) 131 if (m_newChannelCountMode != oldMode)
132 context()->deferredTaskHandler().addChangedChannelCountMode(this); 132 context()->deferredTaskHandler().addChangedChannelCountMode(this);
133 } 133 }
134 134
135 // ---------------------------------------------------------------- 135 // ----------------------------------------------------------------
136 136
137 StereoPannerNode::StereoPannerNode(AbstractAudioContext& context, float sampleRa te) 137 StereoPannerNode::StereoPannerNode(AbstractAudioContext& context)
138 : AudioNode(context) 138 : AudioNode(context)
139 , m_pan(AudioParam::create(context, ParamTypeStereoPannerPan, 0)) 139 , m_pan(AudioParam::create(context, ParamTypeStereoPannerPan, 0))
140 { 140 {
141 setHandler(StereoPannerHandler::create(*this, sampleRate, m_pan->handler())) ; 141 setHandler(StereoPannerHandler::create(*this, context.sampleRate(), m_pan->h andler()));
hongchan 2016/05/13 01:20:13 80 cols.
142 } 142 }
143 143
144 StereoPannerNode* StereoPannerNode::create(AbstractAudioContext& context, float sampleRate) 144 StereoPannerNode* StereoPannerNode::create(AbstractAudioContext& context, Except ionState& exceptionState)
hongchan 2016/05/13 01:20:13 Let's wrap arguments.
145 { 145 {
146 return new StereoPannerNode(context, sampleRate); 146 ASSERT(isMainThread());
hongchan 2016/05/13 01:20:13 DCHECK.
Raymond Toy 2016/05/20 23:12:01 Done.
147
148 if (context.isContextClosed()) {
149 context.throwExceptionForClosedState(exceptionState);
150 return nullptr;
151 }
152
153 return new StereoPannerNode(context);
147 } 154 }
148 155
149 DEFINE_TRACE(StereoPannerNode) 156 DEFINE_TRACE(StereoPannerNode)
150 { 157 {
151 visitor->trace(m_pan); 158 visitor->trace(m_pan);
152 AudioNode::trace(visitor); 159 AudioNode::trace(visitor);
153 } 160 }
154 161
155 AudioParam* StereoPannerNode::pan() const 162 AudioParam* StereoPannerNode::pan() const
156 { 163 {
157 return m_pan; 164 return m_pan;
158 } 165 }
159 166
160 } // namespace blink 167 } // namespace blink
161 168
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698