<!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  &lt;darin@apple.com&gt;
+
+        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  &lt;youenn@apple.com&gt;
</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 &quot;AudioNodeInput.h&quot;
</span><span class="cx"> #include &quot;AudioNodeOutput.h&quot;
</span><del>-#include &quot;ExceptionCode.h&quot;
</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&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; 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&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; AnalyserNode::setMinDecibels(double k)
</ins><span class="cx"> {
</span><del>-    if (k &gt; maxDecibels()) {
-        ec = INDEX_SIZE_ERR;
-        return;
-    }
</del><ins>+    if (k &gt; 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&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; AnalyserNode::setMaxDecibels(double k)
</ins><span class="cx"> {
</span><del>-    if (k &lt; minDecibels()) {
-        ec = INDEX_SIZE_ERR;
-        return;
-    }
</del><ins>+    if (k &lt; 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&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; AnalyserNode::setSmoothingTimeConstant(double k)
</ins><span class="cx"> {
</span><del>-    if (k &lt; 0 || k &gt; 1) {
-        ec = INDEX_SIZE_ERR;
-        return;
-    }
</del><ins>+    if (k &lt; 0 || k &gt; 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 &quot;AudioBasicInspectorNode.h&quot;
</span><span class="cx"> #include &quot;RealtimeAnalyser.h&quot;
</span><del>-#include &lt;wtf/Forward.h&gt;
</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&lt;AnalyserNode&gt; create(AudioContext&amp; 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&amp;);
</del><ins>+    ExceptionOr&lt;void&gt; 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&amp;);
</del><ins>+    ExceptionOr&lt;void&gt; setMinDecibels(double);
</ins><span class="cx">     double minDecibels() const { return m_analyser.minDecibels(); }
</span><span class="cx"> 
</span><del>-    void setMaxDecibels(double k, ExceptionCode&amp;);
</del><ins>+    ExceptionOr&lt;void&gt; setMaxDecibels(double);
</ins><span class="cx">     double maxDecibels() const { return m_analyser.maxDecibels(); }
</span><span class="cx"> 
</span><del>-    void setSmoothingTimeConstant(double k, ExceptionCode&amp;);
</del><ins>+    ExceptionOr&lt;void&gt; 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&lt;JSC::Float32Array&gt;&amp; array) { m_analyser.getFloatFrequencyData(array.get()); }
</span><span class="lines">@@ -64,14 +57,15 @@
</span><span class="cx">     void getByteTimeDomainData(const RefPtr&lt;JSC::Uint8Array&gt;&amp; 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&amp;, 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 -&gt; 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 &quot;AudioBasicInspectorNode.h&quot;
</span><span class="cx"> 
</span><del>-#include &quot;AudioContext.h&quot;
</del><span class="cx"> #include &quot;AudioNodeInput.h&quot;
</span><span class="cx"> #include &quot;AudioNodeOutput.h&quot;
</span><span class="cx"> 
</span><span class="lines">@@ -36,7 +35,6 @@
</span><span class="cx"> 
</span><span class="cx"> AudioBasicInspectorNode::AudioBasicInspectorNode(AudioContext&amp; 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&lt;AudioNodeInput&gt;(this));
</span><span class="cx">     addOutput(std::make_unique&lt;AudioNodeOutput&gt;(this, outputChannelCount));
</span><span class="lines">@@ -51,24 +49,26 @@
</span><span class="cx">     input(0)-&gt;pull(output(0)-&gt;bus(), framesToProcess);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void AudioBasicInspectorNode::connect(AudioNode* destination, unsigned outputIndex, unsigned inputIndex, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; 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&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; 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 &quot;AudioNode.h&quot;
</span><span class="cx"> 
</span><span class="lines">@@ -36,17 +35,15 @@
</span><span class="cx"> public:
</span><span class="cx">     AudioBasicInspectorNode(AudioContext&amp;, 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&amp;) override;
-    void disconnect(unsigned outputIndex, ExceptionCode&amp;) override;
</del><ins>+    ExceptionOr&lt;void&gt; connect(AudioNode*, unsigned outputIndex, unsigned inputIndex) override;
+    ExceptionOr&lt;void&gt; 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 &quot;AudioBuffer.h&quot;
</span><span class="cx"> 
</span><del>-#include &quot;AudioBus.h&quot;
</del><span class="cx"> #include &quot;AudioContext.h&quot;
</span><span class="cx"> #include &quot;AudioFileReader.h&quot;
</span><del>-#include &quot;ExceptionCode.h&quot;
-#include &quot;ExceptionCodePlaceholder.h&quot;
-
</del><span class="cx"> #include &lt;runtime/JSCInlines.h&gt;
</span><span class="cx"> #include &lt;runtime/TypedArrayInlines.h&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -47,7 +43,6 @@
</span><span class="cx"> {
</span><span class="cx">     if (sampleRate &lt; 22050 || sampleRate &gt; 96000 || numberOfChannels &gt; 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&lt;AudioBuffer&gt; AudioBuffer::createFromAudioFileData(const void* data, size_t dataSize, bool mixToMono, float sampleRate)
</span><span class="cx"> {
</span><span class="cx">     RefPtr&lt;AudioBus&gt; 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-&gt;sampleRate())
-    , m_length(bus-&gt;length())
</del><ins>+AudioBuffer::AudioBuffer(AudioBus&amp; 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-&gt;numberOfChannels();
</del><ins>+    unsigned numberOfChannels = bus.numberOfChannels();
</ins><span class="cx">     m_channels.reserveCapacity(numberOfChannels);
</span><span class="cx">     for (unsigned i = 0; i &lt; numberOfChannels; ++i) {
</span><del>-        RefPtr&lt;Float32Array&gt; channelDataArray = Float32Array::create(m_length);
</del><ins>+        auto channelDataArray = Float32Array::create(m_length);
</ins><span class="cx">         channelDataArray-&gt;setNeuterable(false);
</span><del>-        channelDataArray-&gt;setRange(bus-&gt;channel(i)-&gt;data(), m_length, 0);
-        m_channels.append(channelDataArray);
</del><ins>+        channelDataArray-&gt;setRange(bus.channel(i)-&gt;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&lt;Float32Array&gt; AudioBuffer::getChannelData(unsigned channelIndex, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;Ref&lt;Float32Array&gt;&gt; AudioBuffer::getChannelData(unsigned channelIndex)
</ins><span class="cx"> {
</span><del>-    if (channelIndex &gt;= m_channels.size()) {
-        ec = SYNTAX_ERR;
-        return nullptr;
-    }
-
-    Float32Array* channelData = m_channels[channelIndex].get();
-    return Float32Array::create(channelData-&gt;buffer(), channelData-&gt;byteOffset(), channelData-&gt;length());
</del><ins>+    if (channelIndex &gt;= m_channels.size())
+        return Exception { SYNTAX_ERR };
+    auto&amp; 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 &gt;= 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 &lt; m_channels.size(); ++i) {
-        if (getChannelData(i))
-            getChannelData(i)-&gt;zeroRange(0, length());
-    }
</del><ins>+    for (auto&amp; channel : m_channels)
+        channel-&gt;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 &quot;ExceptionOr.h&quot;
</ins><span class="cx"> #include &lt;runtime/Float32Array.h&gt;
</span><del>-#include &lt;wtf/RefCounted.h&gt;
-#include &lt;wtf/RefPtr.h&gt;
</del><span class="cx"> #include &lt;wtf/Vector.h&gt;
</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&lt;AudioBuffer&gt; {
</span><span class="cx"> public:   
</span><span class="cx">     static RefPtr&lt;AudioBuffer&gt; 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&lt;AudioBuffer&gt; 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&lt;Float32Array&gt; getChannelData(unsigned channelIndex, ExceptionCode&amp;);
-    Float32Array* getChannelData(unsigned channelIndex);
</del><ins>+    ExceptionOr&lt;Ref&lt;Float32Array&gt;&gt; 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&amp;);
</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&lt;RefPtr&lt;Float32Array&gt;&gt; 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 &quot;AudioBufferSourceNode.h&quot;
</span><span class="cx"> 
</span><ins>+#include &quot;AudioBuffer.h&quot;
</ins><span class="cx"> #include &quot;AudioContext.h&quot;
</span><span class="cx"> #include &quot;AudioNodeOutput.h&quot;
</span><ins>+#include &quot;AudioParam.h&quot;
</ins><span class="cx"> #include &quot;AudioUtilities.h&quot;
</span><span class="cx"> #include &quot;FloatConversion.h&quot;
</span><del>-#include &quot;ScriptController.h&quot;
</del><ins>+#include &quot;PannerNode.h&quot;
</ins><span class="cx"> #include &quot;ScriptExecutionContext.h&quot;
</span><del>-#include &lt;algorithm&gt;
-#include &lt;inspector/ScriptCallStack.h&gt;
-#include &lt;wtf/MainThread.h&gt;
-#include &lt;wtf/MathExtras.h&gt;
-#include &lt;wtf/StdLibExtras.h&gt;
</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)-&gt;bus();
</del><ins>+    auto&amp; outputBus = *output(0)-&gt;bus();
</ins><span class="cx"> 
</span><span class="cx">     if (!isInitialized()) {
</span><del>-        outputBus-&gt;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&lt;Lock&gt; 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-&gt;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-&gt;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()-&gt;numberOfChannels()) {
</span><del>-        outputBus-&gt;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-&gt;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 &lt; outputBus-&gt;numberOfChannels(); ++i)
-        m_destinationChannels[i] = outputBus-&gt;channel(i)-&gt;mutableData();
</del><ins>+    for (unsigned i = 0; i &lt; outputBus.numberOfChannels(); ++i)
+        m_destinationChannels[i] = outputBus.channel(i)-&gt;mutableData();
</ins><span class="cx"> 
</span><span class="cx">     // Render by reading directly from the buffer.
</span><del>-    if (!renderFromBuffer(outputBus, quantumFrameOffset, bufferFramesToProcess)) {
-        outputBus-&gt;zero();
</del><ins>+    if (!renderFromBuffer(&amp;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()-&gt;value() * m_buffer-&gt;gain();
</span><del>-    outputBus-&gt;copyWithGainFrom(*outputBus, &amp;m_lastGain, totalGain);
-    outputBus-&gt;clearSilentFlag();
</del><ins>+    outputBus.copyWithGainFrom(outputBus, &amp;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&lt;float*[]&gt;(numberOfChannels);
</span><span class="cx"> 
</span><span class="cx">         for (unsigned i = 0; i &lt; numberOfChannels; ++i) 
</span><del>-            m_sourceChannels[i] = buffer-&gt;getChannelData(i)-&gt;data();
</del><ins>+            m_sourceChannels[i] = buffer-&gt;channelData(i)-&gt;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)-&gt;numberOfChannels();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void AudioBufferSourceNode::start(double when, double grainOffset, Optional&lt;double&gt; optionalGrainDuration, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; AudioBufferSourceNode::start(double when, double grainOffset, Optional&lt;double&gt; 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()-&gt;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&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; 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 &lt; 0)) {
-        ec = INVALID_STATE_ERR;
-        return;
-    }
</del><ins>+    if (!std::isfinite(when) || (when &lt; 0))
+        return Exception { INVALID_STATE_ERR };
</ins><span class="cx"> 
</span><del>-    if (!std::isfinite(grainOffset) || (grainOffset &lt; 0)) {
-        ec = INVALID_STATE_ERR;
-        return;
-    }
</del><ins>+    if (!std::isfinite(grainOffset) || (grainOffset &lt; 0))
+        return Exception { INVALID_STATE_ERR };
</ins><span class="cx"> 
</span><del>-    if (!std::isfinite(grainDuration) || (grainDuration &lt; 0)) {
-        ec = INVALID_STATE_ERR;
-        return;
-    }
</del><ins>+    if (!std::isfinite(grainDuration) || (grainDuration &lt; 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()-&gt;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 &quot;AudioBuffer.h&quot;
-#include &quot;AudioBus.h&quot;
-#include &quot;AudioParam.h&quot;
</del><span class="cx"> #include &quot;AudioScheduledSourceNode.h&quot;
</span><del>-#include &quot;ExceptionCode.h&quot;
-#include &quot;PannerNode.h&quot;
-#include &lt;memory&gt;
</del><span class="cx"> #include &lt;wtf/Lock.h&gt;
</span><del>-#include &lt;wtf/RefPtr.h&gt;
</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&lt;AudioBufferSourceNode&gt; create(AudioContext&amp;, 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&lt;double&gt; grainDuration, ExceptionCode&amp;);
</del><ins>+    ExceptionOr&lt;void&gt; start(double when, double grainOffset, Optional&lt;double&gt; 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 &lt;audio&gt;
</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&amp;, 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&amp;);
</del><ins>+    ExceptionOr&lt;void&gt; 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&lt;AudioBuffer&gt; AudioContext::createBuffer(unsigned numberOfChannels, size_t numberOfFrames, float sampleRate, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;Ref&lt;AudioBuffer&gt;&gt; AudioContext::createBuffer(unsigned numberOfChannels, size_t numberOfFrames, float sampleRate)
</ins><span class="cx"> {
</span><del>-    RefPtr&lt;AudioBuffer&gt; 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&lt;AudioBuffer&gt; AudioContext::createBuffer(ArrayBuffer&amp; arrayBuffer, bool mixToMono, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;Ref&lt;AudioBuffer&gt;&gt; AudioContext::createBuffer(ArrayBuffer&amp; arrayBuffer, bool mixToMono)
</ins><span class="cx"> {
</span><del>-    RefPtr&lt;AudioBuffer&gt; 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&lt;ArrayBuffer&gt;&amp;&amp; audioData, RefPtr&lt;AudioBufferCallback&gt;&amp;&amp; successCallback, RefPtr&lt;AudioBufferCallback&gt;&amp;&amp; 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&lt;MediaElementAudioSourceNode&gt; AudioContext::createMediaElementSource(HTMLMediaElement&amp; mediaElement, ExceptionCode&amp; ec)
</del><ins>+
+ExceptionOr&lt;Ref&lt;MediaElementAudioSourceNode&gt;&gt; AudioContext::createMediaElementSource(HTMLMediaElement&amp; 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&lt;MediaElementAudioSourceNode&gt; 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&lt;MediaStreamAudioSourceNode&gt; AudioContext::createMediaStreamSource(MediaStream&amp; mediaStream, ExceptionCode&amp; ec)
</del><ins>+
+ExceptionOr&lt;Ref&lt;MediaStreamAudioSourceNode&gt;&gt; AudioContext::createMediaStreamSource(MediaStream&amp; 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&amp; 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&lt;ScriptProcessorNode&gt; AudioContext::createScriptProcessor(size_t bufferSize, size_t numberOfInputChannels, size_t numberOfOutputChannels, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;Ref&lt;ScriptProcessorNode&gt;&gt; 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&lt;ScriptProcessorNode&gt; node = ScriptProcessorNode::create(*this, m_destinationNode-&gt;sampleRate(), bufferSize, numberOfInputChannels, numberOfOutputChannels);
</del><ins>+    auto node = ScriptProcessorNode::create(*this, m_destinationNode-&gt;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&lt;BiquadFilterNode&gt; AudioContext::createBiquadFilter()
</span><span class="lines">@@ -532,44 +519,31 @@
</span><span class="cx">     return GainNode::create(*this, m_destinationNode-&gt;sampleRate());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-RefPtr&lt;DelayNode&gt; AudioContext::createDelay(double maxDelayTime, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;Ref&lt;DelayNode&gt;&gt; AudioContext::createDelay(double maxDelayTime)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(isMainThread());
</span><span class="cx">     lazyInitialize();
</span><del>-    Ref&lt;DelayNode&gt; node = DelayNode::create(*this, m_destinationNode-&gt;sampleRate(), maxDelayTime, ec);
-    if (ec)
-        return nullptr;
-    return WTFMove(node);
</del><ins>+    return DelayNode::create(*this, m_destinationNode-&gt;sampleRate(), maxDelayTime);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-RefPtr&lt;ChannelSplitterNode&gt; AudioContext::createChannelSplitter(size_t numberOfOutputs, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;Ref&lt;ChannelSplitterNode&gt;&gt; AudioContext::createChannelSplitter(size_t numberOfOutputs)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(isMainThread());
</span><span class="cx">     lazyInitialize();
</span><del>-
-    RefPtr&lt;ChannelSplitterNode&gt; node = ChannelSplitterNode::create(*this, m_destinationNode-&gt;sampleRate(), numberOfOutputs);
-
-    if (!node) {
-        ec = INDEX_SIZE_ERR;
-        return nullptr;
-    }
-
-    return node;
</del><ins>+    auto node = ChannelSplitterNode::create(*this, m_destinationNode-&gt;sampleRate(), numberOfOutputs);
+    if (!node)
+        return Exception { INDEX_SIZE_ERR };
+    return node.releaseNonNull();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-RefPtr&lt;ChannelMergerNode&gt; AudioContext::createChannelMerger(size_t numberOfInputs, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;Ref&lt;ChannelMergerNode&gt;&gt; AudioContext::createChannelMerger(size_t numberOfInputs)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(isMainThread());
</span><span class="cx">     lazyInitialize();
</span><del>-
-    RefPtr&lt;ChannelMergerNode&gt; node = ChannelMergerNode::create(*this, m_destinationNode-&gt;sampleRate(), numberOfInputs);
-
-    if (!node) {
-        ec = INDEX_SIZE_ERR;
-        return nullptr;
-    }
-
-    return node;
</del><ins>+    auto node = ChannelMergerNode::create(*this, m_destinationNode-&gt;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&lt;OscillatorNode&gt; 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&lt;PeriodicWave&gt; AudioContext::createPeriodicWave(Float32Array&amp; real, Float32Array&amp; imaginary, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;Ref&lt;PeriodicWave&gt;&gt; AudioContext::createPeriodicWave(Float32Array&amp; real, Float32Array&amp; imaginary)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(isMainThread());
</span><del>-    
-    if (real.length() != imaginary.length() || (real.length() &gt; MaxPeriodicWaveLength) || !real.length()) {
-        ec = INDEX_SIZE_ERR;
-        return nullptr;
-    }
-    
</del><ins>+    if (real.length() != imaginary.length() || (real.length() &gt; 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&lt;AudioBuffer&gt; createBuffer(unsigned numberOfChannels, size_t numberOfFrames, float sampleRate, ExceptionCode&amp;);
-    RefPtr&lt;AudioBuffer&gt; createBuffer(ArrayBuffer&amp;, bool mixToMono, ExceptionCode&amp;);
</del><ins>+    ExceptionOr&lt;Ref&lt;AudioBuffer&gt;&gt; createBuffer(unsigned numberOfChannels, size_t numberOfFrames, float sampleRate);
+    ExceptionOr&lt;Ref&lt;AudioBuffer&gt;&gt; createBuffer(ArrayBuffer&amp;, bool mixToMono);
</ins><span class="cx"> 
</span><span class="cx">     // Asynchronous audio file data decoding.
</span><span class="cx">     void decodeAudioData(Ref&lt;ArrayBuffer&gt;&amp;&amp;, RefPtr&lt;AudioBufferCallback&gt;&amp;&amp;, RefPtr&lt;AudioBufferCallback&gt;&amp;&amp;);
</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&lt;AudioBufferSourceNode&gt; createBufferSource();
</span><span class="cx"> #if ENABLE(VIDEO)
</span><del>-    RefPtr&lt;MediaElementAudioSourceNode&gt; createMediaElementSource(HTMLMediaElement&amp;, ExceptionCode&amp;);
</del><ins>+    ExceptionOr&lt;Ref&lt;MediaElementAudioSourceNode&gt;&gt; createMediaElementSource(HTMLMediaElement&amp;);
</ins><span class="cx"> #endif
</span><span class="cx"> #if ENABLE(MEDIA_STREAM)
</span><del>-    RefPtr&lt;MediaStreamAudioSourceNode&gt; createMediaStreamSource(MediaStream&amp;, ExceptionCode&amp;);
</del><ins>+    ExceptionOr&lt;Ref&lt;MediaStreamAudioSourceNode&gt;&gt; createMediaStreamSource(MediaStream&amp;);
</ins><span class="cx">     Ref&lt;MediaStreamAudioDestinationNode&gt; createMediaStreamDestination();
</span><span class="cx"> #endif
</span><span class="cx">     Ref&lt;GainNode&gt; createGain();
</span><span class="cx">     Ref&lt;BiquadFilterNode&gt; createBiquadFilter();
</span><span class="cx">     Ref&lt;WaveShaperNode&gt; createWaveShaper();
</span><del>-    RefPtr&lt;DelayNode&gt; createDelay(double maxDelayTime, ExceptionCode&amp;);
</del><ins>+    ExceptionOr&lt;Ref&lt;DelayNode&gt;&gt; createDelay(double maxDelayTime);
</ins><span class="cx">     Ref&lt;PannerNode&gt; createPanner();
</span><span class="cx">     Ref&lt;ConvolverNode&gt; createConvolver();
</span><span class="cx">     Ref&lt;DynamicsCompressorNode&gt; createDynamicsCompressor();
</span><span class="cx">     Ref&lt;AnalyserNode&gt; createAnalyser();
</span><del>-    RefPtr&lt;ScriptProcessorNode&gt; createScriptProcessor(size_t bufferSize, size_t numberOfInputChannels, size_t numberOfOutputChannels, ExceptionCode&amp;);
-    RefPtr&lt;ChannelSplitterNode&gt; createChannelSplitter(size_t numberOfOutputs, ExceptionCode&amp;);
-    RefPtr&lt;ChannelMergerNode&gt; createChannelMerger(size_t numberOfInputs, ExceptionCode&amp;);
</del><ins>+    ExceptionOr&lt;Ref&lt;ScriptProcessorNode&gt;&gt; createScriptProcessor(size_t bufferSize, size_t numberOfInputChannels, size_t numberOfOutputChannels);
+    ExceptionOr&lt;Ref&lt;ChannelSplitterNode&gt;&gt; createChannelSplitter(size_t numberOfOutputs);
+    ExceptionOr&lt;Ref&lt;ChannelMergerNode&gt;&gt; createChannelMerger(size_t numberOfInputs);
</ins><span class="cx">     Ref&lt;OscillatorNode&gt; createOscillator();
</span><del>-    RefPtr&lt;PeriodicWave&gt; createPeriodicWave(Float32Array&amp; real, Float32Array&amp; imaginary, ExceptionCode&amp;);
</del><ins>+    ExceptionOr&lt;Ref&lt;PeriodicWave&gt;&gt; createPeriodicWave(Float32Array&amp; real, Float32Array&amp; 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&lt;double&gt;(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&amp; 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&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; 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 &gt;= numberOfOutputs()) {
-        ec = INDEX_SIZE_ERR;
-        return;
-    }
</del><ins>+    if (outputIndex &gt;= numberOfOutputs())
+        return Exception { INDEX_SIZE_ERR };
</ins><span class="cx"> 
</span><del>-    if (destination &amp;&amp; inputIndex &gt;= destination-&gt;numberOfInputs()) {
-        ec = INDEX_SIZE_ERR;
-        return;
-    }
</del><ins>+    if (destination &amp;&amp; inputIndex &gt;= destination-&gt;numberOfInputs())
+        return Exception { INDEX_SIZE_ERR };
</ins><span class="cx"> 
</span><del>-    if (context() != destination-&gt;context()) {
-        ec = SYNTAX_ERR;
-        return;
-    }
</del><ins>+    if (context() != destination-&gt;context())
+        return Exception { SYNTAX_ERR };
</ins><span class="cx"> 
</span><del>-    AudioNodeInput* input = destination-&gt;input(inputIndex);
-    AudioNodeOutput* output = this-&gt;output(outputIndex);
</del><ins>+    auto* input = destination-&gt;input(inputIndex);
+    auto* output = this-&gt;output(outputIndex);
</ins><span class="cx">     input-&gt;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&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; 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 &gt;= numberOfOutputs()) {
-        ec = INDEX_SIZE_ERR;
-        return;
-    }
</del><ins>+    if (outputIndex &gt;= numberOfOutputs())
+        return Exception { INDEX_SIZE_ERR };
</ins><span class="cx"> 
</span><del>-    if (context() != param-&gt;context()) {
-        ec = SYNTAX_ERR;
-        return;
-    }
</del><ins>+    if (context() != param-&gt;context())
+        return Exception { SYNTAX_ERR };
</ins><span class="cx"> 
</span><del>-    AudioNodeOutput* output = this-&gt;output(outputIndex);
</del><ins>+    auto* output = this-&gt;output(outputIndex);
</ins><span class="cx">     param-&gt;connect(output);
</span><ins>+
+    return { };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void AudioNode::disconnect(unsigned outputIndex, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; 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 &gt;= numberOfOutputs()) {
-        ec = INDEX_SIZE_ERR;
-        return;
-    }
</del><ins>+    if (outputIndex &gt;= numberOfOutputs())
+        return Exception { INDEX_SIZE_ERR };
</ins><span class="cx"> 
</span><del>-    AudioNodeOutput* output = this-&gt;output(outputIndex);
</del><ins>+    auto* output = this-&gt;output(outputIndex);
</ins><span class="cx">     output-&gt;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&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; 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 &gt; 0 &amp;&amp; channelCount &lt;= AudioContext::maxNumberOfChannels()) {
-        if (m_channelCount != channelCount) {
-            m_channelCount = channelCount;
-            if (m_channelCountMode != Max)
-                updateChannelsForInputs();
-        }
-    } else
-        ec = INVALID_STATE_ERR;
</del><ins>+    if (!(channelCount &gt; 0 &amp;&amp; channelCount &lt;= 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&amp; mode, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; AudioNode::setChannelCountMode(const String&amp; 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 == &quot;explicit&quot;)
</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&amp; interpretation, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; AudioNode::setChannelInterpretation(const String&amp; 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 == &quot;discrete&quot;)
</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 &quot;AudioBus.h&quot;
</span><span class="cx"> #include &quot;EventTarget.h&quot;
</span><del>-#include &lt;memory&gt;
</del><ins>+#include &quot;ExceptionOr.h&quot;
</ins><span class="cx"> #include &lt;wtf/Forward.h&gt;
</span><del>-#include &lt;wtf/Vector.h&gt;
</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&amp;);
-    void connect(AudioParam*, unsigned outputIndex, ExceptionCode&amp;);
-    virtual void disconnect(unsigned outputIndex, ExceptionCode&amp;);
</del><ins>+    virtual ExceptionOr&lt;void&gt; connect(AudioNode*, unsigned outputIndex, unsigned inputIndex);
+    ExceptionOr&lt;void&gt; connect(AudioParam*, unsigned outputIndex);
+    virtual ExceptionOr&lt;void&gt; 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&amp;);
</del><ins>+    unsigned channelCount();
+    virtual ExceptionOr&lt;void&gt; setChannelCount(unsigned);
</ins><span class="cx"> 
</span><span class="cx">     String channelCountMode();
</span><del>-    void setChannelCountMode(const String&amp;, ExceptionCode&amp;);
</del><ins>+    ExceptionOr&lt;void&gt; setChannelCountMode(const String&amp;);
</ins><span class="cx"> 
</span><span class="cx">     String channelInterpretation();
</span><del>-    void setChannelInterpretation(const String&amp;, ExceptionCode&amp;);
</del><ins>+    ExceptionOr&lt;void&gt; setChannelInterpretation(const String&amp;);
</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&amp; 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&amp; quantumFrameOffset,
-                                                    size_t&amp; nonSilentFramesToProcess)
</del><ins>+void AudioScheduledSourceNode::updateSchedulingInfo(size_t quantumFrameSize, AudioBus&amp; outputBus, size_t&amp; quantumFrameOffset, size_t&amp; 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 &gt;= quantumEndFrame) {
</span><span class="cx">         // Output silence.
</span><del>-        outputBus-&gt;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-&gt;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 &lt; outputBus-&gt;numberOfChannels(); ++i)
-            memset(outputBus-&gt;channel(i)-&gt;mutableData(), 0, sizeof(float) * quantumFrameOffset);
</del><ins>+        for (unsigned i = 0; i &lt; outputBus.numberOfChannels(); ++i)
+            memset(outputBus.channel(i)-&gt;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 &lt; outputBus-&gt;numberOfChannels(); ++i)
-                memset(outputBus-&gt;channel(i)-&gt;mutableData() + zeroStartFrame, 0, sizeof(float) * framesToZero);
</del><ins>+            for (unsigned i = 0; i &lt; outputBus.numberOfChannels(); ++i)
+                memset(outputBus.channel(i)-&gt;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&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; 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 &lt; 0)
+        return Exception { INVALID_STATE_ERR };
</ins><span class="cx"> 
</span><del>-    if (!std::isfinite(when) || (when &lt; 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&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; 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 &lt; 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 &lt; 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 &quot;AudioNode.h&quot;
</span><del>-#include &quot;ExceptionCode.h&quot;
</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&amp;, float sampleRate);
</span><span class="cx"> 
</span><del>-    // Scheduling.
-    void start(double when, ExceptionCode&amp;);
-    void stop(double when, ExceptionCode&amp;);
</del><ins>+    ExceptionOr&lt;void&gt; start(double when);
+    ExceptionOr&lt;void&gt; stop(double when);
</ins><span class="cx"> 
</span><span class="cx">     unsigned short playbackState() const { return static_cast&lt;unsigned short&gt;(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 &lt;= quantumFrameSize).
-    void updateSchedulingInfo(size_t quantumFrameSize,
-                              AudioBus* outputBus,
-                              size_t&amp; quantumFrameOffset,
-                              size_t&amp; nonSilentFramesToProcess);
</del><ins>+    // quantumFrameOffset: Offset frame in this time quantum to start rendering.
+    // nonSilentFramesToProcess: Number of frames rendering non-silence (will be &lt;= quantumFrameSize).
+    void updateSchedulingInfo(size_t quantumFrameSize, AudioBus&amp; outputBus, size_t&amp; quantumFrameOffset, size_t&amp; 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 &quot;now&quot;).
</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 &quot;now&quot;).
</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 &quot;ConvolverNode.h&quot;
</span><span class="cx"> 
</span><del>-#include &quot;AudioBuffer.h&quot;
-#include &quot;AudioContext.h&quot;
</del><span class="cx"> #include &quot;AudioNodeInput.h&quot;
</span><span class="cx"> #include &quot;AudioNodeOutput.h&quot;
</span><del>-#include &quot;ExceptionCode.h&quot;
</del><span class="cx"> #include &quot;Reverb.h&quot;
</span><del>-#include &lt;wtf/MainThread.h&gt;
</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&amp; 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&lt;AudioNodeInput&gt;(this));
</span><span class="cx">     addOutput(std::make_unique&lt;AudioNodeOutput&gt;(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&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; 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-&gt;sampleRate() != context().sampleRate()) {
-        ec = NOT_SUPPORTED_ERR;
-        return;
-    }
</del><ins>+    if (buffer-&gt;sampleRate() != context().sampleRate())
+        return Exception { NOT_SUPPORTED_ERR };
</ins><span class="cx"> 
</span><span class="cx">     unsigned numberOfChannels = buffer-&gt;numberOfChannels();
</span><span class="cx">     size_t bufferLength = buffer-&gt;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) &amp;&amp; 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&lt;AudioBus&gt; bufferBus = AudioBus::create(numberOfChannels, bufferLength, false);
</del><ins>+    auto bufferBus = AudioBus::create(numberOfChannels, bufferLength, false);
</ins><span class="cx">     for (unsigned i = 0; i &lt; numberOfChannels; ++i)
</span><del>-        bufferBus-&gt;setChannelMemory(i, buffer-&gt;getChannelData(i)-&gt;data(), bufferLength);
</del><ins>+        bufferBus-&gt;setChannelMemory(i, buffer-&gt;channelData(i)-&gt;data(), bufferLength);
</ins><span class="cx"> 
</span><span class="cx">     bufferBus-&gt;setSampleRate(buffer-&gt;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 &quot;AudioNode.h&quot;
</span><del>-#include &lt;memory&gt;
</del><span class="cx"> #include &lt;wtf/Lock.h&gt;
</span><del>-#include &lt;wtf/RefPtr.h&gt;
</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&lt;ConvolverNode&gt; create(AudioContext&amp; 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&amp;);
</del><ins>+    ExceptionOr&lt;void&gt; 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&amp;, 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&lt;Reverb&gt; m_reverb;
</span><span class="cx">     RefPtr&lt;AudioBuffer&gt; 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 &quot;DefaultAudioDestinationNode.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #include &quot;AudioContext.h&quot;
</span><del>-#include &quot;ExceptionCode.h&quot;
</del><ins>+#include &quot;AudioDestination.h&quot;
</ins><span class="cx"> #include &quot;Logging.h&quot;
</span><span class="cx"> #include &quot;ScriptExecutionContext.h&quot;
</span><span class="cx"> #include &lt;wtf/MainThread.h&gt;
</span><span class="lines">@@ -40,7 +40,6 @@
</span><span class="cx">     
</span><span class="cx"> DefaultAudioDestinationNode::DefaultAudioDestinationNode(AudioContext&amp; 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-&gt;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&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; 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 &gt; maxChannelCount()) {
-        ec = INVALID_STATE_ERR;
-        return;
-    }
</del><ins>+    if (!maxChannelCount() || channelCount &gt; maxChannelCount())
+        return Exception { INVALID_STATE_ERR };
</ins><span class="cx"> 
</span><del>-    unsigned long oldChannelCount = this-&gt;channelCount();
-    AudioNode::setChannelCount(channelCount, ec);
</del><ins>+    auto oldChannelCount = this-&gt;channelCount();
+    auto result = AudioNode::setChannelCount(channelCount);
+    if (result.hasException())
+        return result;
</ins><span class="cx"> 
</span><del>-    if (!ec &amp;&amp; this-&gt;channelCount() != oldChannelCount &amp;&amp; isInitialized()) {
</del><ins>+    if (this-&gt;channelCount() != oldChannelCount &amp;&amp; isInitialized()) {
</ins><span class="cx">         // Re-create destination.
</span><span class="cx">         m_destination-&gt;stop();
</span><span class="cx">         createDestination();
</span><span class="cx">         m_destination-&gt;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 &quot;AudioDestination.h&quot;
</del><span class="cx"> #include &quot;AudioDestinationNode.h&quot;
</span><del>-#include &lt;memory&gt;
</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&lt;DefaultAudioDestinationNode&gt; create(AudioContext&amp; 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&amp;) override;
-
-    // AudioDestinationNode
-    void enableInput(const String&amp; inputDeviceId) override;
-    void startRendering() override;
-    void resume(Function&lt;void ()&gt;&amp;&amp;) override;
-    void suspend(Function&lt;void ()&gt;&amp;&amp;) override;
-    void close(Function&lt;void ()&gt;&amp;&amp;) override;
-    unsigned long maxChannelCount() const override;
-    bool isPlaying() override;
-
</del><span class="cx"> private:
</span><span class="cx">     explicit DefaultAudioDestinationNode(AudioContext&amp;);
</span><span class="cx">     void createDestination();
</span><span class="cx"> 
</span><ins>+    void initialize() final;
+    void uninitialize() final;
+    ExceptionOr&lt;void&gt; setChannelCount(unsigned) final;
+
+    void enableInput(const String&amp; inputDeviceId) final;
+    void startRendering() final;
+    void resume(Function&lt;void ()&gt;&amp;&amp;) final;
+    void suspend(Function&lt;void ()&gt;&amp;&amp;) final;
+    void close(Function&lt;void ()&gt;&amp;&amp;) final;
+    unsigned maxChannelCount() const final;
+    bool isPlaying() final;
+
</ins><span class="cx">     std::unique_ptr&lt;AudioDestination&gt; 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 &quot;DelayNode.h&quot;
</span><span class="cx"> 
</span><ins>+#include &quot;DelayProcessor.h&quot;
+
</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&amp; context, float sampleRate, double maxDelayTime, ExceptionCode&amp; ec)
</del><ins>+inline DelayNode::DelayNode(AudioContext&amp; context, float sampleRate, double maxDelayTime)
</ins><span class="cx">     : AudioBasicProcessorNode(context, sampleRate)
</span><span class="cx"> {
</span><del>-    if (maxDelayTime &lt;= 0 || maxDelayTime &gt;= maximumAllowedDelayTime) {
-        ec = NOT_SUPPORTED_ERR;
-        return;
-    }
</del><span class="cx">     m_processor = std::make_unique&lt;DelayProcessor&gt;(context, sampleRate, 1, maxDelayTime);
</span><span class="cx">     setNodeType(NodeTypeDelay);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+ExceptionOr&lt;Ref&lt;DelayNode&gt;&gt; DelayNode::create(AudioContext&amp; context, float sampleRate, double maxDelayTime)
+{
+    if (maxDelayTime &lt;= 0 || maxDelayTime &gt;= 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()-&gt;delayTime();
</del><ins>+    return static_cast&lt;DelayProcessor&amp;&gt;(*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 &quot;AudioBasicProcessorNode.h&quot;
</span><del>-#include &quot;DelayProcessor.h&quot;
-#include &quot;ExceptionCode.h&quot;
-#include &lt;wtf/Ref.h&gt;
</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&lt;DelayNode&gt; create(AudioContext&amp; context, float sampleRate, double maxDelayTime, ExceptionCode&amp; ec)
-    {
-        return adoptRef(*new DelayNode(context, sampleRate, maxDelayTime, ec));
-    }
</del><ins>+    static ExceptionOr&lt;Ref&lt;DelayNode&gt;&gt; create(AudioContext&amp;, 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&amp;, float sampleRate, double maxDelayTime, ExceptionCode&amp;);
-
-    DelayProcessor* delayProcessor() { return static_cast&lt;DelayProcessor*&gt;(processor()); }
</del><ins>+    DelayNode(AudioContext&amp;, 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 &quot;OfflineAudioContext.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #include &quot;Document.h&quot;
</span><del>-#include &quot;ExceptionCode.h&quot;
-#include &quot;ScriptExecutionContext.h&quot;
</del><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-RefPtr&lt;OfflineAudioContext&gt; OfflineAudioContext::create(ScriptExecutionContext&amp; context, unsigned numberOfChannels, size_t numberOfFrames, float sampleRate, ExceptionCode&amp; ec)
-{
-    // FIXME: add support for workers.
-    if (!is&lt;Document&gt;(context)) {
-        ec = NOT_SUPPORTED_ERR;
-        return nullptr;
-    }
-
-    Document&amp; document = downcast&lt;Document&gt;(context);
-
-    if (!numberOfChannels || numberOfChannels &gt; 10 || !numberOfFrames || !isSampleRateRangeGood(sampleRate)) {
-        ec = SYNTAX_ERR;
-        return nullptr;
-    }
-
-    RefPtr&lt;OfflineAudioContext&gt; audioContext(adoptRef(new OfflineAudioContext(document, numberOfChannels, numberOfFrames, sampleRate)));
-    audioContext-&gt;suspendIfNeeded();
-    return audioContext;
-}
-
-OfflineAudioContext::OfflineAudioContext(Document&amp; document, unsigned numberOfChannels, size_t numberOfFrames, float sampleRate)
</del><ins>+inline OfflineAudioContext::OfflineAudioContext(Document&amp; 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&lt;Ref&lt;OfflineAudioContext&gt;&gt; OfflineAudioContext::create(ScriptExecutionContext&amp; context, unsigned numberOfChannels, size_t numberOfFrames, float sampleRate)
</ins><span class="cx"> {
</span><ins>+    // FIXME: Add support for workers.
+    if (!is&lt;Document&gt;(context))
+        return Exception { NOT_SUPPORTED_ERR };
+    if (!numberOfChannels || numberOfChannels &gt; 10 || !numberOfFrames || !isSampleRateRangeGood(sampleRate))
+        return Exception { SYNTAX_ERR };
+    auto audioContext = adoptRef(*new OfflineAudioContext(downcast&lt;Document&gt;(context), numberOfChannels, numberOfFrames, sampleRate));
+    audioContext-&gt;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 &quot;AudioContext.h&quot;
</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&lt;OfflineAudioContext&gt; create(ScriptExecutionContext&amp;, unsigned numberOfChannels, size_t numberOfFrames, float sampleRate, ExceptionCode&amp;);
</del><ins>+    static ExceptionOr&lt;Ref&lt;OfflineAudioContext&gt;&gt; create(ScriptExecutionContext&amp;, 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&amp;, 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 &lt; numberOfChannels; ++channelIndex) {
</span><span class="cx">             const float* source = m_renderBus-&gt;channel(channelIndex)-&gt;data();
</span><del>-            float* destination = m_renderTarget-&gt;getChannelData(channelIndex)-&gt;data();
</del><ins>+            float* destination = m_renderTarget-&gt;channelData(channelIndex)-&gt;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 &quot;OscillatorNode.h&quot;
</span><span class="cx"> 
</span><del>-#include &quot;AudioContext.h&quot;
</del><span class="cx"> #include &quot;AudioNodeOutput.h&quot;
</span><del>-#include &quot;AudioUtilities.h&quot;
-#include &quot;ExceptionCode.h&quot;
-#include &quot;ExceptionCodePlaceholder.h&quot;
</del><ins>+#include &quot;AudioParam.h&quot;
</ins><span class="cx"> #include &quot;PeriodicWave.h&quot;
</span><span class="cx"> #include &quot;VectorMath.h&quot;
</span><del>-#include &lt;algorithm&gt;
-#include &lt;wtf/MathExtras.h&gt;
</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, &quot;detune&quot;, 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&lt;AudioNodeOutput&gt;(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&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; OscillatorNode::setType(Type type)
</ins><span class="cx"> {
</span><span class="cx">     PeriodicWave* periodicWave = nullptr;
</span><del>-    float sampleRate = this-&gt;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 = &amp;PeriodicWave::createSine(sampleRate).leakRef();
</del><ins>+            s_periodicWaveSine = &amp;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 = &amp;PeriodicWave::createSquare(sampleRate).leakRef();
</del><ins>+            s_periodicWaveSquare = &amp;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 = &amp;PeriodicWave::createSawtooth(sampleRate).leakRef();
</del><ins>+            s_periodicWaveSawtooth = &amp;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 = &amp;PeriodicWave::createTriangle(sampleRate).leakRef();
</del><ins>+            s_periodicWaveTriangle = &amp;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)-&gt;bus();
</del><ins>+    auto&amp; outputBus = *output(0)-&gt;bus();
</ins><span class="cx"> 
</span><del>-    if (!isInitialized() || !outputBus-&gt;numberOfChannels()) {
-        outputBus-&gt;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&lt;Lock&gt; 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-&gt;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-&gt;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-&gt;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-&gt;periodicWaveSize();
</span><span class="cx">     double invPeriodicWaveSize = 1.0 / periodicWaveSize;
</span><span class="cx"> 
</span><del>-    float* destP = outputBus-&gt;channel(0)-&gt;mutableData();
</del><ins>+    float* destP = outputBus.channel(0)-&gt;mutableData();
</ins><span class="cx"> 
</span><span class="cx">     ASSERT(quantumFrameOffset &lt;= 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-&gt;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 &quot;AudioBus.h&quot;
-#include &quot;AudioParam.h&quot;
</del><span class="cx"> #include &quot;AudioScheduledSourceNode.h&quot;
</span><span class="cx"> #include &lt;wtf/Lock.h&gt;
</span><del>-#include &lt;wtf/RefPtr.h&gt;
</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&lt;OscillatorNode&gt; create(AudioContext&amp;, 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&amp;);
</del><ins>+    ExceptionOr&lt;void&gt; 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&amp;, 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 &lt; numberOfInputChannels; i++)
</span><del>-        m_internalInputBus-&gt;setChannelMemory(i, inputBuffer-&gt;getChannelData(i)-&gt;data() + m_bufferReadWriteIndex, framesToProcess);
</del><ins>+        m_internalInputBus-&gt;setChannelMemory(i, inputBuffer-&gt;channelData(i)-&gt;data() + m_bufferReadWriteIndex, framesToProcess);
</ins><span class="cx"> 
</span><span class="cx">     if (numberOfInputChannels)
</span><span class="cx">         m_internalInputBus-&gt;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 &lt; numberOfOutputChannels; ++i)
</span><del>-        memcpy(outputBus-&gt;channel(i)-&gt;mutableData(), outputBuffer-&gt;getChannelData(i)-&gt;data() + m_bufferReadWriteIndex, sizeof(float) * framesToProcess);
</del><ins>+        memcpy(outputBus-&gt;channel(i)-&gt;mutableData(), outputBuffer-&gt;channelData(i)-&gt;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&amp;, JSC::JSValue, unsigned&amp; length);
</span><span class="cx"> 
</span><ins>+JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, JSC::ArrayBuffer&amp;);
+JSC::JSValue toJS(JSC::ExecState*, JSC::JSGlobalObject*, JSC::ArrayBufferView&amp;);
</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&lt;typename T&gt; JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, Ref&lt;T&gt;&amp;&amp;);
</span><span class="cx"> template&lt;typename T&gt; JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, RefPtr&lt;T&gt;&amp;&amp;);
</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&amp; buffer)
</ins><span class="cx"> {
</span><del>-    if (!buffer)
-        return JSC::jsNull();
-    if (JSC::JSValue result = getCachedWrapper(globalObject-&gt;world(), *buffer))
</del><ins>+    if (auto result = getCachedWrapper(globalObject-&gt;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-&gt;vm(), globalObject-&gt;arrayBufferStructure(), buffer);
</del><ins>+    return JSC::JSArrayBuffer::create(state-&gt;vm(), globalObject-&gt;arrayBufferStructure(), &amp;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&amp; 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-&gt;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-&gt;wrap(exec, globalObject);
</del><ins>+    return toJS(state, globalObject, *view);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> template&lt;typename T&gt; inline JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, Ref&lt;T&gt;&amp;&amp; ptr)
</span></span></pre>
</div>
</div>

</body>
</html>