<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[207050] trunk/Source/WebCore</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/207050">207050</a></dd>
<dt>Author</dt> <dd>darin@apple.com</dd>
<dt>Date</dt> <dd>2016-10-10 23:23:49 -0700 (Mon, 10 Oct 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Move audio module off of legacy exceptions
https://bugs.webkit.org/show_bug.cgi?id=163269
Reviewed by Alex Christensen.
* Modules/webaudio/AnalyserNode.cpp:
(WebCore::AnalyserNode::setFftSize): Use ExceptionOr.
(WebCore::AnalyserNode::setMinDecibels): Ditto.
(WebCore::AnalyserNode::setMaxDecibels): Ditto.
(WebCore::AnalyserNode::setSmoothingTimeConstant): Ditto.
* Modules/webaudio/AnalyserNode.h: Update for above.
* Modules/webaudio/AnalyserNode.idl: Ditto.
* Modules/webaudio/AudioBasicInspectorNode.cpp:
(WebCore::AudioBasicInspectorNode::AudioBasicInspectorNode):
Initialize m_needAutomaticPull in class definition.
(WebCore::AudioBasicInspectorNode::connect): Use ExceptionOr.
(WebCore::AudioBasicInspectorNode::disconnect): Ditto.
* Modules/webaudio/AudioBasicInspectorNode.h: Updated for above.
* Modules/webaudio/AudioBuffer.cpp:
(WebCore::AudioBuffer::createFromAudioFileData): Use reference.
(WebCore::AudioBuffer::AudioBuffer): Initialize m_gain in class definition.
(WebCore::AudioBuffer::getChannelData): Use ExceptionOr.
(WebCore::AudioBuffer::channelData): Rename to disambiguate with getChannelData.
(WebCore::AudioBuffer::zero): Use modern for loop.
* Modules/webaudio/AudioBuffer.h: Update for above.
* Modules/webaudio/AudioBuffer.idl: Ditto.
* Modules/webaudio/AudioBufferSourceNode.cpp:
(WebCore::AudioBufferSourceNode::process): Use reference.
(WebCore::AudioBufferSourceNode::setBuffer): Use channelData.
(WebCore::AudioBufferSourceNode::start): Use ExceptionOr.
(WebCore::AudioBufferSourceNode::startPlaying): Ditto.
* Modules/webaudio/AudioBufferSourceNode.h: Update for above.
* Modules/webaudio/AudioBufferSourceNode.idl: Ditto.
* Modules/webaudio/AudioContext.cpp:
(WebCore::AudioContext::createBuffer): Use ExceptionOr.
(WebCore::AudioContext::createMediaElementSource): Ditto.
(WebCore::AudioContext::createMediaStreamSource): Ditto.
(WebCore::AudioContext::createScriptProcessor): Ditto.
(WebCore::AudioContext::createDelay): Ditto.
(WebCore::AudioContext::createChannelSplitter): Ditto.
(WebCore::AudioContext::createChannelMerger): Ditto.
(WebCore::AudioContext::createPeriodicWave): Ditto.
* Modules/webaudio/AudioContext.h: Update for above.
* Modules/webaudio/AudioContext.idl: Ditto.
* Modules/webaudio/AudioDestinationNode.h: Use unsigned instead
of unsigned long for maxChannelCount.
* Modules/webaudio/AudioNode.cpp:
(WebCore::AudioNode::connect): Use ExceptionOr.
(WebCore::AudioNode::disconnect): Ditto.
(WebCore::AudioNode::channelCount): Use unsigned.
(WebCore::AudioNode::setChannelCount): Use ExceptionOr and unsigned.
(WebCore::AudioNode::setChannelCountMode): Ditto.
(WebCore::AudioNode::setChannelInterpretation): Ditto.
* Modules/webaudio/AudioNode.h: Update for above.
* Modules/webaudio/AudioNode.idl: Ditto.
* Modules/webaudio/AudioScheduledSourceNode.cpp:
(WebCore::AudioScheduledSourceNode::AudioScheduledSourceNode):
Initialize data members in class definition.
(WebCore::AudioScheduledSourceNode::updateSchedulingInfo): Take
a reference instead of a pointer to the audio bus.
(WebCore::AudioScheduledSourceNode::start): Use ExceptionOr.
(WebCore::AudioScheduledSourceNode::stop): Ditto.
* Modules/webaudio/AudioScheduledSourceNode.h: Update for above.
* Modules/webaudio/ConvolverNode.cpp:
(WebCore::ConvolverNode::ConvolverNode): Initialize m_normalize
in class definition.
(WebCore::ConvolverNode::setBuffer): Use ExceptionOr.
* Modules/webaudio/ConvolverNode.h: Update for above.
* Modules/webaudio/ConvolverNode.idl: Ditto.
* Modules/webaudio/DefaultAudioDestinationNode.cpp:
(WebCore::DefaultAudioDestinationNode::DefaultAudioDestinationNode):
Initialize m_numberOfInputChannels in class definition.
(WebCore::DefaultAudioDestinationNode::maxChannelCount): Use unsigned.
(WebCore::DefaultAudioDestinationNode::setChannelCount): Use ExceptionOr.
* Modules/webaudio/DefaultAudioDestinationNode.h: Update for changes above.
* Modules/webaudio/DelayNode.cpp:
(WebCore::DelayNode::DelayNode): Moved exception logic out of constructor.
(WebCore::DelayNode::create): Added. Moved exception logic in here.
(WebCore::DelayNode::delayTime): Moved typecast here from header.
* Modules/webaudio/DelayNode.h: Update for above.
* Modules/webaudio/OfflineAudioContext.cpp:
(WebCore::OfflineAudioContext::OfflineAudioContext): Marked inline.
(WebCore::OfflineAudioContext::create): Use ExceptionOr.
(WebCore::OfflineAudioContext::~OfflineAudioContext): Deleted. Unneeded.
* Modules/webaudio/OfflineAudioContext.h: Update for above.
* Modules/webaudio/OfflineAudioContext.idl: Ditto.
* Modules/webaudio/OfflineAudioDestinationNode.cpp:
(WebCore::OfflineAudioDestinationNode::offlineRender): Use channelData.
* Modules/webaudio/OscillatorNode.cpp:
(WebCore::OscillatorNode::OscillatorNode): Updated for change to setType.
(WebCore::OscillatorNode::setType): Use ExceptionOr.
(WebCore::OscillatorNode::process): Use a reference.
* Modules/webaudio/OscillatorNode.h: Update for above.
* Modules/webaudio/OscillatorNode.idl: Ditto.
* Modules/webaudio/ScriptProcessorNode.cpp:
(WebCore::ScriptProcessorNode::process): Use channelData.
* bindings/js/JSDOMBinding.h: Added overloads of toJS to it can be used on
references to array buffers and array buffer views, not just pointers.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModuleswebaudioAnalyserNodecpp">trunk/Source/WebCore/Modules/webaudio/AnalyserNode.cpp</a></li>
<li><a href="#trunkSourceWebCoreModuleswebaudioAnalyserNodeh">trunk/Source/WebCore/Modules/webaudio/AnalyserNode.h</a></li>
<li><a href="#trunkSourceWebCoreModuleswebaudioAnalyserNodeidl">trunk/Source/WebCore/Modules/webaudio/AnalyserNode.idl</a></li>
<li><a href="#trunkSourceWebCoreModuleswebaudioAudioBasicInspectorNodecpp">trunk/Source/WebCore/Modules/webaudio/AudioBasicInspectorNode.cpp</a></li>
<li><a href="#trunkSourceWebCoreModuleswebaudioAudioBasicInspectorNodeh">trunk/Source/WebCore/Modules/webaudio/AudioBasicInspectorNode.h</a></li>
<li><a href="#trunkSourceWebCoreModuleswebaudioAudioBuffercpp">trunk/Source/WebCore/Modules/webaudio/AudioBuffer.cpp</a></li>
<li><a href="#trunkSourceWebCoreModuleswebaudioAudioBufferh">trunk/Source/WebCore/Modules/webaudio/AudioBuffer.h</a></li>
<li><a href="#trunkSourceWebCoreModuleswebaudioAudioBufferidl">trunk/Source/WebCore/Modules/webaudio/AudioBuffer.idl</a></li>
<li><a href="#trunkSourceWebCoreModuleswebaudioAudioBufferSourceNodecpp">trunk/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.cpp</a></li>
<li><a href="#trunkSourceWebCoreModuleswebaudioAudioBufferSourceNodeh">trunk/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.h</a></li>
<li><a href="#trunkSourceWebCoreModuleswebaudioAudioBufferSourceNodeidl">trunk/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.idl</a></li>
<li><a href="#trunkSourceWebCoreModuleswebaudioAudioContextcpp">trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp</a></li>
<li><a href="#trunkSourceWebCoreModuleswebaudioAudioContexth">trunk/Source/WebCore/Modules/webaudio/AudioContext.h</a></li>
<li><a href="#trunkSourceWebCoreModuleswebaudioAudioContextidl">trunk/Source/WebCore/Modules/webaudio/AudioContext.idl</a></li>
<li><a href="#trunkSourceWebCoreModuleswebaudioAudioDestinationNodeh">trunk/Source/WebCore/Modules/webaudio/AudioDestinationNode.h</a></li>
<li><a href="#trunkSourceWebCoreModuleswebaudioAudioNodecpp">trunk/Source/WebCore/Modules/webaudio/AudioNode.cpp</a></li>
<li><a href="#trunkSourceWebCoreModuleswebaudioAudioNodeh">trunk/Source/WebCore/Modules/webaudio/AudioNode.h</a></li>
<li><a href="#trunkSourceWebCoreModuleswebaudioAudioNodeidl">trunk/Source/WebCore/Modules/webaudio/AudioNode.idl</a></li>
<li><a href="#trunkSourceWebCoreModuleswebaudioAudioScheduledSourceNodecpp">trunk/Source/WebCore/Modules/webaudio/AudioScheduledSourceNode.cpp</a></li>
<li><a href="#trunkSourceWebCoreModuleswebaudioAudioScheduledSourceNodeh">trunk/Source/WebCore/Modules/webaudio/AudioScheduledSourceNode.h</a></li>
<li><a href="#trunkSourceWebCoreModuleswebaudioConvolverNodecpp">trunk/Source/WebCore/Modules/webaudio/ConvolverNode.cpp</a></li>
<li><a href="#trunkSourceWebCoreModuleswebaudioConvolverNodeh">trunk/Source/WebCore/Modules/webaudio/ConvolverNode.h</a></li>
<li><a href="#trunkSourceWebCoreModuleswebaudioConvolverNodeidl">trunk/Source/WebCore/Modules/webaudio/ConvolverNode.idl</a></li>
<li><a href="#trunkSourceWebCoreModuleswebaudioDefaultAudioDestinationNodecpp">trunk/Source/WebCore/Modules/webaudio/DefaultAudioDestinationNode.cpp</a></li>
<li><a href="#trunkSourceWebCoreModuleswebaudioDefaultAudioDestinationNodeh">trunk/Source/WebCore/Modules/webaudio/DefaultAudioDestinationNode.h</a></li>
<li><a href="#trunkSourceWebCoreModuleswebaudioDelayNodecpp">trunk/Source/WebCore/Modules/webaudio/DelayNode.cpp</a></li>
<li><a href="#trunkSourceWebCoreModuleswebaudioDelayNodeh">trunk/Source/WebCore/Modules/webaudio/DelayNode.h</a></li>
<li><a href="#trunkSourceWebCoreModuleswebaudioOfflineAudioContextcpp">trunk/Source/WebCore/Modules/webaudio/OfflineAudioContext.cpp</a></li>
<li><a href="#trunkSourceWebCoreModuleswebaudioOfflineAudioContexth">trunk/Source/WebCore/Modules/webaudio/OfflineAudioContext.h</a></li>
<li><a href="#trunkSourceWebCoreModuleswebaudioOfflineAudioContextidl">trunk/Source/WebCore/Modules/webaudio/OfflineAudioContext.idl</a></li>
<li><a href="#trunkSourceWebCoreModuleswebaudioOfflineAudioDestinationNodecpp">trunk/Source/WebCore/Modules/webaudio/OfflineAudioDestinationNode.cpp</a></li>
<li><a href="#trunkSourceWebCoreModuleswebaudioOscillatorNodecpp">trunk/Source/WebCore/Modules/webaudio/OscillatorNode.cpp</a></li>
<li><a href="#trunkSourceWebCoreModuleswebaudioOscillatorNodeh">trunk/Source/WebCore/Modules/webaudio/OscillatorNode.h</a></li>
<li><a href="#trunkSourceWebCoreModuleswebaudioOscillatorNodeidl">trunk/Source/WebCore/Modules/webaudio/OscillatorNode.idl</a></li>
<li><a href="#trunkSourceWebCoreModuleswebaudioScriptProcessorNodecpp">trunk/Source/WebCore/Modules/webaudio/ScriptProcessorNode.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSDOMBindingh">trunk/Source/WebCore/bindings/js/JSDOMBinding.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (207049 => 207050)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-10-11 06:19:02 UTC (rev 207049)
+++ trunk/Source/WebCore/ChangeLog        2016-10-11 06:23:49 UTC (rev 207050)
</span><span class="lines">@@ -1,3 +1,119 @@
</span><ins>+2016-10-10 Darin Adler <darin@apple.com>
+
+ Move audio module off of legacy exceptions
+ https://bugs.webkit.org/show_bug.cgi?id=163269
+
+ Reviewed by Alex Christensen.
+
+ * Modules/webaudio/AnalyserNode.cpp:
+ (WebCore::AnalyserNode::setFftSize): Use ExceptionOr.
+ (WebCore::AnalyserNode::setMinDecibels): Ditto.
+ (WebCore::AnalyserNode::setMaxDecibels): Ditto.
+ (WebCore::AnalyserNode::setSmoothingTimeConstant): Ditto.
+ * Modules/webaudio/AnalyserNode.h: Update for above.
+ * Modules/webaudio/AnalyserNode.idl: Ditto.
+
+ * Modules/webaudio/AudioBasicInspectorNode.cpp:
+ (WebCore::AudioBasicInspectorNode::AudioBasicInspectorNode):
+ Initialize m_needAutomaticPull in class definition.
+ (WebCore::AudioBasicInspectorNode::connect): Use ExceptionOr.
+ (WebCore::AudioBasicInspectorNode::disconnect): Ditto.
+ * Modules/webaudio/AudioBasicInspectorNode.h: Updated for above.
+
+ * Modules/webaudio/AudioBuffer.cpp:
+ (WebCore::AudioBuffer::createFromAudioFileData): Use reference.
+ (WebCore::AudioBuffer::AudioBuffer): Initialize m_gain in class definition.
+ (WebCore::AudioBuffer::getChannelData): Use ExceptionOr.
+ (WebCore::AudioBuffer::channelData): Rename to disambiguate with getChannelData.
+ (WebCore::AudioBuffer::zero): Use modern for loop.
+ * Modules/webaudio/AudioBuffer.h: Update for above.
+ * Modules/webaudio/AudioBuffer.idl: Ditto.
+
+ * Modules/webaudio/AudioBufferSourceNode.cpp:
+ (WebCore::AudioBufferSourceNode::process): Use reference.
+ (WebCore::AudioBufferSourceNode::setBuffer): Use channelData.
+ (WebCore::AudioBufferSourceNode::start): Use ExceptionOr.
+ (WebCore::AudioBufferSourceNode::startPlaying): Ditto.
+ * Modules/webaudio/AudioBufferSourceNode.h: Update for above.
+ * Modules/webaudio/AudioBufferSourceNode.idl: Ditto.
+
+ * Modules/webaudio/AudioContext.cpp:
+ (WebCore::AudioContext::createBuffer): Use ExceptionOr.
+ (WebCore::AudioContext::createMediaElementSource): Ditto.
+ (WebCore::AudioContext::createMediaStreamSource): Ditto.
+ (WebCore::AudioContext::createScriptProcessor): Ditto.
+ (WebCore::AudioContext::createDelay): Ditto.
+ (WebCore::AudioContext::createChannelSplitter): Ditto.
+ (WebCore::AudioContext::createChannelMerger): Ditto.
+ (WebCore::AudioContext::createPeriodicWave): Ditto.
+ * Modules/webaudio/AudioContext.h: Update for above.
+ * Modules/webaudio/AudioContext.idl: Ditto.
+
+ * Modules/webaudio/AudioDestinationNode.h: Use unsigned instead
+ of unsigned long for maxChannelCount.
+
+ * Modules/webaudio/AudioNode.cpp:
+ (WebCore::AudioNode::connect): Use ExceptionOr.
+ (WebCore::AudioNode::disconnect): Ditto.
+ (WebCore::AudioNode::channelCount): Use unsigned.
+ (WebCore::AudioNode::setChannelCount): Use ExceptionOr and unsigned.
+ (WebCore::AudioNode::setChannelCountMode): Ditto.
+ (WebCore::AudioNode::setChannelInterpretation): Ditto.
+ * Modules/webaudio/AudioNode.h: Update for above.
+ * Modules/webaudio/AudioNode.idl: Ditto.
+
+ * Modules/webaudio/AudioScheduledSourceNode.cpp:
+ (WebCore::AudioScheduledSourceNode::AudioScheduledSourceNode):
+ Initialize data members in class definition.
+ (WebCore::AudioScheduledSourceNode::updateSchedulingInfo): Take
+ a reference instead of a pointer to the audio bus.
+ (WebCore::AudioScheduledSourceNode::start): Use ExceptionOr.
+ (WebCore::AudioScheduledSourceNode::stop): Ditto.
+ * Modules/webaudio/AudioScheduledSourceNode.h: Update for above.
+
+ * Modules/webaudio/ConvolverNode.cpp:
+ (WebCore::ConvolverNode::ConvolverNode): Initialize m_normalize
+ in class definition.
+ (WebCore::ConvolverNode::setBuffer): Use ExceptionOr.
+ * Modules/webaudio/ConvolverNode.h: Update for above.
+ * Modules/webaudio/ConvolverNode.idl: Ditto.
+
+ * Modules/webaudio/DefaultAudioDestinationNode.cpp:
+ (WebCore::DefaultAudioDestinationNode::DefaultAudioDestinationNode):
+ Initialize m_numberOfInputChannels in class definition.
+ (WebCore::DefaultAudioDestinationNode::maxChannelCount): Use unsigned.
+ (WebCore::DefaultAudioDestinationNode::setChannelCount): Use ExceptionOr.
+ * Modules/webaudio/DefaultAudioDestinationNode.h: Update for changes above.
+
+ * Modules/webaudio/DelayNode.cpp:
+ (WebCore::DelayNode::DelayNode): Moved exception logic out of constructor.
+ (WebCore::DelayNode::create): Added. Moved exception logic in here.
+ (WebCore::DelayNode::delayTime): Moved typecast here from header.
+ * Modules/webaudio/DelayNode.h: Update for above.
+
+ * Modules/webaudio/OfflineAudioContext.cpp:
+ (WebCore::OfflineAudioContext::OfflineAudioContext): Marked inline.
+ (WebCore::OfflineAudioContext::create): Use ExceptionOr.
+ (WebCore::OfflineAudioContext::~OfflineAudioContext): Deleted. Unneeded.
+ * Modules/webaudio/OfflineAudioContext.h: Update for above.
+ * Modules/webaudio/OfflineAudioContext.idl: Ditto.
+
+ * Modules/webaudio/OfflineAudioDestinationNode.cpp:
+ (WebCore::OfflineAudioDestinationNode::offlineRender): Use channelData.
+
+ * Modules/webaudio/OscillatorNode.cpp:
+ (WebCore::OscillatorNode::OscillatorNode): Updated for change to setType.
+ (WebCore::OscillatorNode::setType): Use ExceptionOr.
+ (WebCore::OscillatorNode::process): Use a reference.
+ * Modules/webaudio/OscillatorNode.h: Update for above.
+ * Modules/webaudio/OscillatorNode.idl: Ditto.
+
+ * Modules/webaudio/ScriptProcessorNode.cpp:
+ (WebCore::ScriptProcessorNode::process): Use channelData.
+
+ * bindings/js/JSDOMBinding.h: Added overloads of toJS to it can be used on
+ references to array buffers and array buffer views, not just pointers.
+
</ins><span class="cx"> 2016-10-10 Youenn Fablet <youenn@apple.com>
</span><span class="cx">
</span><span class="cx"> Change HTTPHeaderValues from a struct to a namespace
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebaudioAnalyserNodecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webaudio/AnalyserNode.cpp (207049 => 207050)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webaudio/AnalyserNode.cpp        2016-10-11 06:19:02 UTC (rev 207049)
+++ trunk/Source/WebCore/Modules/webaudio/AnalyserNode.cpp        2016-10-11 06:23:49 UTC (rev 207050)
</span><span class="lines">@@ -30,7 +30,6 @@
</span><span class="cx">
</span><span class="cx"> #include "AudioNodeInput.h"
</span><span class="cx"> #include "AudioNodeOutput.h"
</span><del>-#include "ExceptionCode.h"
</del><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="lines">@@ -72,40 +71,38 @@
</span><span class="cx"> m_analyser.reset();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void AnalyserNode::setFftSize(unsigned size, ExceptionCode& ec)
</del><ins>+ExceptionOr<void> AnalyserNode::setFftSize(unsigned size)
</ins><span class="cx"> {
</span><span class="cx"> if (!m_analyser.setFftSize(size))
</span><del>- ec = INDEX_SIZE_ERR;
</del><ins>+ return Exception { INDEX_SIZE_ERR };
+ return { };
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void AnalyserNode::setMinDecibels(double k, ExceptionCode& ec)
</del><ins>+ExceptionOr<void> AnalyserNode::setMinDecibels(double k)
</ins><span class="cx"> {
</span><del>- if (k > maxDecibels()) {
- ec = INDEX_SIZE_ERR;
- return;
- }
</del><ins>+ if (k > maxDecibels())
+ return Exception { INDEX_SIZE_ERR };
</ins><span class="cx">
</span><span class="cx"> m_analyser.setMinDecibels(k);
</span><ins>+ return { };
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void AnalyserNode::setMaxDecibels(double k, ExceptionCode& ec)
</del><ins>+ExceptionOr<void> AnalyserNode::setMaxDecibels(double k)
</ins><span class="cx"> {
</span><del>- if (k < minDecibels()) {
- ec = INDEX_SIZE_ERR;
- return;
- }
</del><ins>+ if (k < minDecibels())
+ return Exception { INDEX_SIZE_ERR };
</ins><span class="cx">
</span><span class="cx"> m_analyser.setMaxDecibels(k);
</span><ins>+ return { };
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void AnalyserNode::setSmoothingTimeConstant(double k, ExceptionCode& ec)
</del><ins>+ExceptionOr<void> AnalyserNode::setSmoothingTimeConstant(double k)
</ins><span class="cx"> {
</span><del>- if (k < 0 || k > 1) {
- ec = INDEX_SIZE_ERR;
- return;
- }
</del><ins>+ if (k < 0 || k > 1)
+ return Exception { INDEX_SIZE_ERR };
</ins><span class="cx">
</span><span class="cx"> m_analyser.setSmoothingTimeConstant(k);
</span><ins>+ return { };
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebaudioAnalyserNodeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webaudio/AnalyserNode.h (207049 => 207050)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webaudio/AnalyserNode.h        2016-10-11 06:19:02 UTC (rev 207049)
+++ trunk/Source/WebCore/Modules/webaudio/AnalyserNode.h        2016-10-11 06:23:49 UTC (rev 207050)
</span><span class="lines">@@ -22,16 +22,14 @@
</span><span class="cx"> * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><del>-#ifndef AnalyserNode_h
-#define AnalyserNode_h
</del><ins>+#pragma once
</ins><span class="cx">
</span><span class="cx"> #include "AudioBasicInspectorNode.h"
</span><span class="cx"> #include "RealtimeAnalyser.h"
</span><del>-#include <wtf/Forward.h>
</del><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-class AnalyserNode : public AudioBasicInspectorNode {
</del><ins>+class AnalyserNode final : public AudioBasicInspectorNode {
</ins><span class="cx"> public:
</span><span class="cx"> static Ref<AnalyserNode> create(AudioContext& context, float sampleRate)
</span><span class="cx"> {
</span><span class="lines">@@ -39,24 +37,19 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> virtual ~AnalyserNode();
</span><del>-
- // AudioNode
- void process(size_t framesToProcess) override;
- void reset() override;
</del><span class="cx">
</span><del>- // Javascript bindings
</del><span class="cx"> unsigned fftSize() const { return m_analyser.fftSize(); }
</span><del>- void setFftSize(unsigned size, ExceptionCode&);
</del><ins>+ ExceptionOr<void> setFftSize(unsigned);
</ins><span class="cx">
</span><span class="cx"> unsigned frequencyBinCount() const { return m_analyser.frequencyBinCount(); }
</span><span class="cx">
</span><del>- void setMinDecibels(double k, ExceptionCode&);
</del><ins>+ ExceptionOr<void> setMinDecibels(double);
</ins><span class="cx"> double minDecibels() const { return m_analyser.minDecibels(); }
</span><span class="cx">
</span><del>- void setMaxDecibels(double k, ExceptionCode&);
</del><ins>+ ExceptionOr<void> setMaxDecibels(double);
</ins><span class="cx"> double maxDecibels() const { return m_analyser.maxDecibels(); }
</span><span class="cx">
</span><del>- void setSmoothingTimeConstant(double k, ExceptionCode&);
</del><ins>+ ExceptionOr<void> setSmoothingTimeConstant(double);
</ins><span class="cx"> double smoothingTimeConstant() const { return m_analyser.smoothingTimeConstant(); }
</span><span class="cx">
</span><span class="cx"> void getFloatFrequencyData(const RefPtr<JSC::Float32Array>& array) { m_analyser.getFloatFrequencyData(array.get()); }
</span><span class="lines">@@ -64,14 +57,15 @@
</span><span class="cx"> void getByteTimeDomainData(const RefPtr<JSC::Uint8Array>& array) { m_analyser.getByteTimeDomainData(array.get()); }
</span><span class="cx">
</span><span class="cx"> private:
</span><del>- double tailTime() const override { return 0; }
- double latencyTime() const override { return 0; }
-
</del><span class="cx"> AnalyserNode(AudioContext&, float sampleRate);
</span><span class="cx">
</span><ins>+ void process(size_t framesToProcess) final;
+ void reset() final;
+
+ double tailTime() const final { return 0; }
+ double latencyTime() const final { return 0; }
+
</ins><span class="cx"> RealtimeAnalyser m_analyser;
</span><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span><del>-
-#endif // AnalyserNode_h
</del></span></pre></div>
<a id="trunkSourceWebCoreModuleswebaudioAnalyserNodeidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webaudio/AnalyserNode.idl (207049 => 207050)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webaudio/AnalyserNode.idl        2016-10-11 06:19:02 UTC (rev 207049)
+++ trunk/Source/WebCore/Modules/webaudio/AnalyserNode.idl        2016-10-11 06:23:49 UTC (rev 207050)
</span><span class="lines">@@ -26,15 +26,15 @@
</span><span class="cx"> Conditional=WEB_AUDIO,
</span><span class="cx"> JSGenerateToJSObject,
</span><span class="cx"> ] interface AnalyserNode : AudioNode {
</span><del>- [SetterMayThrowLegacyException] attribute unsigned long fftSize;
</del><ins>+ [SetterMayThrowException] attribute unsigned long fftSize;
</ins><span class="cx"> readonly attribute unsigned long frequencyBinCount;
</span><span class="cx">
</span><span class="cx"> // minDecibels / maxDecibels represent the range to scale the FFT analysis data for conversion to unsigned byte values.
</span><del>- [SetterMayThrowLegacyException] attribute unrestricted double minDecibels;
- [SetterMayThrowLegacyException] attribute unrestricted double maxDecibels;
</del><ins>+ [SetterMayThrowException] attribute unrestricted double minDecibels;
+ [SetterMayThrowException] attribute unrestricted double maxDecibels;
</ins><span class="cx">
</span><span class="cx"> // A value from 0.0 -> 1.0 where 0.0 represents no time averaging with the last analysis frame.
</span><del>- [SetterMayThrowLegacyException] attribute unrestricted double smoothingTimeConstant;
</del><ins>+ [SetterMayThrowException] attribute unrestricted double smoothingTimeConstant;
</ins><span class="cx">
</span><span class="cx"> // Copies the current frequency data into the passed array.
</span><span class="cx"> // If the array has fewer elements than the frequencyBinCount, the excess elements will be dropped.
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebaudioAudioBasicInspectorNodecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webaudio/AudioBasicInspectorNode.cpp (207049 => 207050)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webaudio/AudioBasicInspectorNode.cpp        2016-10-11 06:19:02 UTC (rev 207049)
+++ trunk/Source/WebCore/Modules/webaudio/AudioBasicInspectorNode.cpp        2016-10-11 06:23:49 UTC (rev 207050)
</span><span class="lines">@@ -28,7 +28,6 @@
</span><span class="cx">
</span><span class="cx"> #include "AudioBasicInspectorNode.h"
</span><span class="cx">
</span><del>-#include "AudioContext.h"
</del><span class="cx"> #include "AudioNodeInput.h"
</span><span class="cx"> #include "AudioNodeOutput.h"
</span><span class="cx">
</span><span class="lines">@@ -36,7 +35,6 @@
</span><span class="cx">
</span><span class="cx"> AudioBasicInspectorNode::AudioBasicInspectorNode(AudioContext& context, float sampleRate, unsigned outputChannelCount)
</span><span class="cx"> : AudioNode(context, sampleRate)
</span><del>- , m_needAutomaticPull(false)
</del><span class="cx"> {
</span><span class="cx"> addInput(std::make_unique<AudioNodeInput>(this));
</span><span class="cx"> addOutput(std::make_unique<AudioNodeOutput>(this, outputChannelCount));
</span><span class="lines">@@ -51,24 +49,26 @@
</span><span class="cx"> input(0)->pull(output(0)->bus(), framesToProcess);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void AudioBasicInspectorNode::connect(AudioNode* destination, unsigned outputIndex, unsigned inputIndex, ExceptionCode& ec)
</del><ins>+ExceptionOr<void> AudioBasicInspectorNode::connect(AudioNode* destination, unsigned outputIndex, unsigned inputIndex)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(isMainThread());
</span><span class="cx">
</span><span class="cx"> AudioContext::AutoLocker locker(context());
</span><span class="cx">
</span><del>- AudioNode::connect(destination, outputIndex, inputIndex, ec);
</del><ins>+ auto result = AudioNode::connect(destination, outputIndex, inputIndex);
</ins><span class="cx"> updatePullStatus();
</span><ins>+ return result;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void AudioBasicInspectorNode::disconnect(unsigned outputIndex, ExceptionCode& ec)
</del><ins>+ExceptionOr<void> AudioBasicInspectorNode::disconnect(unsigned outputIndex)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(isMainThread());
</span><span class="cx">
</span><span class="cx"> AudioContext::AutoLocker locker(context());
</span><span class="cx">
</span><del>- AudioNode::disconnect(outputIndex, ec);
</del><ins>+ auto result = AudioNode::disconnect(outputIndex);
</ins><span class="cx"> updatePullStatus();
</span><ins>+ return result;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void AudioBasicInspectorNode::checkNumberOfChannelsForInput(AudioNodeInput* input)
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebaudioAudioBasicInspectorNodeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webaudio/AudioBasicInspectorNode.h (207049 => 207050)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webaudio/AudioBasicInspectorNode.h        2016-10-11 06:19:02 UTC (rev 207049)
+++ trunk/Source/WebCore/Modules/webaudio/AudioBasicInspectorNode.h        2016-10-11 06:23:49 UTC (rev 207050)
</span><span class="lines">@@ -22,8 +22,7 @@
</span><span class="cx"> * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><del>-#ifndef AudioBasicInspectorNode_h
-#define AudioBasicInspectorNode_h
</del><ins>+#pragma once
</ins><span class="cx">
</span><span class="cx"> #include "AudioNode.h"
</span><span class="cx">
</span><span class="lines">@@ -36,17 +35,15 @@
</span><span class="cx"> public:
</span><span class="cx"> AudioBasicInspectorNode(AudioContext&, float sampleRate, unsigned outputChannelCount);
</span><span class="cx">
</span><del>- // AudioNode
</del><ins>+private:
</ins><span class="cx"> void pullInputs(size_t framesToProcess) override;
</span><del>- void connect(AudioNode*, unsigned outputIndex, unsigned inputIndex, ExceptionCode&) override;
- void disconnect(unsigned outputIndex, ExceptionCode&) override;
</del><ins>+ ExceptionOr<void> connect(AudioNode*, unsigned outputIndex, unsigned inputIndex) override;
+ ExceptionOr<void> disconnect(unsigned outputIndex) override;
</ins><span class="cx"> void checkNumberOfChannelsForInput(AudioNodeInput*) override;
</span><span class="cx">
</span><del>-private:
</del><span class="cx"> void updatePullStatus();
</span><del>- bool m_needAutomaticPull; // When setting to true, AudioBasicInspectorNode will be pulled automaticlly by AudioContext before the end of each render quantum.
</del><ins>+
+ bool m_needAutomaticPull { false }; // When setting to true, AudioBasicInspectorNode will be pulled automatically by AudioContext before the end of each render quantum.
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span><del>-
-#endif // AudioBasicInspectorNode_h
</del></span></pre></div>
<a id="trunkSourceWebCoreModuleswebaudioAudioBuffercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webaudio/AudioBuffer.cpp (207049 => 207050)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webaudio/AudioBuffer.cpp        2016-10-11 06:19:02 UTC (rev 207049)
+++ trunk/Source/WebCore/Modules/webaudio/AudioBuffer.cpp        2016-10-11 06:23:49 UTC (rev 207050)
</span><span class="lines">@@ -32,12 +32,8 @@
</span><span class="cx">
</span><span class="cx"> #include "AudioBuffer.h"
</span><span class="cx">
</span><del>-#include "AudioBus.h"
</del><span class="cx"> #include "AudioContext.h"
</span><span class="cx"> #include "AudioFileReader.h"
</span><del>-#include "ExceptionCode.h"
-#include "ExceptionCodePlaceholder.h"
-
</del><span class="cx"> #include <runtime/JSCInlines.h>
</span><span class="cx"> #include <runtime/TypedArrayInlines.h>
</span><span class="cx">
</span><span class="lines">@@ -47,7 +43,6 @@
</span><span class="cx"> {
</span><span class="cx"> if (sampleRate < 22050 || sampleRate > 96000 || numberOfChannels > AudioContext::maxNumberOfChannels() || !numberOfFrames)
</span><span class="cx"> return nullptr;
</span><del>-
</del><span class="cx"> return adoptRef(*new AudioBuffer(numberOfChannels, numberOfFrames, sampleRate));
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -54,15 +49,13 @@
</span><span class="cx"> RefPtr<AudioBuffer> AudioBuffer::createFromAudioFileData(const void* data, size_t dataSize, bool mixToMono, float sampleRate)
</span><span class="cx"> {
</span><span class="cx"> RefPtr<AudioBus> bus = createBusFromInMemoryAudioFile(data, dataSize, mixToMono, sampleRate);
</span><del>- if (bus.get())
- return adoptRef(*new AudioBuffer(bus.get()));
-
- return nullptr;
</del><ins>+ if (!bus)
+ return nullptr;
+ return adoptRef(*new AudioBuffer(*bus));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> AudioBuffer::AudioBuffer(unsigned numberOfChannels, size_t numberOfFrames, float sampleRate)
</span><del>- : m_gain(1.0)
- , m_sampleRate(sampleRate)
</del><ins>+ : m_sampleRate(sampleRate)
</ins><span class="cx"> , m_length(numberOfFrames)
</span><span class="cx"> {
</span><span class="cx"> m_channels.reserveCapacity(numberOfChannels);
</span><span class="lines">@@ -74,19 +67,18 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-AudioBuffer::AudioBuffer(AudioBus* bus)
- : m_gain(1.0)
- , m_sampleRate(bus->sampleRate())
- , m_length(bus->length())
</del><ins>+AudioBuffer::AudioBuffer(AudioBus& bus)
+ : m_sampleRate(bus.sampleRate())
+ , m_length(bus.length())
</ins><span class="cx"> {
</span><span class="cx"> // Copy audio data from the bus to the Float32Arrays we manage.
</span><del>- unsigned numberOfChannels = bus->numberOfChannels();
</del><ins>+ unsigned numberOfChannels = bus.numberOfChannels();
</ins><span class="cx"> m_channels.reserveCapacity(numberOfChannels);
</span><span class="cx"> for (unsigned i = 0; i < numberOfChannels; ++i) {
</span><del>- RefPtr<Float32Array> channelDataArray = Float32Array::create(m_length);
</del><ins>+ auto channelDataArray = Float32Array::create(m_length);
</ins><span class="cx"> channelDataArray->setNeuterable(false);
</span><del>- channelDataArray->setRange(bus->channel(i)->data(), m_length, 0);
- m_channels.append(channelDataArray);
</del><ins>+ channelDataArray->setRange(bus.channel(i)->data(), m_length, 0);
+ m_channels.append(WTFMove(channelDataArray));
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -95,31 +87,27 @@
</span><span class="cx"> m_channels.clear();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<Float32Array> AudioBuffer::getChannelData(unsigned channelIndex, ExceptionCode& ec)
</del><ins>+ExceptionOr<Ref<Float32Array>> AudioBuffer::getChannelData(unsigned channelIndex)
</ins><span class="cx"> {
</span><del>- if (channelIndex >= m_channels.size()) {
- ec = SYNTAX_ERR;
- return nullptr;
- }
-
- Float32Array* channelData = m_channels[channelIndex].get();
- return Float32Array::create(channelData->buffer(), channelData->byteOffset(), channelData->length());
</del><ins>+ if (channelIndex >= m_channels.size())
+ return Exception { SYNTAX_ERR };
+ auto& channelData = *m_channels[channelIndex];
+ auto array = Float32Array::create(channelData.buffer(), channelData.byteOffset(), channelData.length());
+ RELEASE_ASSERT(array);
+ return array.releaseNonNull();
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-Float32Array* AudioBuffer::getChannelData(unsigned channelIndex)
</del><ins>+Float32Array* AudioBuffer::channelData(unsigned channelIndex)
</ins><span class="cx"> {
</span><span class="cx"> if (channelIndex >= m_channels.size())
</span><span class="cx"> return nullptr;
</span><del>-
</del><span class="cx"> return m_channels[channelIndex].get();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void AudioBuffer::zero()
</span><span class="cx"> {
</span><del>- for (unsigned i = 0; i < m_channels.size(); ++i) {
- if (getChannelData(i))
- getChannelData(i)->zeroRange(0, length());
- }
</del><ins>+ for (auto& channel : m_channels)
+ channel->zeroRange(0, length());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> size_t AudioBuffer::memoryCost() const
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebaudioAudioBufferh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webaudio/AudioBuffer.h (207049 => 207050)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webaudio/AudioBuffer.h        2016-10-11 06:19:02 UTC (rev 207049)
+++ trunk/Source/WebCore/Modules/webaudio/AudioBuffer.h        2016-10-11 06:23:49 UTC (rev 207050)
</span><span class="lines">@@ -26,12 +26,10 @@
</span><span class="cx"> * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><del>-#ifndef AudioBuffer_h
-#define AudioBuffer_h
</del><ins>+#pragma once
</ins><span class="cx">
</span><ins>+#include "ExceptionOr.h"
</ins><span class="cx"> #include <runtime/Float32Array.h>
</span><del>-#include <wtf/RefCounted.h>
-#include <wtf/RefPtr.h>
</del><span class="cx"> #include <wtf/Vector.h>
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -38,13 +36,11 @@
</span><span class="cx">
</span><span class="cx"> class AudioBus;
</span><span class="cx">
</span><del>-typedef int ExceptionCode;
-
</del><span class="cx"> class AudioBuffer : public RefCounted<AudioBuffer> {
</span><span class="cx"> public:
</span><span class="cx"> static RefPtr<AudioBuffer> create(unsigned numberOfChannels, size_t numberOfFrames, float sampleRate);
</span><span class="cx">
</span><del>- // Returns 0 if data is not a valid audio file.
</del><ins>+ // Returns nullptr if data is not a valid audio file.
</ins><span class="cx"> static RefPtr<AudioBuffer> createFromAudioFileData(const void* data, size_t dataSize, bool mixToMono, float sampleRate);
</span><span class="cx">
</span><span class="cx"> // Format
</span><span class="lines">@@ -54,8 +50,8 @@
</span><span class="cx">
</span><span class="cx"> // Channel data access
</span><span class="cx"> unsigned numberOfChannels() const { return m_channels.size(); }
</span><del>- RefPtr<Float32Array> getChannelData(unsigned channelIndex, ExceptionCode&);
- Float32Array* getChannelData(unsigned channelIndex);
</del><ins>+ ExceptionOr<Ref<Float32Array>> getChannelData(unsigned channelIndex);
+ Float32Array* channelData(unsigned channelIndex);
</ins><span class="cx"> void zero();
</span><span class="cx">
</span><span class="cx"> // Scalar gain
</span><span class="lines">@@ -62,7 +58,7 @@
</span><span class="cx"> double gain() const { return m_gain; }
</span><span class="cx"> void setGain(double gain) { m_gain = gain; }
</span><span class="cx">
</span><del>- // Because an AudioBuffer has a JavaScript wrapper, which will be garbage collected, it may take awhile for this object to be deleted.
</del><ins>+ // Because an AudioBuffer has a JavaScript wrapper, which will be garbage collected, it may take a while for this object to be deleted.
</ins><span class="cx"> // releaseMemory() can be called when the AudioContext goes away, so we can release the memory earlier than when the garbage collection happens.
</span><span class="cx"> // Careful! Only call this when the page unloads, after the AudioContext is no longer processing.
</span><span class="cx"> void releaseMemory();
</span><span class="lines">@@ -69,17 +65,14 @@
</span><span class="cx">
</span><span class="cx"> size_t memoryCost() const;
</span><span class="cx">
</span><del>-protected:
</del><ins>+private:
</ins><span class="cx"> AudioBuffer(unsigned numberOfChannels, size_t numberOfFrames, float sampleRate);
</span><del>- explicit AudioBuffer(AudioBus*);
</del><ins>+ explicit AudioBuffer(AudioBus&);
</ins><span class="cx">
</span><del>- double m_gain; // scalar gain
</del><ins>+ double m_gain { 1.0 }; // scalar gain
</ins><span class="cx"> float m_sampleRate;
</span><span class="cx"> size_t m_length;
</span><del>-
</del><span class="cx"> Vector<RefPtr<Float32Array>> m_channels;
</span><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span><del>-
-#endif // AudioBuffer_h
</del></span></pre></div>
<a id="trunkSourceWebCoreModuleswebaudioAudioBufferidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webaudio/AudioBuffer.idl (207049 => 207050)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webaudio/AudioBuffer.idl        2016-10-11 06:19:02 UTC (rev 207049)
+++ trunk/Source/WebCore/Modules/webaudio/AudioBuffer.idl        2016-10-11 06:23:49 UTC (rev 207050)
</span><span class="lines">@@ -39,5 +39,5 @@
</span><span class="cx">
</span><span class="cx"> // Channel access
</span><span class="cx"> readonly attribute unsigned long numberOfChannels;
</span><del>- [MayThrowLegacyException] Float32Array getChannelData(unsigned long channelIndex);
</del><ins>+ [MayThrowException] Float32Array getChannelData(unsigned long channelIndex);
</ins><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebaudioAudioBufferSourceNodecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.cpp (207049 => 207050)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.cpp        2016-10-11 06:19:02 UTC (rev 207049)
+++ trunk/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.cpp        2016-10-11 06:23:49 UTC (rev 207050)
</span><span class="lines">@@ -28,17 +28,14 @@
</span><span class="cx">
</span><span class="cx"> #include "AudioBufferSourceNode.h"
</span><span class="cx">
</span><ins>+#include "AudioBuffer.h"
</ins><span class="cx"> #include "AudioContext.h"
</span><span class="cx"> #include "AudioNodeOutput.h"
</span><ins>+#include "AudioParam.h"
</ins><span class="cx"> #include "AudioUtilities.h"
</span><span class="cx"> #include "FloatConversion.h"
</span><del>-#include "ScriptController.h"
</del><ins>+#include "PannerNode.h"
</ins><span class="cx"> #include "ScriptExecutionContext.h"
</span><del>-#include <algorithm>
-#include <inspector/ScriptCallStack.h>
-#include <wtf/MainThread.h>
-#include <wtf/MathExtras.h>
-#include <wtf/StdLibExtras.h>
</del><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="lines">@@ -86,10 +83,10 @@
</span><span class="cx">
</span><span class="cx"> void AudioBufferSourceNode::process(size_t framesToProcess)
</span><span class="cx"> {
</span><del>- AudioBus* outputBus = output(0)->bus();
</del><ins>+ auto& outputBus = *output(0)->bus();
</ins><span class="cx">
</span><span class="cx"> if (!isInitialized()) {
</span><del>- outputBus->zero();
</del><ins>+ outputBus.zero();
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -97,12 +94,12 @@
</span><span class="cx"> std::unique_lock<Lock> lock(m_processMutex, std::try_to_lock);
</span><span class="cx"> if (!lock.owns_lock()) {
</span><span class="cx"> // Too bad - the try_lock() failed. We must be in the middle of changing buffers and were already outputting silence anyway.
</span><del>- outputBus->zero();
</del><ins>+ outputBus.zero();
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (!buffer()) {
</span><del>- outputBus->zero();
</del><ins>+ outputBus.zero();
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -110,33 +107,32 @@
</span><span class="cx"> // before the output bus is updated to the new number of channels because of use of tryLocks() in the context's updating system.
</span><span class="cx"> // In this case, if the the buffer has just been changed and we're not quite ready yet, then just output silence.
</span><span class="cx"> if (numberOfChannels() != buffer()->numberOfChannels()) {
</span><del>- outputBus->zero();
</del><ins>+ outputBus.zero();
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> size_t quantumFrameOffset;
</span><span class="cx"> size_t bufferFramesToProcess;
</span><del>-
</del><span class="cx"> updateSchedulingInfo(framesToProcess, outputBus, quantumFrameOffset, bufferFramesToProcess);
</span><span class="cx">
</span><span class="cx"> if (!bufferFramesToProcess) {
</span><del>- outputBus->zero();
</del><ins>+ outputBus.zero();
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- for (unsigned i = 0; i < outputBus->numberOfChannels(); ++i)
- m_destinationChannels[i] = outputBus->channel(i)->mutableData();
</del><ins>+ for (unsigned i = 0; i < outputBus.numberOfChannels(); ++i)
+ m_destinationChannels[i] = outputBus.channel(i)->mutableData();
</ins><span class="cx">
</span><span class="cx"> // Render by reading directly from the buffer.
</span><del>- if (!renderFromBuffer(outputBus, quantumFrameOffset, bufferFramesToProcess)) {
- outputBus->zero();
</del><ins>+ if (!renderFromBuffer(&outputBus, quantumFrameOffset, bufferFramesToProcess)) {
+ outputBus.zero();
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // Apply the gain (in-place) to the output bus.
</span><span class="cx"> float totalGain = gain()->value() * m_buffer->gain();
</span><del>- outputBus->copyWithGainFrom(*outputBus, &m_lastGain, totalGain);
- outputBus->clearSilentFlag();
</del><ins>+ outputBus.copyWithGainFrom(outputBus, &m_lastGain, totalGain);
+ outputBus.clearSilentFlag();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // Returns true if we're finished.
</span><span class="lines">@@ -429,7 +425,7 @@
</span><span class="cx"> m_destinationChannels = std::make_unique<float*[]>(numberOfChannels);
</span><span class="cx">
</span><span class="cx"> for (unsigned i = 0; i < numberOfChannels; ++i)
</span><del>- m_sourceChannels[i] = buffer->getChannelData(i)->data();
</del><ins>+ m_sourceChannels[i] = buffer->channelData(i)->data();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> m_virtualReadIndex = 0;
</span><span class="lines">@@ -441,7 +437,7 @@
</span><span class="cx"> return output(0)->numberOfChannels();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void AudioBufferSourceNode::start(double when, double grainOffset, Optional<double> optionalGrainDuration, ExceptionCode& ec)
</del><ins>+ExceptionOr<void> AudioBufferSourceNode::start(double when, double grainOffset, Optional<double> optionalGrainDuration)
</ins><span class="cx"> {
</span><span class="cx"> double grainDuration = 0;
</span><span class="cx"> if (optionalGrainDuration)
</span><span class="lines">@@ -449,37 +445,29 @@
</span><span class="cx"> else if (buffer())
</span><span class="cx"> grainDuration = buffer()->duration() - grainOffset;
</span><span class="cx">
</span><del>- startPlaying(Partial, when, grainOffset, grainDuration, ec);
</del><ins>+ return startPlaying(Partial, when, grainOffset, grainDuration);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void AudioBufferSourceNode::startPlaying(BufferPlaybackMode playbackMode, double when, double grainOffset, double grainDuration, ExceptionCode& ec)
</del><ins>+ExceptionOr<void> AudioBufferSourceNode::startPlaying(BufferPlaybackMode playbackMode, double when, double grainOffset, double grainDuration)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(isMainThread());
</span><span class="cx">
</span><span class="cx"> context().nodeWillBeginPlayback();
</span><span class="cx">
</span><del>- if (m_playbackState != UNSCHEDULED_STATE) {
- ec = INVALID_STATE_ERR;
- return;
- }
</del><ins>+ if (m_playbackState != UNSCHEDULED_STATE)
+ return Exception { INVALID_STATE_ERR };
</ins><span class="cx">
</span><del>- if (!std::isfinite(when) || (when < 0)) {
- ec = INVALID_STATE_ERR;
- return;
- }
</del><ins>+ if (!std::isfinite(when) || (when < 0))
+ return Exception { INVALID_STATE_ERR };
</ins><span class="cx">
</span><del>- if (!std::isfinite(grainOffset) || (grainOffset < 0)) {
- ec = INVALID_STATE_ERR;
- return;
- }
</del><ins>+ if (!std::isfinite(grainOffset) || (grainOffset < 0))
+ return Exception { INVALID_STATE_ERR };
</ins><span class="cx">
</span><del>- if (!std::isfinite(grainDuration) || (grainDuration < 0)) {
- ec = INVALID_STATE_ERR;
- return;
- }
</del><ins>+ if (!std::isfinite(grainDuration) || (grainDuration < 0))
+ return Exception { INVALID_STATE_ERR };
</ins><span class="cx">
</span><span class="cx"> if (!buffer())
</span><del>- return;
</del><ins>+ return { };
</ins><span class="cx">
</span><span class="cx"> m_isGrain = playbackMode == Partial;
</span><span class="cx"> if (m_isGrain) {
</span><span class="lines">@@ -507,6 +495,8 @@
</span><span class="cx"> m_virtualReadIndex = AudioUtilities::timeToSampleFrame(m_grainOffset, buffer()->sampleRate());
</span><span class="cx">
</span><span class="cx"> m_playbackState = SCHEDULED_STATE;
</span><ins>+
+ return { };
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> double AudioBufferSourceNode::totalPitchRate()
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebaudioAudioBufferSourceNodeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.h (207049 => 207050)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.h        2016-10-11 06:19:02 UTC (rev 207049)
+++ trunk/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.h        2016-10-11 06:23:49 UTC (rev 207050)
</span><span class="lines">@@ -22,27 +22,20 @@
</span><span class="cx"> * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><del>-#ifndef AudioBufferSourceNode_h
-#define AudioBufferSourceNode_h
</del><ins>+#pragma once
</ins><span class="cx">
</span><del>-#include "AudioBuffer.h"
-#include "AudioBus.h"
-#include "AudioParam.h"
</del><span class="cx"> #include "AudioScheduledSourceNode.h"
</span><del>-#include "ExceptionCode.h"
-#include "PannerNode.h"
-#include <memory>
</del><span class="cx"> #include <wtf/Lock.h>
</span><del>-#include <wtf/RefPtr.h>
</del><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-class AudioContext;
</del><ins>+class AudioBuffer;
+class PannerNode;
</ins><span class="cx">
</span><span class="cx"> // AudioBufferSourceNode is an AudioNode representing an audio source from an in-memory audio asset represented by an AudioBuffer.
</span><span class="cx"> // It generally will be used for short sounds which require a high degree of scheduling flexibility (can playback in rhythmically perfect ways).
</span><span class="cx">
</span><del>-class AudioBufferSourceNode : public AudioScheduledSourceNode {
</del><ins>+class AudioBufferSourceNode final : public AudioScheduledSourceNode {
</ins><span class="cx"> public:
</span><span class="cx"> static Ref<AudioBufferSourceNode> create(AudioContext&, float sampleRate);
</span><span class="cx">
</span><span class="lines">@@ -49,8 +42,8 @@
</span><span class="cx"> virtual ~AudioBufferSourceNode();
</span><span class="cx">
</span><span class="cx"> // AudioNode
</span><del>- void process(size_t framesToProcess) override;
- void reset() override;
</del><ins>+ void process(size_t framesToProcess) final;
+ void reset() final;
</ins><span class="cx">
</span><span class="cx"> // setBuffer() is called on the main thread. This is the buffer we use for playback.
</span><span class="cx"> // returns true on success.
</span><span class="lines">@@ -62,7 +55,7 @@
</span><span class="cx"> unsigned numberOfChannels();
</span><span class="cx">
</span><span class="cx"> // Play-state
</span><del>- void start(double when, double grainOffset, Optional<double> grainDuration, ExceptionCode&);
</del><ins>+ ExceptionOr<void> start(double when, double grainOffset, Optional<double> grainDuration);
</ins><span class="cx">
</span><span class="cx"> // Note: the attribute was originally exposed as .looping, but to be more consistent in naming with <audio>
</span><span class="cx"> // and with how it's described in the specification, the proper attribute name is .loop
</span><span class="lines">@@ -88,16 +81,16 @@
</span><span class="cx"> void clearPannerNode();
</span><span class="cx">
</span><span class="cx"> // If we are no longer playing, propogate silence ahead to downstream nodes.
</span><del>- bool propagatesSilence() const override;
</del><ins>+ bool propagatesSilence() const final;
</ins><span class="cx">
</span><span class="cx"> // AudioScheduledSourceNode
</span><del>- void finish() override;
</del><ins>+ void finish() final;
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> AudioBufferSourceNode(AudioContext&, float sampleRate);
</span><span class="cx">
</span><del>- double tailTime() const override { return 0; }
- double latencyTime() const override { return 0; }
</del><ins>+ double tailTime() const final { return 0; }
+ double latencyTime() const final { return 0; }
</ins><span class="cx">
</span><span class="cx"> enum BufferPlaybackMode {
</span><span class="cx"> Entire,
</span><span class="lines">@@ -104,7 +97,7 @@
</span><span class="cx"> Partial
</span><span class="cx"> };
</span><span class="cx">
</span><del>- void startPlaying(BufferPlaybackMode, double when, double grainOffset, double grainDuration, ExceptionCode&);
</del><ins>+ ExceptionOr<void> startPlaying(BufferPlaybackMode, double when, double grainOffset, double grainDuration);
</ins><span class="cx">
</span><span class="cx"> // Returns true on success.
</span><span class="cx"> bool renderFromBuffer(AudioBus*, unsigned destinationFrameOffset, size_t numberOfFrames);
</span><span class="lines">@@ -155,5 +148,3 @@
</span><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span><del>-
-#endif // AudioBufferSourceNode_h
</del></span></pre></div>
<a id="trunkSourceWebCoreModuleswebaudioAudioBufferSourceNodeidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.idl (207049 => 207050)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.idl        2016-10-11 06:19:02 UTC (rev 207049)
+++ trunk/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.idl        2016-10-11 06:23:49 UTC (rev 207050)
</span><span class="lines">@@ -44,8 +44,8 @@
</span><span class="cx"> attribute unrestricted double loopStart;
</span><span class="cx"> attribute unrestricted double loopEnd;
</span><span class="cx">
</span><del>- [MayThrowLegacyException] void start(optional unrestricted double when = 0, optional unrestricted double grainOffset = 0, optional unrestricted double grainDuration);
- [MayThrowLegacyException] void stop(optional unrestricted double when = 0);
</del><ins>+ [MayThrowException] void start(optional unrestricted double when = 0, optional unrestricted double grainOffset = 0, optional unrestricted double grainDuration);
+ [MayThrowException] void stop(optional unrestricted double when = 0);
</ins><span class="cx">
</span><span class="cx"> attribute EventHandler onended;
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebaudioAudioContextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp (207049 => 207050)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp        2016-10-11 06:19:02 UTC (rev 207049)
+++ trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp        2016-10-11 06:23:49 UTC (rev 207050)
</span><span class="lines">@@ -365,26 +365,20 @@
</span><span class="cx"> return emptyString();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<AudioBuffer> AudioContext::createBuffer(unsigned numberOfChannels, size_t numberOfFrames, float sampleRate, ExceptionCode& ec)
</del><ins>+ExceptionOr<Ref<AudioBuffer>> AudioContext::createBuffer(unsigned numberOfChannels, size_t numberOfFrames, float sampleRate)
</ins><span class="cx"> {
</span><del>- RefPtr<AudioBuffer> audioBuffer = AudioBuffer::create(numberOfChannels, numberOfFrames, sampleRate);
- if (!audioBuffer) {
- ec = NOT_SUPPORTED_ERR;
- return nullptr;
- }
-
- return audioBuffer;
</del><ins>+ auto audioBuffer = AudioBuffer::create(numberOfChannels, numberOfFrames, sampleRate);
+ if (!audioBuffer)
+ return Exception { NOT_SUPPORTED_ERR };
+ return audioBuffer.releaseNonNull();
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<AudioBuffer> AudioContext::createBuffer(ArrayBuffer& arrayBuffer, bool mixToMono, ExceptionCode& ec)
</del><ins>+ExceptionOr<Ref<AudioBuffer>> AudioContext::createBuffer(ArrayBuffer& arrayBuffer, bool mixToMono)
</ins><span class="cx"> {
</span><del>- RefPtr<AudioBuffer> audioBuffer = AudioBuffer::createFromAudioFileData(arrayBuffer.data(), arrayBuffer.byteLength(), mixToMono, sampleRate());
- if (!audioBuffer) {
- ec = SYNTAX_ERR;
- return nullptr;
- }
-
- return audioBuffer;
</del><ins>+ auto audioBuffer = AudioBuffer::createFromAudioFileData(arrayBuffer.data(), arrayBuffer.byteLength(), mixToMono, sampleRate());
+ if (!audioBuffer)
+ return Exception { SYNTAX_ERR };
+ return audioBuffer.releaseNonNull();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void AudioContext::decodeAudioData(Ref<ArrayBuffer>&& audioData, RefPtr<AudioBufferCallback>&& successCallback, RefPtr<AudioBufferCallback>&& errorCallback)
</span><span class="lines">@@ -406,36 +400,34 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #if ENABLE(VIDEO)
</span><del>-RefPtr<MediaElementAudioSourceNode> AudioContext::createMediaElementSource(HTMLMediaElement& mediaElement, ExceptionCode& ec)
</del><ins>+
+ExceptionOr<Ref<MediaElementAudioSourceNode>> AudioContext::createMediaElementSource(HTMLMediaElement& mediaElement)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(isMainThread());
</span><span class="cx"> lazyInitialize();
</span><span class="cx">
</span><del>- // First check if this media element already has a source node.
- if (mediaElement.audioSourceNode()) {
- ec = INVALID_STATE_ERR;
- return nullptr;
- }
-
- Ref<MediaElementAudioSourceNode> node = MediaElementAudioSourceNode::create(*this, mediaElement);
</del><ins>+ if (mediaElement.audioSourceNode())
+ return Exception { INVALID_STATE_ERR };
</ins><span class="cx">
</span><ins>+ auto node = MediaElementAudioSourceNode::create(*this, mediaElement);
+
</ins><span class="cx"> mediaElement.setAudioSourceNode(node.ptr());
</span><span class="cx">
</span><span class="cx"> refNode(node.get()); // context keeps reference until node is disconnected
</span><span class="cx"> return WTFMove(node);
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> #if ENABLE(MEDIA_STREAM)
</span><del>-RefPtr<MediaStreamAudioSourceNode> AudioContext::createMediaStreamSource(MediaStream& mediaStream, ExceptionCode& ec)
</del><ins>+
+ExceptionOr<Ref<MediaStreamAudioSourceNode>> AudioContext::createMediaStreamSource(MediaStream& mediaStream)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(isMainThread());
</span><span class="cx">
</span><span class="cx"> auto audioTracks = mediaStream.getAudioTracks();
</span><del>- if (audioTracks.isEmpty()) {
- ec = INVALID_STATE_ERR;
- return nullptr;
- }
</del><ins>+ if (audioTracks.isEmpty())
+ return Exception { INVALID_STATE_ERR };
</ins><span class="cx">
</span><span class="cx"> MediaStreamTrack* providerTrack = nullptr;
</span><span class="cx"> for (auto& track : audioTracks) {
</span><span class="lines">@@ -444,12 +436,9 @@
</span><span class="cx"> break;
</span><span class="cx"> }
</span><span class="cx"> }
</span><ins>+ if (!providerTrack)
+ return Exception { INVALID_STATE_ERR };
</ins><span class="cx">
</span><del>- if (!providerTrack) {
- ec = INVALID_STATE_ERR;
- return nullptr;
- }
-
</del><span class="cx"> lazyInitialize();
</span><span class="cx">
</span><span class="cx"> auto node = MediaStreamAudioSourceNode::create(*this, mediaStream, *providerTrack);
</span><span class="lines">@@ -468,19 +457,17 @@
</span><span class="cx">
</span><span class="cx"> #endif
</span><span class="cx">
</span><del>-RefPtr<ScriptProcessorNode> AudioContext::createScriptProcessor(size_t bufferSize, size_t numberOfInputChannels, size_t numberOfOutputChannels, ExceptionCode& ec)
</del><ins>+ExceptionOr<Ref<ScriptProcessorNode>> AudioContext::createScriptProcessor(size_t bufferSize, size_t numberOfInputChannels, size_t numberOfOutputChannels)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(isMainThread());
</span><span class="cx"> lazyInitialize();
</span><del>- RefPtr<ScriptProcessorNode> node = ScriptProcessorNode::create(*this, m_destinationNode->sampleRate(), bufferSize, numberOfInputChannels, numberOfOutputChannels);
</del><ins>+ auto node = ScriptProcessorNode::create(*this, m_destinationNode->sampleRate(), bufferSize, numberOfInputChannels, numberOfOutputChannels);
</ins><span class="cx">
</span><del>- if (!node) {
- ec = INDEX_SIZE_ERR;
- return nullptr;
- }
</del><ins>+ if (!node)
+ return Exception { INDEX_SIZE_ERR };
</ins><span class="cx">
</span><span class="cx"> refNode(*node); // context keeps reference until we stop making javascript rendering callbacks
</span><del>- return node;
</del><ins>+ return node.releaseNonNull();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Ref<BiquadFilterNode> AudioContext::createBiquadFilter()
</span><span class="lines">@@ -532,44 +519,31 @@
</span><span class="cx"> return GainNode::create(*this, m_destinationNode->sampleRate());
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<DelayNode> AudioContext::createDelay(double maxDelayTime, ExceptionCode& ec)
</del><ins>+ExceptionOr<Ref<DelayNode>> AudioContext::createDelay(double maxDelayTime)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(isMainThread());
</span><span class="cx"> lazyInitialize();
</span><del>- Ref<DelayNode> node = DelayNode::create(*this, m_destinationNode->sampleRate(), maxDelayTime, ec);
- if (ec)
- return nullptr;
- return WTFMove(node);
</del><ins>+ return DelayNode::create(*this, m_destinationNode->sampleRate(), maxDelayTime);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<ChannelSplitterNode> AudioContext::createChannelSplitter(size_t numberOfOutputs, ExceptionCode& ec)
</del><ins>+ExceptionOr<Ref<ChannelSplitterNode>> AudioContext::createChannelSplitter(size_t numberOfOutputs)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(isMainThread());
</span><span class="cx"> lazyInitialize();
</span><del>-
- RefPtr<ChannelSplitterNode> node = ChannelSplitterNode::create(*this, m_destinationNode->sampleRate(), numberOfOutputs);
-
- if (!node) {
- ec = INDEX_SIZE_ERR;
- return nullptr;
- }
-
- return node;
</del><ins>+ auto node = ChannelSplitterNode::create(*this, m_destinationNode->sampleRate(), numberOfOutputs);
+ if (!node)
+ return Exception { INDEX_SIZE_ERR };
+ return node.releaseNonNull();
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<ChannelMergerNode> AudioContext::createChannelMerger(size_t numberOfInputs, ExceptionCode& ec)
</del><ins>+ExceptionOr<Ref<ChannelMergerNode>> AudioContext::createChannelMerger(size_t numberOfInputs)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(isMainThread());
</span><span class="cx"> lazyInitialize();
</span><del>-
- RefPtr<ChannelMergerNode> node = ChannelMergerNode::create(*this, m_destinationNode->sampleRate(), numberOfInputs);
-
- if (!node) {
- ec = INDEX_SIZE_ERR;
- return nullptr;
- }
-
- return node;
</del><ins>+ auto node = ChannelMergerNode::create(*this, m_destinationNode->sampleRate(), numberOfInputs);
+ if (!node)
+ return Exception { INDEX_SIZE_ERR };
+ return node.releaseNonNull();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Ref<OscillatorNode> AudioContext::createOscillator()
</span><span class="lines">@@ -586,15 +560,11 @@
</span><span class="cx"> return node;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<PeriodicWave> AudioContext::createPeriodicWave(Float32Array& real, Float32Array& imaginary, ExceptionCode& ec)
</del><ins>+ExceptionOr<Ref<PeriodicWave>> AudioContext::createPeriodicWave(Float32Array& real, Float32Array& imaginary)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(isMainThread());
</span><del>-
- if (real.length() != imaginary.length() || (real.length() > MaxPeriodicWaveLength) || !real.length()) {
- ec = INDEX_SIZE_ERR;
- return nullptr;
- }
-
</del><ins>+ if (real.length() != imaginary.length() || (real.length() > MaxPeriodicWaveLength) || !real.length())
+ return Exception { INDEX_SIZE_ERR };
</ins><span class="cx"> lazyInitialize();
</span><span class="cx"> return PeriodicWave::create(sampleRate(), real, imaginary);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebaudioAudioContexth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webaudio/AudioContext.h (207049 => 207050)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webaudio/AudioContext.h        2016-10-11 06:19:02 UTC (rev 207049)
+++ trunk/Source/WebCore/Modules/webaudio/AudioContext.h        2016-10-11 06:23:49 UTC (rev 207050)
</span><span class="lines">@@ -98,8 +98,8 @@
</span><span class="cx"> void incrementActiveSourceCount();
</span><span class="cx"> void decrementActiveSourceCount();
</span><span class="cx">
</span><del>- RefPtr<AudioBuffer> createBuffer(unsigned numberOfChannels, size_t numberOfFrames, float sampleRate, ExceptionCode&);
- RefPtr<AudioBuffer> createBuffer(ArrayBuffer&, bool mixToMono, ExceptionCode&);
</del><ins>+ ExceptionOr<Ref<AudioBuffer>> createBuffer(unsigned numberOfChannels, size_t numberOfFrames, float sampleRate);
+ ExceptionOr<Ref<AudioBuffer>> createBuffer(ArrayBuffer&, bool mixToMono);
</ins><span class="cx">
</span><span class="cx"> // Asynchronous audio file data decoding.
</span><span class="cx"> void decodeAudioData(Ref<ArrayBuffer>&&, RefPtr<AudioBufferCallback>&&, RefPtr<AudioBufferCallback>&&);
</span><span class="lines">@@ -121,25 +121,25 @@
</span><span class="cx"> // The AudioNode create methods are called on the main thread (from JavaScript).
</span><span class="cx"> Ref<AudioBufferSourceNode> createBufferSource();
</span><span class="cx"> #if ENABLE(VIDEO)
</span><del>- RefPtr<MediaElementAudioSourceNode> createMediaElementSource(HTMLMediaElement&, ExceptionCode&);
</del><ins>+ ExceptionOr<Ref<MediaElementAudioSourceNode>> createMediaElementSource(HTMLMediaElement&);
</ins><span class="cx"> #endif
</span><span class="cx"> #if ENABLE(MEDIA_STREAM)
</span><del>- RefPtr<MediaStreamAudioSourceNode> createMediaStreamSource(MediaStream&, ExceptionCode&);
</del><ins>+ ExceptionOr<Ref<MediaStreamAudioSourceNode>> createMediaStreamSource(MediaStream&);
</ins><span class="cx"> Ref<MediaStreamAudioDestinationNode> createMediaStreamDestination();
</span><span class="cx"> #endif
</span><span class="cx"> Ref<GainNode> createGain();
</span><span class="cx"> Ref<BiquadFilterNode> createBiquadFilter();
</span><span class="cx"> Ref<WaveShaperNode> createWaveShaper();
</span><del>- RefPtr<DelayNode> createDelay(double maxDelayTime, ExceptionCode&);
</del><ins>+ ExceptionOr<Ref<DelayNode>> createDelay(double maxDelayTime);
</ins><span class="cx"> Ref<PannerNode> createPanner();
</span><span class="cx"> Ref<ConvolverNode> createConvolver();
</span><span class="cx"> Ref<DynamicsCompressorNode> createDynamicsCompressor();
</span><span class="cx"> Ref<AnalyserNode> createAnalyser();
</span><del>- RefPtr<ScriptProcessorNode> createScriptProcessor(size_t bufferSize, size_t numberOfInputChannels, size_t numberOfOutputChannels, ExceptionCode&);
- RefPtr<ChannelSplitterNode> createChannelSplitter(size_t numberOfOutputs, ExceptionCode&);
- RefPtr<ChannelMergerNode> createChannelMerger(size_t numberOfInputs, ExceptionCode&);
</del><ins>+ ExceptionOr<Ref<ScriptProcessorNode>> createScriptProcessor(size_t bufferSize, size_t numberOfInputChannels, size_t numberOfOutputChannels);
+ ExceptionOr<Ref<ChannelSplitterNode>> createChannelSplitter(size_t numberOfOutputs);
+ ExceptionOr<Ref<ChannelMergerNode>> createChannelMerger(size_t numberOfInputs);
</ins><span class="cx"> Ref<OscillatorNode> createOscillator();
</span><del>- RefPtr<PeriodicWave> createPeriodicWave(Float32Array& real, Float32Array& imaginary, ExceptionCode&);
</del><ins>+ ExceptionOr<Ref<PeriodicWave>> createPeriodicWave(Float32Array& real, Float32Array& imaginary);
</ins><span class="cx">
</span><span class="cx"> // When a source node has no more processing to do (has finished playing), then it tells the context to dereference it.
</span><span class="cx"> void notifyNodeFinishedProcessing(AudioNode*);
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebaudioAudioContextidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webaudio/AudioContext.idl (207049 => 207050)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webaudio/AudioContext.idl        2016-10-11 06:19:02 UTC (rev 207049)
+++ trunk/Source/WebCore/Modules/webaudio/AudioContext.idl        2016-10-11 06:23:49 UTC (rev 207050)
</span><span class="lines">@@ -61,8 +61,8 @@
</span><span class="cx"> // Number of AudioBufferSourceNodes that are currently playing.
</span><span class="cx"> readonly attribute unsigned long activeSourceCount;
</span><span class="cx">
</span><del>- [MayThrowLegacyException] AudioBuffer createBuffer(unsigned long numberOfChannels, unsigned long numberOfFrames, unrestricted float sampleRate);
- [MayThrowLegacyException] AudioBuffer createBuffer(ArrayBuffer buffer, boolean mixToMono);
</del><ins>+ [MayThrowException] AudioBuffer createBuffer(unsigned long numberOfChannels, unsigned long numberOfFrames, unrestricted float sampleRate);
+ [MayThrowException] AudioBuffer createBuffer(ArrayBuffer buffer, boolean mixToMono);
</ins><span class="cx">
</span><span class="cx"> // Asynchronous audio file data decoding.
</span><span class="cx"> // FIXME: successCallback should be optional and the callbacks should not be nullable. This should also return a Promise.
</span><span class="lines">@@ -71,14 +71,14 @@
</span><span class="cx"> // Sources
</span><span class="cx"> AudioBufferSourceNode createBufferSource();
</span><span class="cx">
</span><del>- [Conditional=VIDEO, MayThrowLegacyException] MediaElementAudioSourceNode createMediaElementSource(HTMLMediaElement mediaElement);
</del><ins>+ [Conditional=VIDEO, MayThrowException] MediaElementAudioSourceNode createMediaElementSource(HTMLMediaElement mediaElement);
</ins><span class="cx">
</span><del>- [Conditional=MEDIA_STREAM, MayThrowLegacyException] MediaStreamAudioSourceNode createMediaStreamSource(MediaStream mediaStream);
</del><ins>+ [Conditional=MEDIA_STREAM, MayThrowException] MediaStreamAudioSourceNode createMediaStreamSource(MediaStream mediaStream);
</ins><span class="cx"> [Conditional=MEDIA_STREAM] MediaStreamAudioDestinationNode createMediaStreamDestination();
</span><span class="cx">
</span><span class="cx"> // Processing nodes
</span><span class="cx"> GainNode createGain();
</span><del>- [MayThrowLegacyException] DelayNode createDelay(optional unrestricted double maxDelayTime = 1);
</del><ins>+ [MayThrowException] DelayNode createDelay(optional unrestricted double maxDelayTime = 1);
</ins><span class="cx"> BiquadFilterNode createBiquadFilter();
</span><span class="cx"> WaveShaperNode createWaveShaper();
</span><span class="cx"> PannerNode createPanner();
</span><span class="lines">@@ -85,13 +85,13 @@
</span><span class="cx"> ConvolverNode createConvolver();
</span><span class="cx"> DynamicsCompressorNode createDynamicsCompressor();
</span><span class="cx"> AnalyserNode createAnalyser();
</span><del>- [MayThrowLegacyException] ScriptProcessorNode createScriptProcessor(unsigned long bufferSize, optional unsigned long numberOfInputChannels = 2, optional unsigned long numberOfOutputChannels = 2);
</del><ins>+ [MayThrowException] ScriptProcessorNode createScriptProcessor(unsigned long bufferSize, optional unsigned long numberOfInputChannels = 2, optional unsigned long numberOfOutputChannels = 2);
</ins><span class="cx"> OscillatorNode createOscillator();
</span><del>- [MayThrowLegacyException] PeriodicWave createPeriodicWave(Float32Array real, Float32Array imag);
</del><ins>+ [MayThrowException] PeriodicWave createPeriodicWave(Float32Array real, Float32Array imag);
</ins><span class="cx">
</span><span class="cx"> // Channel splitting and merging
</span><del>- [MayThrowLegacyException] ChannelSplitterNode createChannelSplitter(optional unsigned long numberOfOutputs = 6);
- [MayThrowLegacyException] ChannelMergerNode createChannelMerger(optional unsigned long numberOfInputs = 6);
</del><ins>+ [MayThrowException] ChannelSplitterNode createChannelSplitter(optional unsigned long numberOfOutputs = 6);
+ [MayThrowException] ChannelMergerNode createChannelMerger(optional unsigned long numberOfInputs = 6);
</ins><span class="cx">
</span><span class="cx"> // Offline rendering
</span><span class="cx"> // void prepareOfflineBufferRendering(unsigned long numberOfChannels, unsigned long numberOfFrames, unrestricted float sampleRate);
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebaudioAudioDestinationNodeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webaudio/AudioDestinationNode.h (207049 => 207050)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webaudio/AudioDestinationNode.h        2016-10-11 06:19:02 UTC (rev 207049)
+++ trunk/Source/WebCore/Modules/webaudio/AudioDestinationNode.h        2016-10-11 06:23:49 UTC (rev 207050)
</span><span class="lines">@@ -53,7 +53,7 @@
</span><span class="cx"> size_t currentSampleFrame() const { return m_currentSampleFrame; }
</span><span class="cx"> double currentTime() const { return currentSampleFrame() / static_cast<double>(sampleRate()); }
</span><span class="cx">
</span><del>- virtual unsigned long maxChannelCount() const { return 0; }
</del><ins>+ virtual unsigned maxChannelCount() const { return 0; }
</ins><span class="cx">
</span><span class="cx"> // Enable local/live input for the specified device.
</span><span class="cx"> virtual void enableInput(const String& inputDeviceId) = 0;
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebaudioAudioNodecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webaudio/AudioNode.cpp (207049 => 207050)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webaudio/AudioNode.cpp        2016-10-11 06:19:02 UTC (rev 207049)
+++ trunk/Source/WebCore/Modules/webaudio/AudioNode.cpp        2016-10-11 06:23:49 UTC (rev 207050)
</span><span class="lines">@@ -123,97 +123,89 @@
</span><span class="cx"> return nullptr;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void AudioNode::connect(AudioNode* destination, unsigned outputIndex, unsigned inputIndex, ExceptionCode& ec)
</del><ins>+ExceptionOr<void> AudioNode::connect(AudioNode* destination, unsigned outputIndex, unsigned inputIndex)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(isMainThread());
</span><span class="cx"> AudioContext::AutoLocker locker(context());
</span><span class="cx">
</span><del>- if (!destination) {
- ec = SYNTAX_ERR;
- return;
- }
</del><ins>+ if (!destination)
+ return Exception { SYNTAX_ERR };
</ins><span class="cx">
</span><span class="cx"> // Sanity check input and output indices.
</span><del>- if (outputIndex >= numberOfOutputs()) {
- ec = INDEX_SIZE_ERR;
- return;
- }
</del><ins>+ if (outputIndex >= numberOfOutputs())
+ return Exception { INDEX_SIZE_ERR };
</ins><span class="cx">
</span><del>- if (destination && inputIndex >= destination->numberOfInputs()) {
- ec = INDEX_SIZE_ERR;
- return;
- }
</del><ins>+ if (destination && inputIndex >= destination->numberOfInputs())
+ return Exception { INDEX_SIZE_ERR };
</ins><span class="cx">
</span><del>- if (context() != destination->context()) {
- ec = SYNTAX_ERR;
- return;
- }
</del><ins>+ if (context() != destination->context())
+ return Exception { SYNTAX_ERR };
</ins><span class="cx">
</span><del>- AudioNodeInput* input = destination->input(inputIndex);
- AudioNodeOutput* output = this->output(outputIndex);
</del><ins>+ auto* input = destination->input(inputIndex);
+ auto* output = this->output(outputIndex);
</ins><span class="cx"> input->connect(output);
</span><span class="cx">
</span><span class="cx"> // Let context know that a connection has been made.
</span><span class="cx"> context().incrementConnectionCount();
</span><ins>+
+ return { };
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void AudioNode::connect(AudioParam* param, unsigned outputIndex, ExceptionCode& ec)
</del><ins>+ExceptionOr<void> AudioNode::connect(AudioParam* param, unsigned outputIndex)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(isMainThread());
</span><span class="cx"> AudioContext::AutoLocker locker(context());
</span><span class="cx">
</span><del>- if (!param) {
- ec = SYNTAX_ERR;
- return;
- }
</del><ins>+ if (!param)
+ return Exception { SYNTAX_ERR };
</ins><span class="cx">
</span><del>- if (outputIndex >= numberOfOutputs()) {
- ec = INDEX_SIZE_ERR;
- return;
- }
</del><ins>+ if (outputIndex >= numberOfOutputs())
+ return Exception { INDEX_SIZE_ERR };
</ins><span class="cx">
</span><del>- if (context() != param->context()) {
- ec = SYNTAX_ERR;
- return;
- }
</del><ins>+ if (context() != param->context())
+ return Exception { SYNTAX_ERR };
</ins><span class="cx">
</span><del>- AudioNodeOutput* output = this->output(outputIndex);
</del><ins>+ auto* output = this->output(outputIndex);
</ins><span class="cx"> param->connect(output);
</span><ins>+
+ return { };
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void AudioNode::disconnect(unsigned outputIndex, ExceptionCode& ec)
</del><ins>+ExceptionOr<void> AudioNode::disconnect(unsigned outputIndex)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(isMainThread());
</span><span class="cx"> AudioContext::AutoLocker locker(context());
</span><span class="cx">
</span><span class="cx"> // Sanity check input and output indices.
</span><del>- if (outputIndex >= numberOfOutputs()) {
- ec = INDEX_SIZE_ERR;
- return;
- }
</del><ins>+ if (outputIndex >= numberOfOutputs())
+ return Exception { INDEX_SIZE_ERR };
</ins><span class="cx">
</span><del>- AudioNodeOutput* output = this->output(outputIndex);
</del><ins>+ auto* output = this->output(outputIndex);
</ins><span class="cx"> output->disconnectAll();
</span><ins>+
+ return { };
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-unsigned long AudioNode::channelCount()
</del><ins>+unsigned AudioNode::channelCount()
</ins><span class="cx"> {
</span><span class="cx"> return m_channelCount;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void AudioNode::setChannelCount(unsigned long channelCount, ExceptionCode& ec)
</del><ins>+ExceptionOr<void> AudioNode::setChannelCount(unsigned channelCount)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(isMainThread());
</span><span class="cx"> AudioContext::AutoLocker locker(context());
</span><span class="cx">
</span><del>- if (channelCount > 0 && channelCount <= AudioContext::maxNumberOfChannels()) {
- if (m_channelCount != channelCount) {
- m_channelCount = channelCount;
- if (m_channelCountMode != Max)
- updateChannelsForInputs();
- }
- } else
- ec = INVALID_STATE_ERR;
</del><ins>+ if (!(channelCount > 0 && channelCount <= AudioContext::maxNumberOfChannels()))
+ return Exception { INVALID_STATE_ERR };
+
+ if (m_channelCount == channelCount)
+ return { };
+
+ m_channelCount = channelCount;
+ if (m_channelCountMode != Max)
+ updateChannelsForInputs();
+ return { };
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> String AudioNode::channelCountMode()
</span><span class="lines">@@ -230,7 +222,7 @@
</span><span class="cx"> return emptyString();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void AudioNode::setChannelCountMode(const String& mode, ExceptionCode& ec)
</del><ins>+ExceptionOr<void> AudioNode::setChannelCountMode(const String& mode)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(isMainThread());
</span><span class="cx"> AudioContext::AutoLocker locker(context());
</span><span class="lines">@@ -244,10 +236,12 @@
</span><span class="cx"> else if (mode == "explicit")
</span><span class="cx"> m_channelCountMode = Explicit;
</span><span class="cx"> else
</span><del>- ec = INVALID_STATE_ERR;
</del><ins>+ return Exception { INVALID_STATE_ERR };
</ins><span class="cx">
</span><span class="cx"> if (m_channelCountMode != oldMode)
</span><span class="cx"> updateChannelsForInputs();
</span><ins>+
+ return { };
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> String AudioNode::channelInterpretation()
</span><span class="lines">@@ -262,7 +256,7 @@
</span><span class="cx"> return emptyString();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void AudioNode::setChannelInterpretation(const String& interpretation, ExceptionCode& ec)
</del><ins>+ExceptionOr<void> AudioNode::setChannelInterpretation(const String& interpretation)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(isMainThread());
</span><span class="cx"> AudioContext::AutoLocker locker(context());
</span><span class="lines">@@ -272,7 +266,9 @@
</span><span class="cx"> else if (interpretation == "discrete")
</span><span class="cx"> m_channelInterpretation = AudioBus::Discrete;
</span><span class="cx"> else
</span><del>- ec = INVALID_STATE_ERR;
</del><ins>+ return Exception { INVALID_STATE_ERR };
+
+ return { };
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void AudioNode::updateChannelsForInputs()
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebaudioAudioNodeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webaudio/AudioNode.h (207049 => 207050)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webaudio/AudioNode.h        2016-10-11 06:19:02 UTC (rev 207049)
+++ trunk/Source/WebCore/Modules/webaudio/AudioNode.h        2016-10-11 06:23:49 UTC (rev 207050)
</span><span class="lines">@@ -22,14 +22,12 @@
</span><span class="cx"> * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><del>-#ifndef AudioNode_h
-#define AudioNode_h
</del><ins>+#pragma once
</ins><span class="cx">
</span><span class="cx"> #include "AudioBus.h"
</span><span class="cx"> #include "EventTarget.h"
</span><del>-#include <memory>
</del><ins>+#include "ExceptionOr.h"
</ins><span class="cx"> #include <wtf/Forward.h>
</span><del>-#include <wtf/Vector.h>
</del><span class="cx">
</span><span class="cx"> #define DEBUG_AUDIONODE_REFERENCES 0
</span><span class="cx">
</span><span class="lines">@@ -40,8 +38,6 @@
</span><span class="cx"> class AudioNodeOutput;
</span><span class="cx"> class AudioParam;
</span><span class="cx">
</span><del>-typedef int ExceptionCode;
-
</del><span class="cx"> // An AudioNode is the basic building block for handling audio within an AudioContext.
</span><span class="cx"> // It may be an audio source, an intermediate processing module, or an audio destination.
</span><span class="cx"> // Each AudioNode can have inputs and/or outputs. An AudioSourceNode has no inputs and a single output.
</span><span class="lines">@@ -125,9 +121,9 @@
</span><span class="cx"> AudioNodeOutput* output(unsigned);
</span><span class="cx">
</span><span class="cx"> // Called from main thread by corresponding JavaScript methods.
</span><del>- virtual void connect(AudioNode*, unsigned outputIndex, unsigned inputIndex, ExceptionCode&);
- void connect(AudioParam*, unsigned outputIndex, ExceptionCode&);
- virtual void disconnect(unsigned outputIndex, ExceptionCode&);
</del><ins>+ virtual ExceptionOr<void> connect(AudioNode*, unsigned outputIndex, unsigned inputIndex);
+ ExceptionOr<void> connect(AudioParam*, unsigned outputIndex);
+ virtual ExceptionOr<void> disconnect(unsigned outputIndex);
</ins><span class="cx">
</span><span class="cx"> virtual float sampleRate() const { return m_sampleRate; }
</span><span class="cx">
</span><span class="lines">@@ -165,14 +161,14 @@
</span><span class="cx"> void enableOutputsIfNecessary();
</span><span class="cx"> void disableOutputsIfNecessary();
</span><span class="cx">
</span><del>- unsigned long channelCount();
- virtual void setChannelCount(unsigned long, ExceptionCode&);
</del><ins>+ unsigned channelCount();
+ virtual ExceptionOr<void> setChannelCount(unsigned);
</ins><span class="cx">
</span><span class="cx"> String channelCountMode();
</span><del>- void setChannelCountMode(const String&, ExceptionCode&);
</del><ins>+ ExceptionOr<void> setChannelCountMode(const String&);
</ins><span class="cx">
</span><span class="cx"> String channelInterpretation();
</span><del>- void setChannelInterpretation(const String&, ExceptionCode&);
</del><ins>+ ExceptionOr<void> setChannelInterpretation(const String&);
</ins><span class="cx">
</span><span class="cx"> ChannelCountMode internalChannelCountMode() const { return m_channelCountMode; }
</span><span class="cx"> AudioBus::ChannelInterpretation internalChannelInterpretation() const { return m_channelInterpretation; }
</span><span class="lines">@@ -227,5 +223,3 @@
</span><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span><del>-
-#endif // AudioNode_h
</del></span></pre></div>
<a id="trunkSourceWebCoreModuleswebaudioAudioNodeidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webaudio/AudioNode.idl (207049 => 207050)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webaudio/AudioNode.idl        2016-10-11 06:19:02 UTC (rev 207049)
+++ trunk/Source/WebCore/Modules/webaudio/AudioNode.idl        2016-10-11 06:23:49 UTC (rev 207050)
</span><span class="lines">@@ -30,11 +30,11 @@
</span><span class="cx"> readonly attribute unsigned long numberOfInputs;
</span><span class="cx"> readonly attribute unsigned long numberOfOutputs;
</span><span class="cx">
</span><del>- [SetterMayThrowLegacyException] attribute unsigned long channelCount;
- [SetterMayThrowLegacyException] attribute DOMString channelCountMode;
- [SetterMayThrowLegacyException] attribute DOMString channelInterpretation;
</del><ins>+ [SetterMayThrowException] attribute unsigned long channelCount;
+ [SetterMayThrowException] attribute DOMString channelCountMode;
+ [SetterMayThrowException] attribute DOMString channelInterpretation;
</ins><span class="cx">
</span><del>- [MayThrowLegacyException] void connect(AudioNode? destination, optional unsigned long output = 0, optional unsigned long input = 0);
- [MayThrowLegacyException] void connect(AudioParam? destination, optional unsigned long output = 0);
- [MayThrowLegacyException] void disconnect(optional unsigned long output = 0);
</del><ins>+ [MayThrowException] void connect(AudioNode? destination, optional unsigned long output = 0, optional unsigned long input = 0);
+ [MayThrowException] void connect(AudioParam? destination, optional unsigned long output = 0);
+ [MayThrowException] void disconnect(optional unsigned long output = 0);
</ins><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebaudioAudioScheduledSourceNodecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webaudio/AudioScheduledSourceNode.cpp (207049 => 207050)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webaudio/AudioScheduledSourceNode.cpp        2016-10-11 06:19:02 UTC (rev 207049)
+++ trunk/Source/WebCore/Modules/webaudio/AudioScheduledSourceNode.cpp        2016-10-11 06:23:49 UTC (rev 207050)
</span><span class="lines">@@ -46,22 +46,12 @@
</span><span class="cx">
</span><span class="cx"> AudioScheduledSourceNode::AudioScheduledSourceNode(AudioContext& context, float sampleRate)
</span><span class="cx"> : AudioNode(context, sampleRate)
</span><del>- , m_playbackState(UNSCHEDULED_STATE)
- , m_startTime(0)
</del><span class="cx"> , m_endTime(UnknownTime)
</span><del>- , m_hasEndedListener(false)
</del><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void AudioScheduledSourceNode::updateSchedulingInfo(size_t quantumFrameSize,
- AudioBus* outputBus,
- size_t& quantumFrameOffset,
- size_t& nonSilentFramesToProcess)
</del><ins>+void AudioScheduledSourceNode::updateSchedulingInfo(size_t quantumFrameSize, AudioBus& outputBus, size_t& quantumFrameOffset, size_t& nonSilentFramesToProcess)
</ins><span class="cx"> {
</span><del>- ASSERT(outputBus);
- if (!outputBus)
- return;
-
</del><span class="cx"> ASSERT(quantumFrameSize == AudioNode::ProcessingSizeInFrames);
</span><span class="cx"> if (quantumFrameSize != AudioNode::ProcessingSizeInFrames)
</span><span class="cx"> return;
</span><span class="lines">@@ -83,7 +73,7 @@
</span><span class="cx">
</span><span class="cx"> if (m_playbackState == UNSCHEDULED_STATE || m_playbackState == FINISHED_STATE || startFrame >= quantumEndFrame) {
</span><span class="cx"> // Output silence.
</span><del>- outputBus->zero();
</del><ins>+ outputBus.zero();
</ins><span class="cx"> nonSilentFramesToProcess = 0;
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="lines">@@ -101,7 +91,7 @@
</span><span class="cx">
</span><span class="cx"> if (!nonSilentFramesToProcess) {
</span><span class="cx"> // Output silence.
</span><del>- outputBus->zero();
</del><ins>+ outputBus.zero();
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -108,8 +98,8 @@
</span><span class="cx"> // Handle silence before we start playing.
</span><span class="cx"> // Zero any initial frames representing silence leading up to a rendering start time in the middle of the quantum.
</span><span class="cx"> if (quantumFrameOffset) {
</span><del>- for (unsigned i = 0; i < outputBus->numberOfChannels(); ++i)
- memset(outputBus->channel(i)->mutableData(), 0, sizeof(float) * quantumFrameOffset);
</del><ins>+ for (unsigned i = 0; i < outputBus.numberOfChannels(); ++i)
+ memset(outputBus.channel(i)->mutableData(), 0, sizeof(float) * quantumFrameOffset);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // Handle silence after we're done playing.
</span><span class="lines">@@ -128,50 +118,43 @@
</span><span class="cx"> else
</span><span class="cx"> nonSilentFramesToProcess -= framesToZero;
</span><span class="cx">
</span><del>- for (unsigned i = 0; i < outputBus->numberOfChannels(); ++i)
- memset(outputBus->channel(i)->mutableData() + zeroStartFrame, 0, sizeof(float) * framesToZero);
</del><ins>+ for (unsigned i = 0; i < outputBus.numberOfChannels(); ++i)
+ memset(outputBus.channel(i)->mutableData() + zeroStartFrame, 0, sizeof(float) * framesToZero);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> finish();
</span><span class="cx"> }
</span><del>-
- return;
</del><span class="cx"> }
</span><span class="cx">
</span><del>-void AudioScheduledSourceNode::start(double when, ExceptionCode& ec)
</del><ins>+ExceptionOr<void> AudioScheduledSourceNode::start(double when)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(isMainThread());
</span><span class="cx">
</span><span class="cx"> context().nodeWillBeginPlayback();
</span><span class="cx">
</span><del>- if (m_playbackState != UNSCHEDULED_STATE) {
- ec = INVALID_STATE_ERR;
- return;
- }
</del><ins>+ if (m_playbackState != UNSCHEDULED_STATE)
+ return Exception { INVALID_STATE_ERR };
+ if (!std::isfinite(when) || when < 0)
+ return Exception { INVALID_STATE_ERR };
</ins><span class="cx">
</span><del>- if (!std::isfinite(when) || (when < 0)) {
- ec = INVALID_STATE_ERR;
- return;
- }
-
</del><span class="cx"> m_startTime = when;
</span><span class="cx"> m_playbackState = SCHEDULED_STATE;
</span><ins>+
+ return { };
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void AudioScheduledSourceNode::stop(double when, ExceptionCode& ec)
</del><ins>+ExceptionOr<void> AudioScheduledSourceNode::stop(double when)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(isMainThread());
</span><del>- if ((m_playbackState == UNSCHEDULED_STATE) || (m_endTime != UnknownTime)) {
- ec = INVALID_STATE_ERR;
- return;
- }
</del><span class="cx">
</span><del>- if (!std::isfinite(when) || (when < 0)) {
- ec = INVALID_STATE_ERR;
- return;
- }
</del><ins>+ if (m_playbackState == UNSCHEDULED_STATE || m_endTime != UnknownTime)
+ return Exception { INVALID_STATE_ERR };
+ if (!std::isfinite(when) || when < 0)
+ return Exception { INVALID_STATE_ERR };
</ins><span class="cx">
</span><span class="cx"> m_endTime = when;
</span><ins>+
+ return { };
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void AudioScheduledSourceNode::finish()
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebaudioAudioScheduledSourceNodeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webaudio/AudioScheduledSourceNode.h (207049 => 207050)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webaudio/AudioScheduledSourceNode.h        2016-10-11 06:19:02 UTC (rev 207049)
+++ trunk/Source/WebCore/Modules/webaudio/AudioScheduledSourceNode.h        2016-10-11 06:23:49 UTC (rev 207050)
</span><span class="lines">@@ -26,16 +26,12 @@
</span><span class="cx"> * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><del>-#ifndef AudioScheduledSourceNode_h
-#define AudioScheduledSourceNode_h
</del><ins>+#pragma once
</ins><span class="cx">
</span><span class="cx"> #include "AudioNode.h"
</span><del>-#include "ExceptionCode.h"
</del><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-class AudioBus;
-
</del><span class="cx"> class AudioScheduledSourceNode : public AudioNode {
</span><span class="cx"> public:
</span><span class="cx"> // These are the possible states an AudioScheduledSourceNode can be in:
</span><span class="lines">@@ -57,9 +53,8 @@
</span><span class="cx">
</span><span class="cx"> AudioScheduledSourceNode(AudioContext&, float sampleRate);
</span><span class="cx">
</span><del>- // Scheduling.
- void start(double when, ExceptionCode&);
- void stop(double when, ExceptionCode&);
</del><ins>+ ExceptionOr<void> start(double when);
+ ExceptionOr<void> stop(double when);
</ins><span class="cx">
</span><span class="cx"> unsigned short playbackState() const { return static_cast<unsigned short>(m_playbackState); }
</span><span class="cx"> bool isPlayingOrScheduled() const { return m_playbackState == PLAYING_STATE || m_playbackState == SCHEDULED_STATE; }
</span><span class="lines">@@ -69,22 +64,18 @@
</span><span class="cx"> // Get frame information for the current time quantum.
</span><span class="cx"> // We handle the transition into PLAYING_STATE and FINISHED_STATE here,
</span><span class="cx"> // zeroing out portions of the outputBus which are outside the range of startFrame and endFrame.
</span><del>- //
</del><span class="cx"> // Each frame time is relative to the context's currentSampleFrame().
</span><del>- // quantumFrameOffset : Offset frame in this time quantum to start rendering.
- // nonSilentFramesToProcess : Number of frames rendering non-silence (will be <= quantumFrameSize).
- void updateSchedulingInfo(size_t quantumFrameSize,
- AudioBus* outputBus,
- size_t& quantumFrameOffset,
- size_t& nonSilentFramesToProcess);
</del><ins>+ // quantumFrameOffset: Offset frame in this time quantum to start rendering.
+ // nonSilentFramesToProcess: Number of frames rendering non-silence (will be <= quantumFrameSize).
+ void updateSchedulingInfo(size_t quantumFrameSize, AudioBus& outputBus, size_t& quantumFrameOffset, size_t& nonSilentFramesToProcess);
</ins><span class="cx">
</span><span class="cx"> // Called when we have no more sound to play or the noteOff() time has been reached.
</span><span class="cx"> virtual void finish();
</span><span class="cx">
</span><del>- PlaybackState m_playbackState;
</del><ins>+ PlaybackState m_playbackState { UNSCHEDULED_STATE };
</ins><span class="cx">
</span><span class="cx"> // m_startTime is the time to start playing based on the context's timeline (0 or a time less than the context's current time means "now").
</span><del>- double m_startTime; // in seconds
</del><ins>+ double m_startTime { 0 }; // in seconds
</ins><span class="cx">
</span><span class="cx"> // m_endTime is the time to stop playing based on the context's timeline (0 or a time less than the context's current time means "now").
</span><span class="cx"> // If it hasn't been set explicitly, then the sound will not stop playing (if looping) or will stop when the end of the AudioBuffer
</span><span class="lines">@@ -91,7 +82,7 @@
</span><span class="cx"> // has been reached.
</span><span class="cx"> double m_endTime; // in seconds
</span><span class="cx">
</span><del>- bool m_hasEndedListener;
</del><ins>+ bool m_hasEndedListener { false };
</ins><span class="cx">
</span><span class="cx"> static const double UnknownTime;
</span><span class="cx">
</span><span class="lines">@@ -102,5 +93,3 @@
</span><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span><del>-
-#endif // AudioScheduledSourceNode_h
</del></span></pre></div>
<a id="trunkSourceWebCoreModuleswebaudioConvolverNodecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webaudio/ConvolverNode.cpp (207049 => 207050)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webaudio/ConvolverNode.cpp        2016-10-11 06:19:02 UTC (rev 207049)
+++ trunk/Source/WebCore/Modules/webaudio/ConvolverNode.cpp        2016-10-11 06:23:49 UTC (rev 207050)
</span><span class="lines">@@ -29,13 +29,9 @@
</span><span class="cx">
</span><span class="cx"> #include "ConvolverNode.h"
</span><span class="cx">
</span><del>-#include "AudioBuffer.h"
-#include "AudioContext.h"
</del><span class="cx"> #include "AudioNodeInput.h"
</span><span class="cx"> #include "AudioNodeOutput.h"
</span><del>-#include "ExceptionCode.h"
</del><span class="cx"> #include "Reverb.h"
</span><del>-#include <wtf/MainThread.h>
</del><span class="cx">
</span><span class="cx"> // Note about empirical tuning:
</span><span class="cx"> // The maximum FFT size affects reverb performance and accuracy.
</span><span class="lines">@@ -49,7 +45,6 @@
</span><span class="cx">
</span><span class="cx"> ConvolverNode::ConvolverNode(AudioContext& context, float sampleRate)
</span><span class="cx"> : AudioNode(context, sampleRate)
</span><del>- , m_normalize(true)
</del><span class="cx"> {
</span><span class="cx"> addInput(std::make_unique<AudioNodeInput>(this));
</span><span class="cx"> addOutput(std::make_unique<AudioNodeOutput>(this, 2));
</span><span class="lines">@@ -104,7 +99,7 @@
</span><span class="cx"> {
</span><span class="cx"> if (isInitialized())
</span><span class="cx"> return;
</span><del>-
</del><ins>+
</ins><span class="cx"> AudioNode::initialize();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -117,17 +112,15 @@
</span><span class="cx"> AudioNode::uninitialize();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void ConvolverNode::setBuffer(AudioBuffer* buffer, ExceptionCode& ec)
</del><ins>+ExceptionOr<void> ConvolverNode::setBuffer(AudioBuffer* buffer)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(isMainThread());
</span><span class="cx">
</span><span class="cx"> if (!buffer)
</span><del>- return;
</del><ins>+ return { };
</ins><span class="cx">
</span><del>- if (buffer->sampleRate() != context().sampleRate()) {
- ec = NOT_SUPPORTED_ERR;
- return;
- }
</del><ins>+ if (buffer->sampleRate() != context().sampleRate())
+ return Exception { NOT_SUPPORTED_ERR };
</ins><span class="cx">
</span><span class="cx"> unsigned numberOfChannels = buffer->numberOfChannels();
</span><span class="cx"> size_t bufferLength = buffer->length();
</span><span class="lines">@@ -136,16 +129,14 @@
</span><span class="cx"> // 4-channel response being interpreted as true-stereo (see Reverb class).
</span><span class="cx"> bool isChannelCountGood = (numberOfChannels == 1 || numberOfChannels == 2 || numberOfChannels == 4) && bufferLength;
</span><span class="cx">
</span><del>- if (!isChannelCountGood) {
- ec = NOT_SUPPORTED_ERR;
- return;
- }
</del><ins>+ if (!isChannelCountGood)
+ return Exception { NOT_SUPPORTED_ERR };
</ins><span class="cx">
</span><span class="cx"> // Wrap the AudioBuffer by an AudioBus. It's an efficient pointer set and not a memcpy().
</span><span class="cx"> // This memory is simply used in the Reverb constructor and no reference to it is kept for later use in that class.
</span><del>- RefPtr<AudioBus> bufferBus = AudioBus::create(numberOfChannels, bufferLength, false);
</del><ins>+ auto bufferBus = AudioBus::create(numberOfChannels, bufferLength, false);
</ins><span class="cx"> for (unsigned i = 0; i < numberOfChannels; ++i)
</span><del>- bufferBus->setChannelMemory(i, buffer->getChannelData(i)->data(), bufferLength);
</del><ins>+ bufferBus->setChannelMemory(i, buffer->channelData(i)->data(), bufferLength);
</ins><span class="cx">
</span><span class="cx"> bufferBus->setSampleRate(buffer->sampleRate());
</span><span class="cx">
</span><span class="lines">@@ -159,6 +150,8 @@
</span><span class="cx"> m_reverb = WTFMove(reverb);
</span><span class="cx"> m_buffer = buffer;
</span><span class="cx"> }
</span><ins>+
+ return { };
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> AudioBuffer* ConvolverNode::buffer()
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebaudioConvolverNodeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webaudio/ConvolverNode.h (207049 => 207050)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webaudio/ConvolverNode.h        2016-10-11 06:19:02 UTC (rev 207049)
+++ trunk/Source/WebCore/Modules/webaudio/ConvolverNode.h        2016-10-11 06:23:49 UTC (rev 207050)
</span><span class="lines">@@ -22,13 +22,10 @@
</span><span class="cx"> * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><del>-#ifndef ConvolverNode_h
-#define ConvolverNode_h
</del><ins>+#pragma once
</ins><span class="cx">
</span><span class="cx"> #include "AudioNode.h"
</span><del>-#include <memory>
</del><span class="cx"> #include <wtf/Lock.h>
</span><del>-#include <wtf/RefPtr.h>
</del><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="lines">@@ -35,7 +32,7 @@
</span><span class="cx"> class AudioBuffer;
</span><span class="cx"> class Reverb;
</span><span class="cx">
</span><del>-class ConvolverNode : public AudioNode {
</del><ins>+class ConvolverNode final : public AudioNode {
</ins><span class="cx"> public:
</span><span class="cx"> static Ref<ConvolverNode> create(AudioContext& context, float sampleRate)
</span><span class="cx"> {
</span><span class="lines">@@ -44,14 +41,7 @@
</span><span class="cx">
</span><span class="cx"> virtual ~ConvolverNode();
</span><span class="cx">
</span><del>- // AudioNode
- void process(size_t framesToProcess) override;
- void reset() override;
- void initialize() override;
- void uninitialize() override;
-
- // Impulse responses
- void setBuffer(AudioBuffer*, ExceptionCode&);
</del><ins>+ ExceptionOr<void> setBuffer(AudioBuffer*);
</ins><span class="cx"> AudioBuffer* buffer();
</span><span class="cx">
</span><span class="cx"> bool normalize() const { return m_normalize; }
</span><span class="lines">@@ -60,9 +50,14 @@
</span><span class="cx"> private:
</span><span class="cx"> ConvolverNode(AudioContext&, float sampleRate);
</span><span class="cx">
</span><del>- double tailTime() const override;
- double latencyTime() const override;
</del><ins>+ double tailTime() const final;
+ double latencyTime() const final;
</ins><span class="cx">
</span><ins>+ void process(size_t framesToProcess) final;
+ void reset() final;
+ void initialize() final;
+ void uninitialize() final;
+
</ins><span class="cx"> std::unique_ptr<Reverb> m_reverb;
</span><span class="cx"> RefPtr<AudioBuffer> m_buffer;
</span><span class="cx">
</span><span class="lines">@@ -69,10 +64,8 @@
</span><span class="cx"> // This synchronizes dynamic changes to the convolution impulse response with process().
</span><span class="cx"> mutable Lock m_processMutex;
</span><span class="cx">
</span><del>- // Normalize the impulse response or not. Must default to true.
- bool m_normalize;
</del><ins>+ // Normalize the impulse response or not.
+ bool m_normalize { true };
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span><del>-
-#endif // ConvolverNode_h
</del></span></pre></div>
<a id="trunkSourceWebCoreModuleswebaudioConvolverNodeidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webaudio/ConvolverNode.idl (207049 => 207050)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webaudio/ConvolverNode.idl        2016-10-11 06:19:02 UTC (rev 207049)
+++ trunk/Source/WebCore/Modules/webaudio/ConvolverNode.idl        2016-10-11 06:23:49 UTC (rev 207050)
</span><span class="lines">@@ -27,6 +27,6 @@
</span><span class="cx"> Conditional=WEB_AUDIO,
</span><span class="cx"> JSGenerateToJSObject
</span><span class="cx"> ] interface ConvolverNode : AudioNode {
</span><del>- [SetterMayThrowLegacyException] attribute AudioBuffer? buffer;
</del><ins>+ [SetterMayThrowException] attribute AudioBuffer? buffer;
</ins><span class="cx"> attribute boolean normalize;
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebaudioDefaultAudioDestinationNodecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webaudio/DefaultAudioDestinationNode.cpp (207049 => 207050)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webaudio/DefaultAudioDestinationNode.cpp        2016-10-11 06:19:02 UTC (rev 207049)
+++ trunk/Source/WebCore/Modules/webaudio/DefaultAudioDestinationNode.cpp        2016-10-11 06:23:49 UTC (rev 207050)
</span><span class="lines">@@ -29,7 +29,7 @@
</span><span class="cx"> #include "DefaultAudioDestinationNode.h"
</span><span class="cx">
</span><span class="cx"> #include "AudioContext.h"
</span><del>-#include "ExceptionCode.h"
</del><ins>+#include "AudioDestination.h"
</ins><span class="cx"> #include "Logging.h"
</span><span class="cx"> #include "ScriptExecutionContext.h"
</span><span class="cx"> #include <wtf/MainThread.h>
</span><span class="lines">@@ -40,7 +40,6 @@
</span><span class="cx">
</span><span class="cx"> DefaultAudioDestinationNode::DefaultAudioDestinationNode(AudioContext& context)
</span><span class="cx"> : AudioDestinationNode(context, AudioDestination::hardwareSampleRate())
</span><del>- , m_numberOfInputChannels(0)
</del><span class="cx"> {
</span><span class="cx"> // Node-specific default mixing rules.
</span><span class="cx"> m_channelCount = 2;
</span><span class="lines">@@ -132,12 +131,12 @@
</span><span class="cx"> scriptExecutionContext->postTask(WTFMove(function));
</span><span class="cx"> }
</span><span class="cx">
</span><del>-unsigned long DefaultAudioDestinationNode::maxChannelCount() const
</del><ins>+unsigned DefaultAudioDestinationNode::maxChannelCount() const
</ins><span class="cx"> {
</span><span class="cx"> return AudioDestination::maxChannelCount();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void DefaultAudioDestinationNode::setChannelCount(unsigned long channelCount, ExceptionCode& ec)
</del><ins>+ExceptionOr<void> DefaultAudioDestinationNode::setChannelCount(unsigned channelCount)
</ins><span class="cx"> {
</span><span class="cx"> // The channelCount for the input to this node controls the actual number of channels we
</span><span class="cx"> // send to the audio hardware. It can only be set depending on the maximum number of
</span><span class="lines">@@ -145,20 +144,22 @@
</span><span class="cx">
</span><span class="cx"> ASSERT(isMainThread());
</span><span class="cx">
</span><del>- if (!maxChannelCount() || channelCount > maxChannelCount()) {
- ec = INVALID_STATE_ERR;
- return;
- }
</del><ins>+ if (!maxChannelCount() || channelCount > maxChannelCount())
+ return Exception { INVALID_STATE_ERR };
</ins><span class="cx">
</span><del>- unsigned long oldChannelCount = this->channelCount();
- AudioNode::setChannelCount(channelCount, ec);
</del><ins>+ auto oldChannelCount = this->channelCount();
+ auto result = AudioNode::setChannelCount(channelCount);
+ if (result.hasException())
+ return result;
</ins><span class="cx">
</span><del>- if (!ec && this->channelCount() != oldChannelCount && isInitialized()) {
</del><ins>+ if (this->channelCount() != oldChannelCount && isInitialized()) {
</ins><span class="cx"> // Re-create destination.
</span><span class="cx"> m_destination->stop();
</span><span class="cx"> createDestination();
</span><span class="cx"> m_destination->start();
</span><span class="cx"> }
</span><ins>+
+ return { };
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool DefaultAudioDestinationNode::isPlaying()
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebaudioDefaultAudioDestinationNodeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webaudio/DefaultAudioDestinationNode.h (207049 => 207050)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webaudio/DefaultAudioDestinationNode.h        2016-10-11 06:19:02 UTC (rev 207049)
+++ trunk/Source/WebCore/Modules/webaudio/DefaultAudioDestinationNode.h        2016-10-11 06:23:49 UTC (rev 207050)
</span><span class="lines">@@ -22,18 +22,15 @@
</span><span class="cx"> * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><del>-#ifndef DefaultAudioDestinationNode_h
-#define DefaultAudioDestinationNode_h
</del><ins>+#pragma once
</ins><span class="cx">
</span><del>-#include "AudioDestination.h"
</del><span class="cx"> #include "AudioDestinationNode.h"
</span><del>-#include <memory>
</del><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-class AudioContext;
</del><ins>+class AudioDestination;
</ins><span class="cx">
</span><del>-class DefaultAudioDestinationNode : public AudioDestinationNode {
</del><ins>+class DefaultAudioDestinationNode final : public AudioDestinationNode {
</ins><span class="cx"> public:
</span><span class="cx"> static Ref<DefaultAudioDestinationNode> create(AudioContext& context)
</span><span class="cx"> {
</span><span class="lines">@@ -42,29 +39,25 @@
</span><span class="cx">
</span><span class="cx"> virtual ~DefaultAudioDestinationNode();
</span><span class="cx">
</span><del>- // AudioNode
- void initialize() override;
- void uninitialize() override;
- void setChannelCount(unsigned long, ExceptionCode&) override;
-
- // AudioDestinationNode
- void enableInput(const String& inputDeviceId) override;
- void startRendering() override;
- void resume(Function<void ()>&&) override;
- void suspend(Function<void ()>&&) override;
- void close(Function<void ()>&&) override;
- unsigned long maxChannelCount() const override;
- bool isPlaying() override;
-
</del><span class="cx"> private:
</span><span class="cx"> explicit DefaultAudioDestinationNode(AudioContext&);
</span><span class="cx"> void createDestination();
</span><span class="cx">
</span><ins>+ void initialize() final;
+ void uninitialize() final;
+ ExceptionOr<void> setChannelCount(unsigned) final;
+
+ void enableInput(const String& inputDeviceId) final;
+ void startRendering() final;
+ void resume(Function<void ()>&&) final;
+ void suspend(Function<void ()>&&) final;
+ void close(Function<void ()>&&) final;
+ unsigned maxChannelCount() const final;
+ bool isPlaying() final;
+
</ins><span class="cx"> std::unique_ptr<AudioDestination> m_destination;
</span><span class="cx"> String m_inputDeviceId;
</span><del>- unsigned m_numberOfInputChannels;
</del><ins>+ unsigned m_numberOfInputChannels { 0 };
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span><del>-
-#endif // DefaultAudioDestinationNode_h
</del></span></pre></div>
<a id="trunkSourceWebCoreModuleswebaudioDelayNodecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webaudio/DelayNode.cpp (207049 => 207050)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webaudio/DelayNode.cpp        2016-10-11 06:19:02 UTC (rev 207049)
+++ trunk/Source/WebCore/Modules/webaudio/DelayNode.cpp        2016-10-11 06:23:49 UTC (rev 207050)
</span><span class="lines">@@ -28,24 +28,29 @@
</span><span class="cx">
</span><span class="cx"> #include "DelayNode.h"
</span><span class="cx">
</span><ins>+#include "DelayProcessor.h"
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="cx"> const double maximumAllowedDelayTime = 180;
</span><span class="cx">
</span><del>-DelayNode::DelayNode(AudioContext& context, float sampleRate, double maxDelayTime, ExceptionCode& ec)
</del><ins>+inline DelayNode::DelayNode(AudioContext& context, float sampleRate, double maxDelayTime)
</ins><span class="cx"> : AudioBasicProcessorNode(context, sampleRate)
</span><span class="cx"> {
</span><del>- if (maxDelayTime <= 0 || maxDelayTime >= maximumAllowedDelayTime) {
- ec = NOT_SUPPORTED_ERR;
- return;
- }
</del><span class="cx"> m_processor = std::make_unique<DelayProcessor>(context, sampleRate, 1, maxDelayTime);
</span><span class="cx"> setNodeType(NodeTypeDelay);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ExceptionOr<Ref<DelayNode>> DelayNode::create(AudioContext& context, float sampleRate, double maxDelayTime)
+{
+ if (maxDelayTime <= 0 || maxDelayTime >= maximumAllowedDelayTime)
+ return Exception { NOT_SUPPORTED_ERR };
+ return adoptRef(*new DelayNode(context, sampleRate, maxDelayTime));
+}
+
</ins><span class="cx"> AudioParam* DelayNode::delayTime()
</span><span class="cx"> {
</span><del>- return delayProcessor()->delayTime();
</del><ins>+ return static_cast<DelayProcessor&>(*m_processor).delayTime();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebaudioDelayNodeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webaudio/DelayNode.h (207049 => 207050)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webaudio/DelayNode.h        2016-10-11 06:19:02 UTC (rev 207049)
+++ trunk/Source/WebCore/Modules/webaudio/DelayNode.h        2016-10-11 06:23:49 UTC (rev 207050)
</span><span class="lines">@@ -22,33 +22,20 @@
</span><span class="cx"> * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><del>-#ifndef DelayNode_h
-#define DelayNode_h
</del><ins>+#pragma once
</ins><span class="cx">
</span><span class="cx"> #include "AudioBasicProcessorNode.h"
</span><del>-#include "DelayProcessor.h"
-#include "ExceptionCode.h"
-#include <wtf/Ref.h>
</del><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-class AudioParam;
-
</del><span class="cx"> class DelayNode : public AudioBasicProcessorNode {
</span><span class="cx"> public:
</span><del>- static Ref<DelayNode> create(AudioContext& context, float sampleRate, double maxDelayTime, ExceptionCode& ec)
- {
- return adoptRef(*new DelayNode(context, sampleRate, maxDelayTime, ec));
- }
</del><ins>+ static ExceptionOr<Ref<DelayNode>> create(AudioContext&, float sampleRate, double maxDelayTime);
</ins><span class="cx">
</span><span class="cx"> AudioParam* delayTime();
</span><span class="cx">
</span><span class="cx"> private:
</span><del>- DelayNode(AudioContext&, float sampleRate, double maxDelayTime, ExceptionCode&);
-
- DelayProcessor* delayProcessor() { return static_cast<DelayProcessor*>(processor()); }
</del><ins>+ DelayNode(AudioContext&, float sampleRate, double maxDelayTime);
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span><del>-
-#endif // DelayNode_h
</del></span></pre></div>
<a id="trunkSourceWebCoreModuleswebaudioOfflineAudioContextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webaudio/OfflineAudioContext.cpp (207049 => 207050)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webaudio/OfflineAudioContext.cpp        2016-10-11 06:19:02 UTC (rev 207049)
+++ trunk/Source/WebCore/Modules/webaudio/OfflineAudioContext.cpp        2016-10-11 06:23:49 UTC (rev 207050)
</span><span class="lines">@@ -29,38 +29,24 @@
</span><span class="cx"> #include "OfflineAudioContext.h"
</span><span class="cx">
</span><span class="cx"> #include "Document.h"
</span><del>-#include "ExceptionCode.h"
-#include "ScriptExecutionContext.h"
</del><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-RefPtr<OfflineAudioContext> OfflineAudioContext::create(ScriptExecutionContext& context, unsigned numberOfChannels, size_t numberOfFrames, float sampleRate, ExceptionCode& ec)
-{
- // FIXME: add support for workers.
- if (!is<Document>(context)) {
- ec = NOT_SUPPORTED_ERR;
- return nullptr;
- }
-
- Document& document = downcast<Document>(context);
-
- if (!numberOfChannels || numberOfChannels > 10 || !numberOfFrames || !isSampleRateRangeGood(sampleRate)) {
- ec = SYNTAX_ERR;
- return nullptr;
- }
-
- RefPtr<OfflineAudioContext> audioContext(adoptRef(new OfflineAudioContext(document, numberOfChannels, numberOfFrames, sampleRate)));
- audioContext->suspendIfNeeded();
- return audioContext;
-}
-
-OfflineAudioContext::OfflineAudioContext(Document& document, unsigned numberOfChannels, size_t numberOfFrames, float sampleRate)
</del><ins>+inline OfflineAudioContext::OfflineAudioContext(Document& document, unsigned numberOfChannels, size_t numberOfFrames, float sampleRate)
</ins><span class="cx"> : AudioContext(document, numberOfChannels, numberOfFrames, sampleRate)
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><del>-OfflineAudioContext::~OfflineAudioContext()
</del><ins>+ExceptionOr<Ref<OfflineAudioContext>> OfflineAudioContext::create(ScriptExecutionContext& context, unsigned numberOfChannels, size_t numberOfFrames, float sampleRate)
</ins><span class="cx"> {
</span><ins>+ // FIXME: Add support for workers.
+ if (!is<Document>(context))
+ return Exception { NOT_SUPPORTED_ERR };
+ if (!numberOfChannels || numberOfChannels > 10 || !numberOfFrames || !isSampleRateRangeGood(sampleRate))
+ return Exception { SYNTAX_ERR };
+ auto audioContext = adoptRef(*new OfflineAudioContext(downcast<Document>(context), numberOfChannels, numberOfFrames, sampleRate));
+ audioContext->suspendIfNeeded();
+ return WTFMove(audioContext);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebaudioOfflineAudioContexth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webaudio/OfflineAudioContext.h (207049 => 207050)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webaudio/OfflineAudioContext.h        2016-10-11 06:19:02 UTC (rev 207049)
+++ trunk/Source/WebCore/Modules/webaudio/OfflineAudioContext.h        2016-10-11 06:23:49 UTC (rev 207050)
</span><span class="lines">@@ -22,23 +22,18 @@
</span><span class="cx"> * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><del>-#ifndef OfflineAudioContext_h
-#define OfflineAudioContext_h
</del><ins>+#pragma once
</ins><span class="cx">
</span><span class="cx"> #include "AudioContext.h"
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-class OfflineAudioContext : public AudioContext {
</del><ins>+class OfflineAudioContext final : public AudioContext {
</ins><span class="cx"> public:
</span><del>- static RefPtr<OfflineAudioContext> create(ScriptExecutionContext&, unsigned numberOfChannels, size_t numberOfFrames, float sampleRate, ExceptionCode&);
</del><ins>+ static ExceptionOr<Ref<OfflineAudioContext>> create(ScriptExecutionContext&, unsigned numberOfChannels, size_t numberOfFrames, float sampleRate);
</ins><span class="cx">
</span><del>- virtual ~OfflineAudioContext();
-
</del><span class="cx"> private:
</span><span class="cx"> OfflineAudioContext(Document&, unsigned numberOfChannels, size_t numberOfFrames, float sampleRate);
</span><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span><del>-
-#endif // OfflineAudioContext_h
</del></span></pre></div>
<a id="trunkSourceWebCoreModuleswebaudioOfflineAudioContextidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webaudio/OfflineAudioContext.idl (207049 => 207050)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webaudio/OfflineAudioContext.idl        2016-10-11 06:19:02 UTC (rev 207049)
+++ trunk/Source/WebCore/Modules/webaudio/OfflineAudioContext.idl        2016-10-11 06:23:49 UTC (rev 207050)
</span><span class="lines">@@ -26,9 +26,8 @@
</span><span class="cx"> Conditional=WEB_AUDIO,
</span><span class="cx"> JSGenerateToJSObject,
</span><span class="cx"> Constructor(unsigned long numberOfChannels, unsigned long numberOfFrames, unrestricted float sampleRate),
</span><del>- ConstructorMayThrowLegacyException,
</del><ins>+ ConstructorMayThrowException,
</ins><span class="cx"> ConstructorCallWith=ScriptExecutionContext,
</span><span class="cx"> InterfaceName=webkitOfflineAudioContext
</span><span class="cx"> ] interface OfflineAudioContext : AudioContext {
</span><del>-
</del><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebaudioOfflineAudioDestinationNodecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webaudio/OfflineAudioDestinationNode.cpp (207049 => 207050)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webaudio/OfflineAudioDestinationNode.cpp        2016-10-11 06:19:02 UTC (rev 207049)
+++ trunk/Source/WebCore/Modules/webaudio/OfflineAudioDestinationNode.cpp        2016-10-11 06:23:49 UTC (rev 207050)
</span><span class="lines">@@ -131,7 +131,7 @@
</span><span class="cx">
</span><span class="cx"> for (unsigned channelIndex = 0; channelIndex < numberOfChannels; ++channelIndex) {
</span><span class="cx"> const float* source = m_renderBus->channel(channelIndex)->data();
</span><del>- float* destination = m_renderTarget->getChannelData(channelIndex)->data();
</del><ins>+ float* destination = m_renderTarget->channelData(channelIndex)->data();
</ins><span class="cx"> memcpy(destination + n, source, sizeof(float) * framesAvailableToCopy);
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebaudioOscillatorNodecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webaudio/OscillatorNode.cpp (207049 => 207050)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webaudio/OscillatorNode.cpp        2016-10-11 06:19:02 UTC (rev 207049)
+++ trunk/Source/WebCore/Modules/webaudio/OscillatorNode.cpp        2016-10-11 06:23:49 UTC (rev 207050)
</span><span class="lines">@@ -28,15 +28,10 @@
</span><span class="cx">
</span><span class="cx"> #include "OscillatorNode.h"
</span><span class="cx">
</span><del>-#include "AudioContext.h"
</del><span class="cx"> #include "AudioNodeOutput.h"
</span><del>-#include "AudioUtilities.h"
-#include "ExceptionCode.h"
-#include "ExceptionCodePlaceholder.h"
</del><ins>+#include "AudioParam.h"
</ins><span class="cx"> #include "PeriodicWave.h"
</span><span class="cx"> #include "VectorMath.h"
</span><del>-#include <algorithm>
-#include <wtf/MathExtras.h>
</del><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="lines">@@ -67,7 +62,7 @@
</span><span class="cx"> m_detune = AudioParam::create(context, "detune", 0, -4800, 4800);
</span><span class="cx">
</span><span class="cx"> // Sets up default wave.
</span><del>- setType(m_type, ASSERT_NO_EXCEPTION);
</del><ins>+ setType(m_type);
</ins><span class="cx">
</span><span class="cx"> // An oscillator is always mono.
</span><span class="cx"> addOutput(std::make_unique<AudioNodeOutput>(this, 1));
</span><span class="lines">@@ -80,40 +75,41 @@
</span><span class="cx"> uninitialize();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void OscillatorNode::setType(Type type, ExceptionCode& ec)
</del><ins>+ExceptionOr<void> OscillatorNode::setType(Type type)
</ins><span class="cx"> {
</span><span class="cx"> PeriodicWave* periodicWave = nullptr;
</span><del>- float sampleRate = this->sampleRate();
</del><span class="cx">
</span><span class="cx"> switch (type) {
</span><span class="cx"> case Type::Sine:
</span><span class="cx"> if (!s_periodicWaveSine)
</span><del>- s_periodicWaveSine = &PeriodicWave::createSine(sampleRate).leakRef();
</del><ins>+ s_periodicWaveSine = &PeriodicWave::createSine(sampleRate()).leakRef();
</ins><span class="cx"> periodicWave = s_periodicWaveSine;
</span><span class="cx"> break;
</span><span class="cx"> case Type::Square:
</span><span class="cx"> if (!s_periodicWaveSquare)
</span><del>- s_periodicWaveSquare = &PeriodicWave::createSquare(sampleRate).leakRef();
</del><ins>+ s_periodicWaveSquare = &PeriodicWave::createSquare(sampleRate()).leakRef();
</ins><span class="cx"> periodicWave = s_periodicWaveSquare;
</span><span class="cx"> break;
</span><span class="cx"> case Type::Sawtooth:
</span><span class="cx"> if (!s_periodicWaveSawtooth)
</span><del>- s_periodicWaveSawtooth = &PeriodicWave::createSawtooth(sampleRate).leakRef();
</del><ins>+ s_periodicWaveSawtooth = &PeriodicWave::createSawtooth(sampleRate()).leakRef();
</ins><span class="cx"> periodicWave = s_periodicWaveSawtooth;
</span><span class="cx"> break;
</span><span class="cx"> case Type::Triangle:
</span><span class="cx"> if (!s_periodicWaveTriangle)
</span><del>- s_periodicWaveTriangle = &PeriodicWave::createTriangle(sampleRate).leakRef();
</del><ins>+ s_periodicWaveTriangle = &PeriodicWave::createTriangle(sampleRate()).leakRef();
</ins><span class="cx"> periodicWave = s_periodicWaveTriangle;
</span><span class="cx"> break;
</span><span class="cx"> case Type::Custom:
</span><span class="cx"> if (m_type != Type::Custom)
</span><del>- ec = INVALID_STATE_ERR;
- return;
</del><ins>+ return Exception { INVALID_STATE_ERR };
+ return { };
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> setPeriodicWave(periodicWave);
</span><span class="cx"> m_type = type;
</span><ins>+
+ return { };
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool OscillatorNode::calculateSampleAccuratePhaseIncrements(size_t framesToProcess)
</span><span class="lines">@@ -184,10 +180,10 @@
</span><span class="cx">
</span><span class="cx"> void OscillatorNode::process(size_t framesToProcess)
</span><span class="cx"> {
</span><del>- AudioBus* outputBus = output(0)->bus();
</del><ins>+ auto& outputBus = *output(0)->bus();
</ins><span class="cx">
</span><del>- if (!isInitialized() || !outputBus->numberOfChannels()) {
- outputBus->zero();
</del><ins>+ if (!isInitialized() || !outputBus.numberOfChannels()) {
+ outputBus.zero();
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -199,23 +195,22 @@
</span><span class="cx"> std::unique_lock<Lock> lock(m_processMutex, std::try_to_lock);
</span><span class="cx"> if (!lock.owns_lock()) {
</span><span class="cx"> // Too bad - the try_lock() failed. We must be in the middle of changing wave-tables.
</span><del>- outputBus->zero();
</del><ins>+ outputBus.zero();
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // We must access m_periodicWave only inside the lock.
</span><span class="cx"> if (!m_periodicWave.get()) {
</span><del>- outputBus->zero();
</del><ins>+ outputBus.zero();
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> size_t quantumFrameOffset;
</span><span class="cx"> size_t nonSilentFramesToProcess;
</span><del>-
</del><span class="cx"> updateSchedulingInfo(framesToProcess, outputBus, quantumFrameOffset, nonSilentFramesToProcess);
</span><span class="cx">
</span><span class="cx"> if (!nonSilentFramesToProcess) {
</span><del>- outputBus->zero();
</del><ins>+ outputBus.zero();
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -222,7 +217,7 @@
</span><span class="cx"> unsigned periodicWaveSize = m_periodicWave->periodicWaveSize();
</span><span class="cx"> double invPeriodicWaveSize = 1.0 / periodicWaveSize;
</span><span class="cx">
</span><del>- float* destP = outputBus->channel(0)->mutableData();
</del><ins>+ float* destP = outputBus.channel(0)->mutableData();
</ins><span class="cx">
</span><span class="cx"> ASSERT(quantumFrameOffset <= framesToProcess);
</span><span class="cx">
</span><span class="lines">@@ -292,7 +287,7 @@
</span><span class="cx">
</span><span class="cx"> m_virtualReadIndex = virtualReadIndex;
</span><span class="cx">
</span><del>- outputBus->clearSilentFlag();
</del><ins>+ outputBus.clearSilentFlag();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void OscillatorNode::reset()
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebaudioOscillatorNodeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webaudio/OscillatorNode.h (207049 => 207050)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webaudio/OscillatorNode.h        2016-10-11 06:19:02 UTC (rev 207049)
+++ trunk/Source/WebCore/Modules/webaudio/OscillatorNode.h        2016-10-11 06:23:49 UTC (rev 207050)
</span><span class="lines">@@ -22,23 +22,18 @@
</span><span class="cx"> * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><del>-#ifndef OscillatorNode_h
-#define OscillatorNode_h
</del><ins>+#pragma once
</ins><span class="cx">
</span><del>-#include "AudioBus.h"
-#include "AudioParam.h"
</del><span class="cx"> #include "AudioScheduledSourceNode.h"
</span><span class="cx"> #include <wtf/Lock.h>
</span><del>-#include <wtf/RefPtr.h>
</del><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-class AudioContext;
</del><span class="cx"> class PeriodicWave;
</span><span class="cx">
</span><span class="cx"> // OscillatorNode is an audio generator of periodic waveforms.
</span><span class="cx">
</span><del>-class OscillatorNode : public AudioScheduledSourceNode {
</del><ins>+class OscillatorNode final : public AudioScheduledSourceNode {
</ins><span class="cx"> public:
</span><span class="cx"> // The waveform type.
</span><span class="cx"> enum class Type {
</span><span class="lines">@@ -52,13 +47,9 @@
</span><span class="cx"> static Ref<OscillatorNode> create(AudioContext&, float sampleRate);
</span><span class="cx">
</span><span class="cx"> virtual ~OscillatorNode();
</span><del>-
- // AudioNode
- void process(size_t framesToProcess) override;
- void reset() override;
</del><span class="cx">
</span><span class="cx"> Type type() const { return m_type; }
</span><del>- void setType(Type, ExceptionCode&);
</del><ins>+ ExceptionOr<void> setType(Type);
</ins><span class="cx">
</span><span class="cx"> AudioParam* frequency() { return m_frequency.get(); }
</span><span class="cx"> AudioParam* detune() { return m_detune.get(); }
</span><span class="lines">@@ -68,13 +59,16 @@
</span><span class="cx"> private:
</span><span class="cx"> OscillatorNode(AudioContext&, float sampleRate);
</span><span class="cx">
</span><del>- double tailTime() const override { return 0; }
- double latencyTime() const override { return 0; }
</del><ins>+ void process(size_t framesToProcess) final;
+ void reset() final;
</ins><span class="cx">
</span><ins>+ double tailTime() const final { return 0; }
+ double latencyTime() const final { return 0; }
+
</ins><span class="cx"> // Returns true if there are sample-accurate timeline parameter changes.
</span><span class="cx"> bool calculateSampleAccuratePhaseIncrements(size_t framesToProcess);
</span><span class="cx">
</span><del>- bool propagatesSilence() const override;
</del><ins>+ bool propagatesSilence() const final;
</ins><span class="cx">
</span><span class="cx"> // One of the waveform types defined in the enum.
</span><span class="cx"> Type m_type { Type::Sine };
</span><span class="lines">@@ -108,5 +102,3 @@
</span><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span><del>-
-#endif // OscillatorNode_h
</del></span></pre></div>
<a id="trunkSourceWebCoreModuleswebaudioOscillatorNodeidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webaudio/OscillatorNode.idl (207049 => 207050)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webaudio/OscillatorNode.idl        2016-10-11 06:19:02 UTC (rev 207049)
+++ trunk/Source/WebCore/Modules/webaudio/OscillatorNode.idl        2016-10-11 06:23:49 UTC (rev 207050)
</span><span class="lines">@@ -35,7 +35,7 @@
</span><span class="cx"> Conditional=WEB_AUDIO,
</span><span class="cx"> JSGenerateToJSObject,
</span><span class="cx"> ] interface OscillatorNode : AudioNode {
</span><del>- [SetterMayThrowLegacyException] attribute OscillatorType type;
</del><ins>+ [SetterMayThrowException] attribute OscillatorType type;
</ins><span class="cx">
</span><span class="cx"> // Playback state constants.
</span><span class="cx"> const unsigned short UNSCHEDULED_STATE = 0;
</span><span class="lines">@@ -48,8 +48,8 @@
</span><span class="cx"> readonly attribute AudioParam frequency; // in Hertz
</span><span class="cx"> readonly attribute AudioParam detune; // in Cents
</span><span class="cx">
</span><del>- [MayThrowLegacyException] void start(optional unrestricted double when = 0);
- [MayThrowLegacyException] void stop(optional unrestricted double when = 0);
</del><ins>+ [MayThrowException] void start(optional unrestricted double when = 0);
+ [MayThrowException] void stop(optional unrestricted double when = 0);
</ins><span class="cx">
</span><span class="cx"> void setPeriodicWave(PeriodicWave? wave); // FIXME: The parameter should not be nullable.
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebaudioScriptProcessorNodecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webaudio/ScriptProcessorNode.cpp (207049 => 207050)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webaudio/ScriptProcessorNode.cpp        2016-10-11 06:19:02 UTC (rev 207049)
+++ trunk/Source/WebCore/Modules/webaudio/ScriptProcessorNode.cpp        2016-10-11 06:23:49 UTC (rev 207050)
</span><span class="lines">@@ -183,7 +183,7 @@
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> for (unsigned i = 0; i < numberOfInputChannels; i++)
</span><del>- m_internalInputBus->setChannelMemory(i, inputBuffer->getChannelData(i)->data() + m_bufferReadWriteIndex, framesToProcess);
</del><ins>+ m_internalInputBus->setChannelMemory(i, inputBuffer->channelData(i)->data() + m_bufferReadWriteIndex, framesToProcess);
</ins><span class="cx">
</span><span class="cx"> if (numberOfInputChannels)
</span><span class="cx"> m_internalInputBus->copyFrom(*inputBus);
</span><span class="lines">@@ -190,7 +190,7 @@
</span><span class="cx">
</span><span class="cx"> // Copy from the output buffer to the output.
</span><span class="cx"> for (unsigned i = 0; i < numberOfOutputChannels; ++i)
</span><del>- memcpy(outputBus->channel(i)->mutableData(), outputBuffer->getChannelData(i)->data() + m_bufferReadWriteIndex, sizeof(float) * framesToProcess);
</del><ins>+ memcpy(outputBus->channel(i)->mutableData(), outputBuffer->channelData(i)->data() + m_bufferReadWriteIndex, sizeof(float) * framesToProcess);
</ins><span class="cx">
</span><span class="cx"> // Update the buffering index.
</span><span class="cx"> m_bufferReadWriteIndex = (m_bufferReadWriteIndex + framesToProcess) % bufferSize();
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSDOMBindingh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSDOMBinding.h (207049 => 207050)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSDOMBinding.h        2016-10-11 06:19:02 UTC (rev 207049)
+++ trunk/Source/WebCore/bindings/js/JSDOMBinding.h        2016-10-11 06:23:49 UTC (rev 207050)
</span><span class="lines">@@ -263,8 +263,9 @@
</span><span class="cx"> // Validates that the passed object is a sequence type per section 4.1.13 of the WebIDL spec.
</span><span class="cx"> JSC::JSObject* toJSSequence(JSC::ExecState&, JSC::JSValue, unsigned& length);
</span><span class="cx">
</span><ins>+JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, JSC::ArrayBuffer&);
+JSC::JSValue toJS(JSC::ExecState*, JSC::JSGlobalObject*, JSC::ArrayBufferView&);
</ins><span class="cx"> JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, JSC::ArrayBuffer*);
</span><del>-JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, JSC::ArrayBufferView*);
</del><span class="cx"> JSC::JSValue toJS(JSC::ExecState*, JSC::JSGlobalObject*, JSC::ArrayBufferView*);
</span><span class="cx"> template<typename T> JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, Ref<T>&&);
</span><span class="cx"> template<typename T> JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, RefPtr<T>&&);
</span><span class="lines">@@ -591,29 +592,32 @@
</span><span class="cx"> return object;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-inline JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, JSC::ArrayBuffer* buffer)
</del><ins>+inline JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, JSC::ArrayBuffer& buffer)
</ins><span class="cx"> {
</span><del>- if (!buffer)
- return JSC::jsNull();
- if (JSC::JSValue result = getCachedWrapper(globalObject->world(), *buffer))
</del><ins>+ if (auto result = getCachedWrapper(globalObject->world(), buffer))
</ins><span class="cx"> return result;
</span><span class="cx">
</span><span class="cx"> // The JSArrayBuffer::create function will register the wrapper in finishCreation.
</span><del>- return JSC::JSArrayBuffer::create(exec->vm(), globalObject->arrayBufferStructure(), buffer);
</del><ins>+ return JSC::JSArrayBuffer::create(state->vm(), globalObject->arrayBufferStructure(), &buffer);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-inline JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, JSC::ArrayBufferView* view)
</del><ins>+inline JSC::JSValue toJS(JSC::ExecState* state, JSC::JSGlobalObject* globalObject, JSC::ArrayBufferView& view)
</ins><span class="cx"> {
</span><del>- if (!view)
</del><ins>+ return view.wrap(state, globalObject);
+}
+
+inline JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, JSC::ArrayBuffer* buffer)
+{
+ if (!buffer)
</ins><span class="cx"> return JSC::jsNull();
</span><del>- return view->wrap(exec, globalObject);
</del><ins>+ return toJS(state, globalObject, *buffer);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-inline JSC::JSValue toJS(JSC::ExecState* exec, JSC::JSGlobalObject* globalObject, JSC::ArrayBufferView* view)
</del><ins>+inline JSC::JSValue toJS(JSC::ExecState* state, JSC::JSGlobalObject* globalObject, JSC::ArrayBufferView* view)
</ins><span class="cx"> {
</span><span class="cx"> if (!view)
</span><span class="cx"> return JSC::jsNull();
</span><del>- return view->wrap(exec, globalObject);
</del><ins>+ return toJS(state, globalObject, *view);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> template<typename T> inline JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, Ref<T>&& ptr)
</span></span></pre>
</div>
</div>
</body>
</html>