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

Unified Diff: Source/modules/webaudio/AudioBufferSourceNode.cpp

Issue 26883005: Get rid of custom bindings for AudioBufferSourceNode.buffer setter (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 2 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
« no previous file with comments | « Source/modules/webaudio/AudioBufferSourceNode.h ('k') | Source/modules/webaudio/AudioBufferSourceNode.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/webaudio/AudioBufferSourceNode.cpp
diff --git a/Source/modules/webaudio/AudioBufferSourceNode.cpp b/Source/modules/webaudio/AudioBufferSourceNode.cpp
index 19aa3e6816aa3fe60e7acc8903a4862976a52c31..e5a4791d8250a8e8f88f87be7e75210b4a83110a 100644
--- a/Source/modules/webaudio/AudioBufferSourceNode.cpp
+++ b/Source/modules/webaudio/AudioBufferSourceNode.cpp
@@ -28,6 +28,7 @@
#include "modules/webaudio/AudioBufferSourceNode.h"
+#include "bindings/v8/ExceptionState.h"
#include "core/page/PageConsole.h"
#include "platform/audio/AudioUtilities.h"
#include "modules/webaudio/AudioContext.h"
@@ -335,9 +336,15 @@ void AudioBufferSourceNode::reset()
m_lastGain = gain()->value();
}
-bool AudioBufferSourceNode::setBuffer(AudioBuffer* buffer)
+void AudioBufferSourceNode::setBuffer(AudioBuffer* buffer, ExceptionState& es)
{
ASSERT(isMainThread());
+ // FIXME: It does not look like we should throw if the buffer is null as
+ // the attribute is nullable in the specification.
+ if (!buffer) {
+ es.throwTypeError("buffer cannot be null");
+ return;
+ }
// The context must be locked since changing the buffer can re-configure the number of channels that are output.
AudioContext::AutoLocker contextLocker(context());
@@ -349,8 +356,10 @@ bool AudioBufferSourceNode::setBuffer(AudioBuffer* buffer)
// Do any necesssary re-configuration to the buffer's number of channels.
unsigned numberOfChannels = buffer->numberOfChannels();
- if (numberOfChannels > AudioContext::maxNumberOfChannels())
- return false;
+ if (numberOfChannels > AudioContext::maxNumberOfChannels()) {
+ es.throwTypeError("AudioBuffer unsupported number of channels");
Raymond Toy (Google) 2013/10/10 22:40:57 Should this be a DOMException? And if so, can we
+ return;
+ }
output(0)->setNumberOfChannels(numberOfChannels);
@@ -363,8 +372,6 @@ bool AudioBufferSourceNode::setBuffer(AudioBuffer* buffer)
m_virtualReadIndex = 0;
m_buffer = buffer;
-
- return true;
}
unsigned AudioBufferSourceNode::numberOfChannels()
« no previous file with comments | « Source/modules/webaudio/AudioBufferSourceNode.h ('k') | Source/modules/webaudio/AudioBufferSourceNode.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698