Changeset 269081 in webkit
- Timestamp:
- Oct 27, 2020 5:06:03 PM (21 months ago)
- Location:
- trunk
- Files:
-
- 1 added
- 8 edited
-
LayoutTests/imported/w3c/ChangeLog (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audiobuffer-interface/audiobuffer-getChannelData-expected.txt (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/Modules/webaudio/AudioBuffer.cpp (modified) (3 diffs)
-
Source/WebCore/Modules/webaudio/AudioBuffer.h (modified) (4 diffs)
-
Source/WebCore/Modules/webaudio/AudioBuffer.idl (modified) (2 diffs)
-
Source/WebCore/Sources.txt (modified) (1 diff)
-
Source/WebCore/WebCore.xcodeproj/project.pbxproj (modified) (2 diffs)
-
Source/WebCore/bindings/js/JSAudioBufferCustom.cpp (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/imported/w3c/ChangeLog
r269050 r269081 1 2020-10-27 Chris Dumez <cdumez@apple.com> 2 3 AudioBuffer.getChannelData(x) should keep returning the same JS wrapper for a given channel 4 https://bugs.webkit.org/show_bug.cgi?id=218265 5 6 Reviewed by Geoff Garen. 7 8 Rebaseline WPT test that is now fully passing. I have verified that this test passes in Chrome and Firefox 9 as well. 10 11 * web-platform-tests/webaudio/the-audio-api/the-audiobuffer-interface/audiobuffer-getChannelData-expected.txt: 12 1 13 2020-10-27 Noam Rosenthal <noam@webkit.org> 2 14 -
trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audiobuffer-interface/audiobuffer-getChannelData-expected.txt
r267649 r269081 5 5 PASS Audit report 6 6 PASS > [buffer-eq] 7 FAIL X buffer.getChannelData(0) === buffer.getChannelData(0) is not equal to true. Got false. assert_true: expected true got false 8 FAIL X buffer.getChannelData(1) === buffer.getChannelData(1) is not equal to true. Got false. assert_true: expected true got false 9 FAIL < [buffer-eq] 2 out of 2 assertions were failed. assert_true: expected true got false 7 PASS buffer.getChannelData(0) === buffer.getChannelData(0) is equal to true. 8 PASS buffer.getChannelData(1) === buffer.getChannelData(1) is equal to true. 9 PASS < [buffer-eq] All assertions passed. (total 2 assertions) 10 10 PASS > [buffer-not-eq] 11 11 PASS buffer1.getChannelData(0) === buffer2.getChannelData(0) is equal to false. 12 12 PASS buffer1.getChannelData(1) === buffer2.getChannelData(1) is equal to false. 13 13 PASS < [buffer-not-eq] All assertions passed. (total 2 assertions) 14 FAIL # AUDIT TASK RUNNER FINISHED: 1 out of 2 tasks were failed. assert_true: expected true got false 14 PASS # AUDIT TASK RUNNER FINISHED: 2 tasks ran successfully. 15 15 -
trunk/Source/WebCore/ChangeLog
r269078 r269081 1 2020-10-27 Chris Dumez <cdumez@apple.com> 2 3 AudioBuffer.getChannelData(x) should keep returning the same JS wrapper for a given channel 4 https://bugs.webkit.org/show_bug.cgi?id=218265 5 6 Reviewed by Geoff Garen. 7 8 AudioBuffer.getChannelData(x) should keep returning the same JS wrapper for a given channel. 9 This is the behavior of Chrome & Firefox and is covered by Web-Platform-Tests. 10 11 No new tests, rebaselined existing test. 12 13 * Modules/webaudio/AudioBuffer.cpp: 14 (WebCore::AudioBuffer::AudioBuffer): 15 (WebCore::AudioBuffer::releaseMemory): 16 (WebCore::AudioBuffer::getChannelData): 17 (WebCore::AudioBuffer::visitChannelWrappers): 18 * Modules/webaudio/AudioBuffer.h: 19 * Modules/webaudio/AudioBuffer.idl: 20 * Sources.txt: 21 * WebCore.xcodeproj/project.pbxproj: 22 1 23 2020-10-27 Brent Fulgham <bfulgham@apple.com> 2 24 -
trunk/Source/WebCore/Modules/webaudio/AudioBuffer.cpp
r265403 r269081 98 98 m_channels.append(WTFMove(channelDataArray)); 99 99 } 100 m_channelWrappers.resize(m_channels.size()); 100 101 } 101 102 … … 118 119 m_channels.append(WTFMove(channelDataArray)); 119 120 } 121 m_channelWrappers.resize(m_channels.size()); 120 122 } 121 123 … … 130 132 auto locker = holdLock(m_channelsLock); 131 133 m_channels.clear(); 132 } 133 134 ExceptionOr<Ref<Float32Array>> AudioBuffer::getChannelData(unsigned channelIndex) 135 { 136 if (channelIndex >= m_channels.size()) 134 m_channelWrappers.clear(); 135 } 136 137 ExceptionOr<JSC::JSValue> AudioBuffer::getChannelData(JSDOMGlobalObject& globalObject, unsigned channelIndex) 138 { 139 ASSERT(m_channelWrappers.size() == m_channels.size()); 140 if (channelIndex >= m_channelWrappers.size()) 137 141 return Exception { IndexSizeError, "Index must be less than number of channels."_s }; 138 auto& channelData = *m_channels[channelIndex]; 139 return Float32Array::create(channelData.unsharedBuffer(), channelData.byteOffset(), channelData.length()); 142 143 auto& channelData = m_channels[channelIndex]; 144 auto constructJSArray = [&] { 145 return JSC::JSFloat32Array::create(globalObject.vm(), globalObject.typedArrayStructure(JSC::TypeFloat32), channelData.copyRef()); 146 }; 147 148 if (globalObject.worldIsNormal()) { 149 if (!m_channelWrappers[channelIndex]) 150 m_channelWrappers[channelIndex] = { constructJSArray() }; 151 return static_cast<JSC::JSValue>(m_channelWrappers[channelIndex]); 152 } 153 return constructJSArray(); 154 } 155 156 void AudioBuffer::visitChannelWrappers(JSC::SlotVisitor& visitor) 157 { 158 for (auto& channelWrapper : m_channelWrappers) 159 channelWrapper.visit(visitor); 140 160 } 141 161 -
trunk/Source/WebCore/Modules/webaudio/AudioBuffer.h
r267065 r269081 32 32 #include "AudioBufferOptions.h" 33 33 #include "ExceptionOr.h" 34 #include "JSValueInWrappedObject.h" 34 35 #include <JavaScriptCore/Float32Array.h> 35 36 #include <wtf/Lock.h> … … 54 55 // Channel data access 55 56 unsigned numberOfChannels() const { return m_channels.size(); } 56 ExceptionOr< Ref<Float32Array>> getChannelData(unsigned channelIndex);57 ExceptionOr<JSC::JSValue> getChannelData(JSDOMGlobalObject&, unsigned channelIndex); 57 58 ExceptionOr<void> copyFromChannel(Ref<Float32Array>&&, unsigned channelNumber, unsigned bufferOffset); 58 59 ExceptionOr<void> copyToChannel(Ref<Float32Array>&&, unsigned channelNumber, unsigned startInChannel); … … 66 67 67 68 size_t memoryCost() const; 69 70 void visitChannelWrappers(JSC::SlotVisitor&); 68 71 69 72 private: … … 77 80 size_t m_length; 78 81 Vector<RefPtr<Float32Array>> m_channels; 82 Vector<JSValueInWrappedObject> m_channelWrappers; 79 83 }; 80 84 -
trunk/Source/WebCore/Modules/webaudio/AudioBuffer.idl
r267813 r269081 30 30 Conditional=WEB_AUDIO, 31 31 ImplementationLacksVTable, 32 JSCustomMarkFunction, 32 33 JSGenerateToJSObject, 33 34 ReportExtraMemoryCost, … … 41 42 42 43 // Channel access 43 [MayThrowException ] Float32Array getChannelData(unsigned long channelIndex);44 [MayThrowException, CallWith=GlobalObject] any getChannelData(unsigned long channelIndex); 44 45 [MayThrowException, EnabledBySetting=ModernUnprefixedWebAudio] undefined copyFromChannel(Float32Array destination, unsigned long channelNumber, optional unsigned long bufferOffset = 0); 45 46 [MayThrowException, EnabledBySetting=ModernUnprefixedWebAudio] undefined copyToChannel(Float32Array source, unsigned long channelNumber, optional unsigned long bufferOffset = 0); -
trunk/Source/WebCore/Sources.txt
r268960 r269081 481 481 bindings/js/JSAnimationTimelineCustom.cpp 482 482 bindings/js/JSAttrCustom.cpp 483 bindings/js/JSAudioBufferCustom.cpp 483 484 bindings/js/JSAudioTrackCustom.cpp 484 485 bindings/js/JSAudioTrackListCustom.cpp -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r269025 r269081 8026 8026 46C3765F2085176C00C73829 /* JSRemoteDOMWindow.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSRemoteDOMWindow.cpp; sourceTree = "<group>"; }; 8027 8027 46C376612085176D00C73829 /* JSRemoteDOMWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSRemoteDOMWindow.h; sourceTree = "<group>"; }; 8028 46C3A8D32548D4B700C8C53A /* JSAudioBufferCustom.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSAudioBufferCustom.cpp; sourceTree = "<group>"; }; 8028 8029 46C696C91E7205E400597937 /* CPUMonitor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPUMonitor.h; sourceTree = "<group>"; }; 8029 8030 46C696CA1E7205E400597937 /* CPUMonitor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CPUMonitor.cpp; sourceTree = "<group>"; }; … … 22328 22329 71025ED51F99F147004A250C /* JSAnimationTimelineCustom.cpp */, 22329 22330 BC2ED6BB0C6BD2F000920BFF /* JSAttrCustom.cpp */, 22331 46C3A8D32548D4B700C8C53A /* JSAudioBufferCustom.cpp */, 22330 22332 BE6DF70E171CA2DA00DD52B8 /* JSAudioTrackCustom.cpp */, 22331 22333 BE6DF710171CA2DA00DD52B8 /* JSAudioTrackListCustom.cpp */,
Note: See TracChangeset
for help on using the changeset viewer.