mirror of
https://github.com/servo/servo.git
synced 2025-08-08 15:05:35 +01:00
Start marking functions that can transitively trigger a GC (#33144)
* Mark JS reflector wrappers as CanGc. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Propagate CanGc from reflect_dom_object_with_proto. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Mark DOM constructors as GC operations. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
parent
9a1051c917
commit
60ef6bc461
140 changed files with 1336 additions and 304 deletions
|
@ -22,7 +22,7 @@ use crate::dom::bindings::root::DomRoot;
|
|||
use crate::dom::globalscope::GlobalScope;
|
||||
use crate::dom::window::Window;
|
||||
use crate::realms::enter_realm;
|
||||
use crate::script_runtime::JSContext;
|
||||
use crate::script_runtime::{CanGc, JSContext};
|
||||
|
||||
// Spec mandates at least [8000, 96000], we use [8000, 192000] to match Firefox
|
||||
// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-createbuffer
|
||||
|
@ -89,6 +89,7 @@ impl AudioBuffer {
|
|||
length,
|
||||
sample_rate,
|
||||
initial_data,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -100,9 +101,10 @@ impl AudioBuffer {
|
|||
length: u32,
|
||||
sample_rate: f32,
|
||||
initial_data: Option<&[Vec<f32>]>,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<AudioBuffer> {
|
||||
let buffer = AudioBuffer::new_inherited(number_of_channels, length, sample_rate);
|
||||
let buffer = reflect_dom_object_with_proto(Box::new(buffer), global, proto);
|
||||
let buffer = reflect_dom_object_with_proto(Box::new(buffer), global, proto, can_gc);
|
||||
buffer.set_initial_data(initial_data);
|
||||
buffer
|
||||
}
|
||||
|
@ -112,6 +114,7 @@ impl AudioBuffer {
|
|||
pub fn Constructor(
|
||||
window: &Window,
|
||||
proto: Option<HandleObject>,
|
||||
can_gc: CanGc,
|
||||
options: &AudioBufferOptions,
|
||||
) -> Fallible<DomRoot<AudioBuffer>> {
|
||||
if options.length == 0 ||
|
||||
|
@ -129,6 +132,7 @@ impl AudioBuffer {
|
|||
options.length,
|
||||
*options.sampleRate,
|
||||
None,
|
||||
can_gc,
|
||||
))
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue