mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +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
|
@ -20,6 +20,7 @@ use crate::dom::dommatrixreadonly::{
|
|||
};
|
||||
use crate::dom::globalscope::GlobalScope;
|
||||
use crate::dom::window::Window;
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct DOMMatrix {
|
||||
|
@ -29,7 +30,7 @@ pub struct DOMMatrix {
|
|||
#[allow(non_snake_case)]
|
||||
impl DOMMatrix {
|
||||
pub fn new(global: &GlobalScope, is2D: bool, matrix: Transform3D<f64>) -> DomRoot<Self> {
|
||||
Self::new_with_proto(global, None, is2D, matrix)
|
||||
Self::new_with_proto(global, None, is2D, matrix, CanGc::note())
|
||||
}
|
||||
|
||||
#[allow(crown::unrooted_must_root)]
|
||||
|
@ -38,9 +39,10 @@ impl DOMMatrix {
|
|||
proto: Option<HandleObject>,
|
||||
is2D: bool,
|
||||
matrix: Transform3D<f64>,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<Self> {
|
||||
let dommatrix = Self::new_inherited(is2D, matrix);
|
||||
reflect_dom_object_with_proto(Box::new(dommatrix), global, proto)
|
||||
reflect_dom_object_with_proto(Box::new(dommatrix), global, proto, can_gc)
|
||||
}
|
||||
|
||||
pub fn new_inherited(is2D: bool, matrix: Transform3D<f64>) -> Self {
|
||||
|
@ -53,6 +55,7 @@ impl DOMMatrix {
|
|||
pub fn Constructor(
|
||||
global: &GlobalScope,
|
||||
proto: Option<HandleObject>,
|
||||
can_gc: CanGc,
|
||||
init: Option<StringOrUnrestrictedDoubleSequence>,
|
||||
) -> Fallible<DomRoot<Self>> {
|
||||
if init.is_none() {
|
||||
|
@ -61,6 +64,7 @@ impl DOMMatrix {
|
|||
proto,
|
||||
true,
|
||||
Transform3D::identity(),
|
||||
can_gc,
|
||||
));
|
||||
}
|
||||
match init.unwrap() {
|
||||
|
@ -74,11 +78,11 @@ impl DOMMatrix {
|
|||
return Ok(Self::new(global, true, Transform3D::identity()));
|
||||
}
|
||||
transform_to_matrix(s.to_string())
|
||||
.map(|(is2D, matrix)| Self::new_with_proto(global, proto, is2D, matrix))
|
||||
.map(|(is2D, matrix)| Self::new_with_proto(global, proto, is2D, matrix, can_gc))
|
||||
},
|
||||
StringOrUnrestrictedDoubleSequence::UnrestrictedDoubleSequence(ref entries) => {
|
||||
entries_to_matrix(&entries[..])
|
||||
.map(|(is2D, matrix)| Self::new_with_proto(global, proto, is2D, matrix))
|
||||
.map(|(is2D, matrix)| Self::new_with_proto(global, proto, is2D, matrix, can_gc))
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -101,6 +105,7 @@ impl DOMMatrix {
|
|||
DOMMatrix::Constructor(
|
||||
global,
|
||||
None,
|
||||
CanGc::note(),
|
||||
Some(StringOrUnrestrictedDoubleSequence::UnrestrictedDoubleSequence(vec)),
|
||||
)
|
||||
}
|
||||
|
@ -114,6 +119,7 @@ impl DOMMatrix {
|
|||
DOMMatrix::Constructor(
|
||||
global,
|
||||
None,
|
||||
CanGc::note(),
|
||||
Some(StringOrUnrestrictedDoubleSequence::UnrestrictedDoubleSequence(vec)),
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue