AudioNode.connect should use [ReturnValue]
authordarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 4 Oct 2018 16:20:24 +0000 (16:20 +0000)
committerdarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 4 Oct 2018 16:20:24 +0000 (16:20 +0000)
https://bugs.webkit.org/show_bug.cgi?id=190231

Reviewed by Eric Carlson.

This is a slightly more efficient way to return a value that is always
identical to one of the arguments, so use it here.

* Modules/webaudio/AudioBasicInspectorNode.cpp:
(WebCore::AudioBasicInspectorNode::connect): Return ExceptionOr<void>.
* Modules/webaudio/AudioBasicInspectorNode.h: Ditto.
* Modules/webaudio/AudioNode.cpp:
(WebCore::AudioNode::connect): Ditto.
* Modules/webaudio/AudioNode.h: Ditto.

* Modules/webaudio/AudioNode.idl: Use [ReturnValue].

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236831 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/Modules/webaudio/AudioBasicInspectorNode.cpp
Source/WebCore/Modules/webaudio/AudioBasicInspectorNode.h
Source/WebCore/Modules/webaudio/AudioNode.cpp
Source/WebCore/Modules/webaudio/AudioNode.h
Source/WebCore/Modules/webaudio/AudioNode.idl

index bb37f55..0129a36 100644 (file)
@@ -1,3 +1,22 @@
+2018-10-02  Darin Adler  <darin@apple.com>
+
+        AudioNode.connect should use [ReturnValue]
+        https://bugs.webkit.org/show_bug.cgi?id=190231
+
+        Reviewed by Eric Carlson.
+
+        This is a slightly more efficient way to return a value that is always
+        identical to one of the arguments, so use it here.
+
+        * Modules/webaudio/AudioBasicInspectorNode.cpp:
+        (WebCore::AudioBasicInspectorNode::connect): Return ExceptionOr<void>.
+        * Modules/webaudio/AudioBasicInspectorNode.h: Ditto.
+        * Modules/webaudio/AudioNode.cpp:
+        (WebCore::AudioNode::connect): Ditto.
+        * Modules/webaudio/AudioNode.h: Ditto.
+
+        * Modules/webaudio/AudioNode.idl: Use [ReturnValue].
+
 2018-10-03  Justin Michaud  <justin_michaud@apple.com>
 
         Registered custom properties should allow inheritance to be controlled
index 5033b7d..27e56c4 100644 (file)
@@ -49,7 +49,7 @@ void AudioBasicInspectorNode::pullInputs(size_t framesToProcess)
     input(0)->pull(output(0)->bus(), framesToProcess);
 }
 
-ExceptionOr<AudioNode&> AudioBasicInspectorNode::connect(AudioNode& destination, unsigned outputIndex, unsigned inputIndex)
+ExceptionOr<void> AudioBasicInspectorNode::connect(AudioNode& destination, unsigned outputIndex, unsigned inputIndex)
 {
     ASSERT(isMainThread());
 
index fae2359..b86f1a3 100644 (file)
@@ -37,7 +37,7 @@ public:
 
 private:
     void pullInputs(size_t framesToProcess) override;
-    ExceptionOr<AudioNode&> connect(AudioNode&, unsigned outputIndex, unsigned inputIndex) override;
+    ExceptionOr<void> connect(AudioNode&, unsigned outputIndex, unsigned inputIndex) override;
     ExceptionOr<void> disconnect(unsigned outputIndex) override;
     void checkNumberOfChannelsForInput(AudioNodeInput*) override;
 
index 6f3c63c..ad1351f 100644 (file)
@@ -122,7 +122,7 @@ AudioNodeOutput* AudioNode::output(unsigned i)
     return nullptr;
 }
 
-ExceptionOr<AudioNode&> AudioNode::connect(AudioNode& destination, unsigned outputIndex, unsigned inputIndex)
+ExceptionOr<void> AudioNode::connect(AudioNode& destination, unsigned outputIndex, unsigned inputIndex)
 {
     ASSERT(isMainThread()); 
     AudioContext::AutoLocker locker(context());
@@ -144,7 +144,7 @@ ExceptionOr<AudioNode&> AudioNode::connect(AudioNode& destination, unsigned outp
     // Let context know that a connection has been made.
     context().incrementConnectionCount();
 
-    return destination;
+    return { };
 }
 
 ExceptionOr<void> AudioNode::connect(AudioParam& param, unsigned outputIndex)
index c4f784b..30a5f81 100644 (file)
@@ -123,7 +123,7 @@ public:
     AudioNodeOutput* output(unsigned);
 
     // Called from main thread by corresponding JavaScript methods.
-    virtual ExceptionOr<AudioNode&> connect(AudioNode&, unsigned outputIndex, unsigned inputIndex);
+    virtual ExceptionOr<void> connect(AudioNode&, unsigned outputIndex, unsigned inputIndex);
     ExceptionOr<void> connect(AudioParam&, unsigned outputIndex);
     virtual ExceptionOr<void> disconnect(unsigned outputIndex);
 
index 800f01e..ac83a8b 100644 (file)
@@ -34,7 +34,7 @@
     attribute DOMString channelCountMode;
     attribute DOMString channelInterpretation;
 
-    [MayThrowException] AudioNode connect(AudioNode destination, optional unsigned long output = 0, optional unsigned long input = 0);
+    [MayThrowException] AudioNode connect([ReturnValue] 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);
 };