refactor: add CanGc as argument to BaseAudioContext::{Destination, Listener} (#35729)

Signed-off-by: Yerkebulan Tulibergenov <yerkebulan@gmail.com>
This commit is contained in:
Yerkebulan Tulibergenov 2025-02-28 19:20:21 -08:00 committed by GitHub
parent 6112ebdf5d
commit e91d44d023
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 5 deletions

View file

@ -317,23 +317,23 @@ impl BaseAudioContextMethods<crate::DomTypeHolder> for BaseAudioContext {
} }
/// <https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-destination> /// <https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-destination>
fn Destination(&self) -> DomRoot<AudioDestinationNode> { fn Destination(&self, can_gc: CanGc) -> DomRoot<AudioDestinationNode> {
let global = self.global(); let global = self.global();
self.destination.or_init(|| { self.destination.or_init(|| {
let mut options = AudioNodeOptions::empty(); let mut options = AudioNodeOptions::empty();
options.channelCount = Some(self.channel_count); options.channelCount = Some(self.channel_count);
options.channelCountMode = Some(ChannelCountMode::Explicit); options.channelCountMode = Some(ChannelCountMode::Explicit);
options.channelInterpretation = Some(ChannelInterpretation::Speakers); options.channelInterpretation = Some(ChannelInterpretation::Speakers);
AudioDestinationNode::new(&global, self, &options, CanGc::note()) AudioDestinationNode::new(&global, self, &options, can_gc)
}) })
} }
/// <https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-listener> /// <https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-listener>
fn Listener(&self) -> DomRoot<AudioListener> { fn Listener(&self, can_gc: CanGc) -> DomRoot<AudioListener> {
let global = self.global(); let global = self.global();
let window = global.as_window(); let window = global.as_window();
self.listener self.listener
.or_init(|| AudioListener::new(window, self, CanGc::note())) .or_init(|| AudioListener::new(window, self, can_gc))
} }
// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-onstatechange // https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-onstatechange

View file

@ -29,7 +29,7 @@ DOMInterfaces = {
'BaseAudioContext': { 'BaseAudioContext': {
'inRealms': ['DecodeAudioData', 'Resume', 'ParseFromString', 'GetBounds', 'GetClientRects'], 'inRealms': ['DecodeAudioData', 'Resume', 'ParseFromString', 'GetBounds', 'GetClientRects'],
'canGc': ['CreateChannelMerger', 'CreateOscillator', 'CreateStereoPanner', 'CreateGain', 'CreateIIRFilter', 'CreateBiquadFilter', 'CreateBufferSource', 'CreateAnalyser', 'CreatePanner', 'CreateChannelSplitter', 'CreateBuffer', 'CreateConstantSource', 'Resume', 'DecodeAudioData'], 'canGc': ['CreateChannelMerger', 'CreateOscillator', 'CreateStereoPanner', 'CreateGain', 'CreateIIRFilter', 'CreateBiquadFilter', 'CreateBufferSource', 'CreateAnalyser', 'CreatePanner', 'CreateChannelSplitter', 'CreateBuffer', 'CreateConstantSource', 'Resume', 'DecodeAudioData', 'Destination', 'Listener'],
}, },
'Blob': { 'Blob': {