Title: [265298] trunk
Revision
265298
Author
cdu...@apple.com
Date
2020-08-05 12:23:06 -0700 (Wed, 05 Aug 2020)

Log Message

Add constructor to ConvolverNode
https://bugs.webkit.org/show_bug.cgi?id=215169

Reviewed by Eric Carlson.

LayoutTests/imported/w3c:

Rebaseline WPT tests now that more checks are passing.

* web-platform-tests/webaudio/idlharness.https.window-expected.txt:
* web-platform-tests/webaudio/the-audio-api/the-convolvernode-interface/active-processing.https-expected.txt:
* web-platform-tests/webaudio/the-audio-api/the-convolvernode-interface/ctor-convolver-expected.txt:

Source/WebCore:

Add constructor to ConvolverNode, as per specification:
- https://webaudio.github.io/web-audio-api/#ConvolverNode

No new tests, rebaselined existing tests.

* CMakeLists.txt:
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* Modules/webaudio/BaseAudioContext.cpp:
(WebCore::BaseAudioContext::createConvolver):
* Modules/webaudio/ConvolverNode.cpp:
(WebCore::ConvolverNode::create):
(WebCore::ConvolverNode::ConvolverNode):
(WebCore::ConvolverNode::setBuffer):
(WebCore::ConvolverNode::setChannelCount):
(WebCore::ConvolverNode::setChannelCountMode):
* Modules/webaudio/ConvolverNode.h:
* Modules/webaudio/ConvolverNode.idl:
* Modules/webaudio/ConvolverOptions.h: Copied from Source/WebCore/Modules/webaudio/ConvolverNode.idl.
* Modules/webaudio/ConvolverOptions.idl: Copied from Source/WebCore/Modules/webaudio/ConvolverNode.idl.
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (265297 => 265298)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2020-08-05 19:12:00 UTC (rev 265297)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2020-08-05 19:23:06 UTC (rev 265298)
@@ -1,3 +1,16 @@
+2020-08-05  Chris Dumez  <cdu...@apple.com>
+
+        Add constructor to ConvolverNode
+        https://bugs.webkit.org/show_bug.cgi?id=215169
+
+        Reviewed by Eric Carlson.
+
+        Rebaseline WPT tests now that more checks are passing.
+
+        * web-platform-tests/webaudio/idlharness.https.window-expected.txt:
+        * web-platform-tests/webaudio/the-audio-api/the-convolvernode-interface/active-processing.https-expected.txt:
+        * web-platform-tests/webaudio/the-audio-api/the-convolvernode-interface/ctor-convolver-expected.txt:
+
 2020-08-05  Alexey Shvayka  <shvaikal...@gmail.com>
 
         Re-sync web-platform-tests (2 dirs + 2 files)

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/idlharness.https.window-expected.txt (265297 => 265298)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/idlharness.https.window-expected.txt	2020-08-05 19:12:00 UTC (rev 265297)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/idlharness.https.window-expected.txt	2020-08-05 19:23:06 UTC (rev 265298)
@@ -611,7 +611,7 @@
 FAIL AudioNode interface: new ConstantSourceNode(context) must inherit property "channelCountMode" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: ConstantSourceNode"
 FAIL AudioNode interface: new ConstantSourceNode(context) must inherit property "channelInterpretation" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: ConstantSourceNode"
 PASS ConvolverNode interface: existence and properties of interface object 
-FAIL ConvolverNode interface object length assert_equals: wrong value for ConvolverNode.length expected 1 but got 0
+PASS ConvolverNode interface object length 
 PASS ConvolverNode interface object name 
 PASS ConvolverNode interface: existence and properties of interface prototype object 
 PASS ConvolverNode interface: existence and properties of interface prototype object's "constructor" property 
@@ -618,33 +618,33 @@
 PASS ConvolverNode interface: existence and properties of interface prototype object's @@unscopables property 
 PASS ConvolverNode interface: attribute buffer 
 PASS ConvolverNode interface: attribute normalize 
-FAIL ConvolverNode must be primary interface of new ConvolverNode(context) assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new ConvolverNode(context)')"
-FAIL Stringification of new ConvolverNode(context) assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new ConvolverNode(context)')"
-FAIL ConvolverNode interface: new ConvolverNode(context) must inherit property "buffer" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new ConvolverNode(context)')"
-FAIL ConvolverNode interface: new ConvolverNode(context) must inherit property "normalize" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new ConvolverNode(context)')"
-FAIL AudioNode interface: new ConvolverNode(context) must inherit property "connect(AudioNode, optional unsigned long, optional unsigned long)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new ConvolverNode(context)')"
-FAIL AudioNode interface: calling connect(AudioNode, optional unsigned long, optional unsigned long) on new ConvolverNode(context) with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new ConvolverNode(context)')"
-FAIL AudioNode interface: new ConvolverNode(context) must inherit property "connect(AudioParam, optional unsigned long)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new ConvolverNode(context)')"
-FAIL AudioNode interface: calling connect(AudioParam, optional unsigned long) on new ConvolverNode(context) with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new ConvolverNode(context)')"
-FAIL AudioNode interface: new ConvolverNode(context) must inherit property "disconnect()" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new ConvolverNode(context)')"
-FAIL AudioNode interface: new ConvolverNode(context) must inherit property "disconnect(unsigned long)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new ConvolverNode(context)')"
-FAIL AudioNode interface: calling disconnect(unsigned long) on new ConvolverNode(context) with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new ConvolverNode(context)')"
-FAIL AudioNode interface: new ConvolverNode(context) must inherit property "disconnect(AudioNode)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new ConvolverNode(context)')"
-FAIL AudioNode interface: calling disconnect(AudioNode) on new ConvolverNode(context) with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new ConvolverNode(context)')"
-FAIL AudioNode interface: new ConvolverNode(context) must inherit property "disconnect(AudioNode, unsigned long)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new ConvolverNode(context)')"
-FAIL AudioNode interface: calling disconnect(AudioNode, unsigned long) on new ConvolverNode(context) with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new ConvolverNode(context)')"
-FAIL AudioNode interface: new ConvolverNode(context) must inherit property "disconnect(AudioNode, unsigned long, unsigned long)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new ConvolverNode(context)')"
-FAIL AudioNode interface: calling disconnect(AudioNode, unsigned long, unsigned long) on new ConvolverNode(context) with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new ConvolverNode(context)')"
-FAIL AudioNode interface: new ConvolverNode(context) must inherit property "disconnect(AudioParam)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new ConvolverNode(context)')"
-FAIL AudioNode interface: calling disconnect(AudioParam) on new ConvolverNode(context) with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new ConvolverNode(context)')"
-FAIL AudioNode interface: new ConvolverNode(context) must inherit property "disconnect(AudioParam, unsigned long)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new ConvolverNode(context)')"
-FAIL AudioNode interface: calling disconnect(AudioParam, unsigned long) on new ConvolverNode(context) with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new ConvolverNode(context)')"
-FAIL AudioNode interface: new ConvolverNode(context) must inherit property "context" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new ConvolverNode(context)')"
-FAIL AudioNode interface: new ConvolverNode(context) must inherit property "numberOfInputs" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new ConvolverNode(context)')"
-FAIL AudioNode interface: new ConvolverNode(context) must inherit property "numberOfOutputs" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new ConvolverNode(context)')"
-FAIL AudioNode interface: new ConvolverNode(context) must inherit property "channelCount" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new ConvolverNode(context)')"
-FAIL AudioNode interface: new ConvolverNode(context) must inherit property "channelCountMode" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new ConvolverNode(context)')"
-FAIL AudioNode interface: new ConvolverNode(context) must inherit property "channelInterpretation" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new ConvolverNode(context)')"
+PASS ConvolverNode must be primary interface of new ConvolverNode(context) 
+PASS Stringification of new ConvolverNode(context) 
+PASS ConvolverNode interface: new ConvolverNode(context) must inherit property "buffer" with the proper type 
+PASS ConvolverNode interface: new ConvolverNode(context) must inherit property "normalize" with the proper type 
+PASS AudioNode interface: new ConvolverNode(context) must inherit property "connect(AudioNode, optional unsigned long, optional unsigned long)" with the proper type 
+PASS AudioNode interface: calling connect(AudioNode, optional unsigned long, optional unsigned long) on new ConvolverNode(context) with too few arguments must throw TypeError 
+PASS AudioNode interface: new ConvolverNode(context) must inherit property "connect(AudioParam, optional unsigned long)" with the proper type 
+PASS AudioNode interface: calling connect(AudioParam, optional unsigned long) on new ConvolverNode(context) with too few arguments must throw TypeError 
+PASS AudioNode interface: new ConvolverNode(context) must inherit property "disconnect()" with the proper type 
+PASS AudioNode interface: new ConvolverNode(context) must inherit property "disconnect(unsigned long)" with the proper type 
+PASS AudioNode interface: calling disconnect(unsigned long) on new ConvolverNode(context) with too few arguments must throw TypeError 
+PASS AudioNode interface: new ConvolverNode(context) must inherit property "disconnect(AudioNode)" with the proper type 
+PASS AudioNode interface: calling disconnect(AudioNode) on new ConvolverNode(context) with too few arguments must throw TypeError 
+PASS AudioNode interface: new ConvolverNode(context) must inherit property "disconnect(AudioNode, unsigned long)" with the proper type 
+PASS AudioNode interface: calling disconnect(AudioNode, unsigned long) on new ConvolverNode(context) with too few arguments must throw TypeError 
+PASS AudioNode interface: new ConvolverNode(context) must inherit property "disconnect(AudioNode, unsigned long, unsigned long)" with the proper type 
+PASS AudioNode interface: calling disconnect(AudioNode, unsigned long, unsigned long) on new ConvolverNode(context) with too few arguments must throw TypeError 
+PASS AudioNode interface: new ConvolverNode(context) must inherit property "disconnect(AudioParam)" with the proper type 
+PASS AudioNode interface: calling disconnect(AudioParam) on new ConvolverNode(context) with too few arguments must throw TypeError 
+PASS AudioNode interface: new ConvolverNode(context) must inherit property "disconnect(AudioParam, unsigned long)" with the proper type 
+PASS AudioNode interface: calling disconnect(AudioParam, unsigned long) on new ConvolverNode(context) with too few arguments must throw TypeError 
+PASS AudioNode interface: new ConvolverNode(context) must inherit property "context" with the proper type 
+PASS AudioNode interface: new ConvolverNode(context) must inherit property "numberOfInputs" with the proper type 
+PASS AudioNode interface: new ConvolverNode(context) must inherit property "numberOfOutputs" with the proper type 
+PASS AudioNode interface: new ConvolverNode(context) must inherit property "channelCount" with the proper type 
+PASS AudioNode interface: new ConvolverNode(context) must inherit property "channelCountMode" with the proper type 
+PASS AudioNode interface: new ConvolverNode(context) must inherit property "channelInterpretation" with the proper type 
 PASS DelayNode interface: existence and properties of interface object 
 PASS DelayNode interface object length 
 PASS DelayNode interface object name 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-convolvernode-interface/active-processing.https-expected.txt (265297 => 265298)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-convolvernode-interface/active-processing.https-expected.txt	2020-08-05 19:12:00 UTC (rev 265297)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-convolvernode-interface/active-processing.https-expected.txt	2020-08-05 19:23:06 UTC (rev 265298)
@@ -1,7 +1,7 @@
 
 PASS # AUDIT TASK RUNNER STARTED. 
 FAIL Executing "initialize" promise_test: Unhandled rejection with value: object "TypeError: undefined is not an object (evaluating 'context.audioWorklet.addModule')"
-FAIL Executing "test" promise_test: Unhandled rejection with value: object "TypeError: function is not a constructor (evaluating 'new ConvolverNode(context, {buffer: response})')"
+FAIL Executing "test" promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: AudioWorkletNode"
 PASS Audit report 
 PASS > [initialize]  
 PASS > [test]  

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-convolvernode-interface/ctor-convolver-expected.txt (265297 => 265298)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-convolvernode-interface/ctor-convolver-expected.txt	2020-08-05 19:12:00 UTC (rev 265297)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-convolvernode-interface/ctor-convolver-expected.txt	2020-08-05 19:23:06 UTC (rev 265298)
@@ -2,32 +2,69 @@
 PASS # AUDIT TASK RUNNER STARTED. 
 PASS Executing "initialize" 
 PASS Executing "invalid constructor" 
-FAIL Executing "default constructor" promise_test: Unhandled rejection with value: object "TypeError: undefined is not an object (evaluating 'node.numberOfInputs')"
-FAIL Executing "test AudioNodeOptions" promise_test: Unhandled rejection with value: object "TypeError: undefined is not an object (evaluating 'node[entry.attribute]')"
-FAIL Executing "nullable buffer" promise_test: Unhandled rejection with value: object "TypeError: undefined is not an object (evaluating 'node.buffer')"
+PASS Executing "default constructor" 
+PASS Executing "test AudioNodeOptions" 
+PASS Executing "nullable buffer" 
 PASS Executing "illegal sample-rate" 
-FAIL Executing "construct with options" promise_test: Unhandled rejection with value: object "TypeError: undefined is not an object (evaluating 'node.buffer')"
+PASS Executing "construct with options" 
 PASS Audit report 
 PASS > [initialize]  
 PASS   context = new OfflineAudioContext(...) did not throw an exception. 
 PASS < [initialize] All assertions passed. (total 1 assertions) 
 PASS > [invalid constructor]  
-PASS   new ConvolverNode() threw TypeError: "function is not a constructor (evaluating 'new window[name]()')". 
-PASS   new ConvolverNode(1) threw TypeError: "function is not a constructor (evaluating 'new window[name](1)')". 
-PASS   new ConvolverNode(context, 42) threw TypeError: "function is not a constructor (evaluating 'new window[name](context, 42)')". 
+PASS   new ConvolverNode() threw TypeError: "Not enough arguments". 
+PASS   new ConvolverNode(1) threw TypeError: "Argument 1 ('context') to the ConvolverNode constructor must be an instance of BaseAudioContext". 
+PASS   new ConvolverNode(context, 42) threw TypeError: "Type error". 
 PASS < [invalid constructor] All assertions passed. (total 3 assertions) 
 PASS > [default constructor]  
-FAIL X node0 = new ConvolverNode(context) incorrectly threw TypeError: "function is not a constructor (evaluating 'new window[name](context, options.constructorOptions)')". assert_true: expected true got false
-FAIL X node0 instanceof ConvolverNode is not equal to true. Got false. assert_true: expected true got false
+PASS   node0 = new ConvolverNode(context) did not throw an exception. 
+PASS   node0 instanceof ConvolverNode is equal to true. 
+PASS   node0.numberOfInputs is equal to 1. 
+PASS   node0.numberOfOutputs is equal to 1. 
+PASS   node0.channelCount is equal to 2. 
+PASS   node0.channelCountMode is equal to clamped-max. 
+PASS   node0.channelInterpretation is equal to speakers. 
+PASS   node0.normalize is equal to true. 
+PASS   node0.buffer is equal to null. 
+PASS < [default constructor] All assertions passed. (total 9 assertions) 
 PASS > [test AudioNodeOptions]  
-FAIL X new ConvolverNode(c, {"channelCount":1}) incorrectly threw TypeError: "function is not a constructor (evaluating 'new ConvolverNode(context, options)')". assert_true: expected true got false
+PASS   new ConvolverNode(c, {"channelCount":1}) did not throw an exception. 
+PASS   node.channelCount is equal to 1. 
+PASS   new ConvolverNode(c, {"channelCount":2}) did not throw an exception. 
+PASS   node.channelCount is equal to 2. 
+PASS   new ConvolverNode(c, {"channelCount":0}) threw InvalidStateError: "The object is in an invalid state.". 
+PASS   new ConvolverNode(c, {"channelCount":3}) threw NotSupportedError: "ConvolverNode's channel count cannot be greater than 2". 
+PASS   new ConvolverNode(c, {"channelCount":99}) threw NotSupportedError: "ConvolverNode's channel count cannot be greater than 2". 
+PASS   new ConvolverNode(c, {"channelCountMode":"clamped-max"}) did not throw an exception. 
+PASS   node.channelCountMode is equal to clamped-max. 
+PASS   new ConvolverNode(c, {"channelCountMode":"explicit"}) did not throw an exception. 
+PASS   node.channelCountMode is equal to explicit. 
+PASS   new ConvolverNode(c, {"channelCountMode":"max"}) threw NotSupportedError: "ConvolverNode's channel count mode cannot be 'max'". 
+PASS   new ConvolverNode(c, {"channelCountMode":"foobar"}) threw TypeError: "Type error". 
+PASS   new ConvolverNode(c, {"channelInterpretation":"speakers"}) did not throw an exception. 
+PASS   node.channelInterpretation is equal to speakers. 
+PASS   new ConvolverNode(c, {"channelInterpretation":"discrete"}) did not throw an exception. 
+PASS   node.channelInterpretation is equal to discrete. 
+PASS   new ConvolverNode(c, {"channelInterpretation":"foobar"}) threw TypeError: "Type error". 
+PASS < [test AudioNodeOptions] All assertions passed. (total 18 assertions) 
 PASS > [nullable buffer]  
-FAIL X node1 = new ConvolverNode(c, {"buffer":null} incorrectly threw TypeError: "function is not a constructor (evaluating 'new ConvolverNode(context, options)')". assert_true: expected true got false
+PASS   node1 = new ConvolverNode(c, {"buffer":null} did not throw an exception. 
+PASS   node1.buffer is equal to null. 
+PASS < [nullable buffer] All assertions passed. (total 2 assertions) 
 PASS > [illegal sample-rate]  
-FAIL X node1 = new ConvolverNode(c, {"buffer":{}} threw "TypeError" instead of NotSupportedError. assert_true: expected true got false
-FAIL < [illegal sample-rate] 1 out of 1 assertions were failed. assert_true: expected true got false
+PASS   node1 = new ConvolverNode(c, {"buffer":{}} threw NotSupportedError: "The operation is not supported.". 
+PASS < [illegal sample-rate] All assertions passed. (total 1 assertions) 
 PASS > [construct with options]  
-FAIL X node = new ConvolverNode(c, {"buffer":{},"disableNormalization":false}) incorrectly threw TypeError: "function is not a constructor (evaluating 'new ConvolverNode(context, options)')". assert_true: expected true got false
-FAIL X node1 instanceOf ConvolverNode is not equal to true. Got false. assert_true: expected true got false
-FAIL # AUDIT TASK RUNNER FINISHED: 5 out of 7 tasks were failed. assert_true: expected true got false
+PASS   node = new ConvolverNode(c, {"buffer":{},"disableNormalization":false}) did not throw an exception. 
+PASS   node1 instanceOf ConvolverNode is equal to true. 
+PASS   node1.buffer === <buf> is equal to true. 
+PASS   node1.normalize is equal to true. 
+PASS   node2 = new ConvolverNode(, {"buffer":null,"disableNormalization":true}) did not throw an exception. 
+PASS   node2.buffer is equal to null. 
+PASS   node2.normalize is equal to false. 
+PASS   node3 = new ConvolverNode(context, {"buffer":null,"disableNormalization":false}) did not throw an exception. 
+PASS   node3.buffer is equal to null. 
+PASS   node3.normalize is equal to true. 
+PASS < [construct with options] All assertions passed. (total 10 assertions) 
+PASS # AUDIT TASK RUNNER FINISHED: 7 tasks ran successfully. 
 

Modified: trunk/Source/WebCore/CMakeLists.txt (265297 => 265298)


--- trunk/Source/WebCore/CMakeLists.txt	2020-08-05 19:12:00 UTC (rev 265297)
+++ trunk/Source/WebCore/CMakeLists.txt	2020-08-05 19:23:06 UTC (rev 265298)
@@ -474,6 +474,7 @@
     Modules/webaudio/ChannelSplitterNode.idl
     Modules/webaudio/ChannelSplitterOptions.idl
     Modules/webaudio/ConvolverNode.idl
+    Modules/webaudio/ConvolverOptions.idl
     Modules/webaudio/DelayNode.idl
     Modules/webaudio/DelayOptions.idl
     Modules/webaudio/DistanceModelType.idl

Modified: trunk/Source/WebCore/ChangeLog (265297 => 265298)


--- trunk/Source/WebCore/ChangeLog	2020-08-05 19:12:00 UTC (rev 265297)
+++ trunk/Source/WebCore/ChangeLog	2020-08-05 19:23:06 UTC (rev 265298)
@@ -1,5 +1,36 @@
 2020-08-05  Chris Dumez  <cdu...@apple.com>
 
+        Add constructor to ConvolverNode
+        https://bugs.webkit.org/show_bug.cgi?id=215169
+
+        Reviewed by Eric Carlson.
+
+        Add constructor to ConvolverNode, as per specification:
+        - https://webaudio.github.io/web-audio-api/#ConvolverNode
+
+        No new tests, rebaselined existing tests.
+
+        * CMakeLists.txt:
+        * DerivedSources-input.xcfilelist:
+        * DerivedSources-output.xcfilelist:
+        * DerivedSources.make:
+        * Modules/webaudio/BaseAudioContext.cpp:
+        (WebCore::BaseAudioContext::createConvolver):
+        * Modules/webaudio/ConvolverNode.cpp:
+        (WebCore::ConvolverNode::create):
+        (WebCore::ConvolverNode::ConvolverNode):
+        (WebCore::ConvolverNode::setBuffer):
+        (WebCore::ConvolverNode::setChannelCount):
+        (WebCore::ConvolverNode::setChannelCountMode):
+        * Modules/webaudio/ConvolverNode.h:
+        * Modules/webaudio/ConvolverNode.idl:
+        * Modules/webaudio/ConvolverOptions.h: Copied from Source/WebCore/Modules/webaudio/ConvolverNode.idl.
+        * Modules/webaudio/ConvolverOptions.idl: Copied from Source/WebCore/Modules/webaudio/ConvolverNode.idl.
+        * Sources.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+
+2020-08-05  Chris Dumez  <cdu...@apple.com>
+
         REGRESSION (r265266) DumpRenderTree crash at WebKitAudioListener::dopplerFactor
         https://bugs.webkit.org/show_bug.cgi?id=215171
         <rdar://problem/66556999>

Modified: trunk/Source/WebCore/DerivedSources-input.xcfilelist (265297 => 265298)


--- trunk/Source/WebCore/DerivedSources-input.xcfilelist	2020-08-05 19:12:00 UTC (rev 265297)
+++ trunk/Source/WebCore/DerivedSources-input.xcfilelist	2020-08-05 19:23:06 UTC (rev 265298)
@@ -323,6 +323,7 @@
 $(PROJECT_DIR)/Modules/webaudio/ChannelSplitterNode.idl
 $(PROJECT_DIR)/Modules/webaudio/ChannelSplitterOptions.idl
 $(PROJECT_DIR)/Modules/webaudio/ConvolverNode.idl
+$(PROJECT_DIR)/Modules/webaudio/ConvolverOptions.idl
 $(PROJECT_DIR)/Modules/webaudio/DelayNode.idl
 $(PROJECT_DIR)/Modules/webaudio/DelayOptions.idl
 $(PROJECT_DIR)/Modules/webaudio/DistanceModelType.idl

Modified: trunk/Source/WebCore/DerivedSources-output.xcfilelist (265297 => 265298)


--- trunk/Source/WebCore/DerivedSources-output.xcfilelist	2020-08-05 19:12:00 UTC (rev 265297)
+++ trunk/Source/WebCore/DerivedSources-output.xcfilelist	2020-08-05 19:23:06 UTC (rev 265298)
@@ -357,6 +357,8 @@
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSComputedEffectTiming.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSConvolverNode.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSConvolverNode.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSConvolverOptions.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSConvolverOptions.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCoordinates.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCoordinates.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCountQueuingStrategy.cpp

Modified: trunk/Source/WebCore/DerivedSources.make (265297 => 265298)


--- trunk/Source/WebCore/DerivedSources.make	2020-08-05 19:12:00 UTC (rev 265297)
+++ trunk/Source/WebCore/DerivedSources.make	2020-08-05 19:23:06 UTC (rev 265298)
@@ -406,6 +406,7 @@
     $(WebCore)/Modules/webaudio/ChannelSplitterNode.idl \
     $(WebCore)/Modules/webaudio/ChannelSplitterOptions.idl \
     $(WebCore)/Modules/webaudio/ConvolverNode.idl \
+    $(WebCore)/Modules/webaudio/ConvolverOptions.idl \
     $(WebCore)/Modules/webaudio/DelayNode.idl \
     $(WebCore)/Modules/webaudio/DelayOptions.idl \
     $(WebCore)/Modules/webaudio/DistanceModelType.idl \

Modified: trunk/Source/WebCore/Modules/webaudio/BaseAudioContext.cpp (265297 => 265298)


--- trunk/Source/WebCore/Modules/webaudio/BaseAudioContext.cpp	2020-08-05 19:12:00 UTC (rev 265297)
+++ trunk/Source/WebCore/Modules/webaudio/BaseAudioContext.cpp	2020-08-05 19:23:06 UTC (rev 265298)
@@ -518,11 +518,7 @@
     ALWAYS_LOG(LOGIDENTIFIER);
     
     ASSERT(isMainThread());
-    if (m_isStopScheduled)
-        return Exception { InvalidStateError };
-
-    lazyInitialize();
-    return ConvolverNode::create(*this, sampleRate());
+    return ConvolverNode::create(*this);
 }
 
 ExceptionOr<Ref<DynamicsCompressorNode>> BaseAudioContext::createDynamicsCompressor()

Modified: trunk/Source/WebCore/Modules/webaudio/ConvolverNode.cpp (265297 => 265298)


--- trunk/Source/WebCore/Modules/webaudio/ConvolverNode.cpp	2020-08-05 19:12:00 UTC (rev 265297)
+++ trunk/Source/WebCore/Modules/webaudio/ConvolverNode.cpp	2020-08-05 19:23:06 UTC (rev 265298)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2010, Google Inc. All rights reserved.
- * Copyright (C) 2016, Apple Inc. All rights reserved.
+ * Copyright (C) 2016-2020, Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -47,9 +47,39 @@
 
 WTF_MAKE_ISO_ALLOCATED_IMPL(ConvolverNode);
 
-ConvolverNode::ConvolverNode(BaseAudioContext& context, float sampleRate)
-    : AudioNode(context, sampleRate)
+ExceptionOr<Ref<ConvolverNode>> ConvolverNode::create(BaseAudioContext& context, ConvolverOptions&& options)
 {
+    if (context.isStopped())
+        return Exception { InvalidStateError };
+
+    context.lazyInitialize();
+
+    auto node = adoptRef(*new ConvolverNode(context));
+
+    auto result = node->setChannelCount(options.channelCount.valueOr(2));
+    if (result.hasException())
+        return result.releaseException();
+
+    result = node->setChannelCountMode(options.channelCountMode.valueOr(ChannelCountMode::ClampedMax));
+    if (result.hasException())
+        return result.releaseException();
+
+    result = node->setChannelInterpretation(options.channelInterpretation.valueOr(ChannelInterpretation::Speakers));
+    if (result.hasException())
+        return result.releaseException();
+
+    result = node->setBuffer(WTFMove(options.buffer));
+    if (result.hasException())
+        return result.releaseException();
+
+    node->setNormalize(!options.disableNormalization);
+
+    return node;
+}
+
+ConvolverNode::ConvolverNode(BaseAudioContext& context)
+    : AudioNode(context, context.sampleRate())
+{
     setNodeType(NodeTypeConvolver);
 
     addInput(makeUnique<AudioNodeInput>(this));
@@ -116,7 +146,7 @@
     AudioNode::uninitialize();
 }
 
-ExceptionOr<void> ConvolverNode::setBuffer(AudioBuffer* buffer)
+ExceptionOr<void> ConvolverNode::setBuffer(RefPtr<AudioBuffer>&& buffer)
 {
     ASSERT(isMainThread());
     
@@ -152,7 +182,7 @@
         // Synchronize with process().
         auto locker = holdLock(m_processMutex);
         m_reverb = WTFMove(reverb);
-        m_buffer = buffer;
+        m_buffer = WTFMove(buffer);
     }
 
     return { };
@@ -174,6 +204,20 @@
     return m_reverb ? m_reverb->latencyFrames() / static_cast<double>(sampleRate()) : 0;
 }
 
+ExceptionOr<void> ConvolverNode::setChannelCount(unsigned count)
+{
+    if (count > 2)
+        return Exception { NotSupportedError, "ConvolverNode's channel count cannot be greater than 2"_s };
+    return AudioNode::setChannelCount(count);
+}
+
+ExceptionOr<void> ConvolverNode::setChannelCountMode(ChannelCountMode mode)
+{
+    if (mode == ChannelCountMode::Max)
+        return Exception { NotSupportedError, "ConvolverNode's channel count mode cannot be 'max'"_s };
+    return AudioNode::setChannelCountMode(mode);
+}
+
 } // namespace WebCore
 
 #endif // ENABLE(WEB_AUDIO)

Modified: trunk/Source/WebCore/Modules/webaudio/ConvolverNode.h (265297 => 265298)


--- trunk/Source/WebCore/Modules/webaudio/ConvolverNode.h	2020-08-05 19:12:00 UTC (rev 265297)
+++ trunk/Source/WebCore/Modules/webaudio/ConvolverNode.h	2020-08-05 19:23:06 UTC (rev 265298)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2010, Google Inc. All rights reserved.
+ * Copyright (C) 2020, Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -25,6 +26,7 @@
 #pragma once
 
 #include "AudioNode.h"
+#include "ConvolverOptions.h"
 #include <wtf/Lock.h>
 
 namespace WebCore {
@@ -35,21 +37,21 @@
 class ConvolverNode final : public AudioNode {
     WTF_MAKE_ISO_ALLOCATED(ConvolverNode);
 public:
-    static Ref<ConvolverNode> create(BaseAudioContext& context, float sampleRate)
-    {
-        return adoptRef(*new ConvolverNode(context, sampleRate));
-    }
+    static ExceptionOr<Ref<ConvolverNode>> create(BaseAudioContext&, ConvolverOptions&& = { });
     
     virtual ~ConvolverNode();
     
-    ExceptionOr<void> setBuffer(AudioBuffer*);
+    ExceptionOr<void> setBuffer(RefPtr<AudioBuffer>&&);
     AudioBuffer* buffer();
 
     bool normalize() const { return m_normalize; }
     void setNormalize(bool normalize) { m_normalize = normalize; }
 
+    ExceptionOr<void> setChannelCount(unsigned) final;
+    ExceptionOr<void> setChannelCountMode(ChannelCountMode) final;
+
 private:
-    ConvolverNode(BaseAudioContext&, float sampleRate);
+    explicit ConvolverNode(BaseAudioContext&);
 
     double tailTime() const final;
     double latencyTime() const final;

Modified: trunk/Source/WebCore/Modules/webaudio/ConvolverNode.idl (265297 => 265298)


--- trunk/Source/WebCore/Modules/webaudio/ConvolverNode.idl	2020-08-05 19:12:00 UTC (rev 265297)
+++ trunk/Source/WebCore/Modules/webaudio/ConvolverNode.idl	2020-08-05 19:23:06 UTC (rev 265298)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2010, Google Inc. All rights reserved.
+ * Copyright (C) 2020, Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -27,6 +28,8 @@
     Conditional=WEB_AUDIO,
     JSGenerateToJSObject
 ] interface ConvolverNode : AudioNode {
+    [MayThrowException, EnabledBySetting=ModernUnprefixedWebAudio] constructor (BaseAudioContext context, optional ConvolverOptions options);
+
     attribute AudioBuffer? buffer;
     attribute boolean normalize;
 };

Copied: trunk/Source/WebCore/Modules/webaudio/ConvolverOptions.h (from rev 265297, trunk/Source/WebCore/Modules/webaudio/ConvolverNode.idl) (0 => 265298)


--- trunk/Source/WebCore/Modules/webaudio/ConvolverOptions.h	                        (rev 0)
+++ trunk/Source/WebCore/Modules/webaudio/ConvolverOptions.h	2020-08-05 19:23:06 UTC (rev 265298)
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2020, Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1.  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(WEB_AUDIO)
+
+#include "AudioBuffer.h"
+#include "AudioNodeOptions.h"
+
+namespace WebCore {
+
+struct ConvolverOptions : AudioNodeOptions {
+    RefPtr<AudioBuffer> buffer;
+    bool disableNormalization { false };
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(WEB_AUDIO)

Copied: trunk/Source/WebCore/Modules/webaudio/ConvolverOptions.idl (from rev 265297, trunk/Source/WebCore/Modules/webaudio/ConvolverNode.idl) (0 => 265298)


--- trunk/Source/WebCore/Modules/webaudio/ConvolverOptions.idl	                        (rev 0)
+++ trunk/Source/WebCore/Modules/webaudio/ConvolverOptions.idl	2020-08-05 19:23:06 UTC (rev 265298)
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2020, Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1.  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+[
+    Conditional=WEB_AUDIO
+] dictionary ConvolverOptions : AudioNodeOptions {
+    AudioBuffer? buffer;
+    boolean disableNormalization = false;
+};

Modified: trunk/Source/WebCore/Sources.txt (265297 => 265298)


--- trunk/Source/WebCore/Sources.txt	2020-08-05 19:12:00 UTC (rev 265297)
+++ trunk/Source/WebCore/Sources.txt	2020-08-05 19:23:06 UTC (rev 265298)
@@ -2734,6 +2734,7 @@
 JSCompositionEvent.cpp
 JSComputedEffectTiming.cpp
 JSConvolverNode.cpp
+JSConvolverOptions.cpp
 JSCountQueuingStrategy.cpp
 JSCredentialCreationOptions.cpp
 JSCredentialRequestOptions.cpp

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (265297 => 265298)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2020-08-05 19:12:00 UTC (rev 265297)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2020-08-05 19:23:06 UTC (rev 265298)
@@ -2521,6 +2521,7 @@
 		83E359A21BB1031D002CEB98 /* JSHTMLTimeElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 83E359A01BB1031D002CEB98 /* JSHTMLTimeElement.h */; };
 		83E866801FBA565B008855C5 /* ServiceWorkerData.h in Headers */ = {isa = PBXBuildFile; fileRef = 83E8667D1FBA563F008855C5 /* ServiceWorkerData.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		83EE598F1F50958E003E8B30 /* JSErrorCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 83EE598B1F50958B003E8B30 /* JSErrorCallback.h */; };
+		83F28C0024DB1DE1005BA6F6 /* ConvolverOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 83F28BFD24DB1DD3005BA6F6 /* ConvolverOptions.h */; };
 		83FB33711F508A5400986E54 /* FileSystemDirectoryEntry.h in Headers */ = {isa = PBXBuildFile; fileRef = 83FB336D1F508A4E00986E54 /* FileSystemDirectoryEntry.h */; };
 		83FB33731F508A5800986E54 /* FileSystemEntry.h in Headers */ = {isa = PBXBuildFile; fileRef = 83FB336F1F508A4E00986E54 /* FileSystemEntry.h */; };
 		83FB33751F508A5B00986E54 /* FileSystemFileEntry.h in Headers */ = {isa = PBXBuildFile; fileRef = 83FB336C1F508A4E00986E54 /* FileSystemFileEntry.h */; };
@@ -10627,6 +10628,8 @@
 		83E9B3011DA5A51E00FFE8F6 /* JSScrollToOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSScrollToOptions.h; sourceTree = "<group>"; };
 		83EE598B1F50958B003E8B30 /* JSErrorCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSErrorCallback.h; sourceTree = "<group>"; };
 		83EE598C1F50958B003E8B30 /* JSErrorCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSErrorCallback.cpp; sourceTree = "<group>"; };
+		83F28BFD24DB1DD3005BA6F6 /* ConvolverOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ConvolverOptions.h; sourceTree = "<group>"; };
+		83F28BFF24DB1DD4005BA6F6 /* ConvolverOptions.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = ConvolverOptions.idl; sourceTree = "<group>"; };
 		83F570AD1C53268E007FD6CB /* JSXMLDocument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSXMLDocument.h; sourceTree = "<group>"; };
 		83F570AE1C53268E007FD6CB /* JSXMLDocument.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSXMLDocument.cpp; sourceTree = "<group>"; };
 		83F572941FA1066F003837BE /* JSServiceWorkerClientCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSServiceWorkerClientCustom.cpp; sourceTree = "<group>"; };
@@ -29586,6 +29589,8 @@
 				FD315FDE12B0267600C1A359 /* ConvolverNode.cpp */,
 				FD315FDF12B0267600C1A359 /* ConvolverNode.h */,
 				FD315FE012B0267600C1A359 /* ConvolverNode.idl */,
+				83F28BFD24DB1DD3005BA6F6 /* ConvolverOptions.h */,
+				83F28BFF24DB1DD4005BA6F6 /* ConvolverOptions.idl */,
 				FD06DFA3134A4DEF006F5D7D /* DefaultAudioDestinationNode.cpp */,
 				FD06DFA4134A4DEF006F5D7D /* DefaultAudioDestinationNode.h */,
 				FD315FE112B0267600C1A359 /* DelayDSPKernel.cpp */,
@@ -30430,6 +30435,7 @@
 				7ADE722610CBBB9B006B3B3A /* ContextMenuProvider.h in Headers */,
 				759CB837192DA9190012BC64 /* ControlStates.h in Headers */,
 				FD31602912B0267600C1A359 /* ConvolverNode.h in Headers */,
+				83F28C0024DB1DE1005BA6F6 /* ConvolverOptions.h in Headers */,
 				D8B6152F1032495100C8554A /* Cookie.h in Headers */,
 				E1424C94164B52C800F32D40 /* CookieJar.h in Headers */,
 				7A5699702086C619000E0433 /* CookieRequestHeaderFieldProxy.h in Headers */,
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to