mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Auto merge of #26757 - jdm:unneeded-generic, r=SimonSapin
Remove unnecessary generics from low-level script code This should remove one of the larger offenders from the cargo-llvm-lines output for the script crate.
This commit is contained in:
commit
ea491b4117
2 changed files with 14 additions and 12 deletions
|
@ -452,13 +452,10 @@ where
|
||||||
/// Returns Err(()) if `obj` is a wrapper or if the object is not an object
|
/// Returns Err(()) if `obj` is a wrapper or if the object is not an object
|
||||||
/// for a DOM object of the given type (as defined by the proto_id and proto_depth).
|
/// for a DOM object of the given type (as defined by the proto_id and proto_depth).
|
||||||
#[inline]
|
#[inline]
|
||||||
pub unsafe fn private_from_proto_check_static<F>(
|
unsafe fn private_from_proto_check_static(
|
||||||
obj: *mut JSObject,
|
obj: *mut JSObject,
|
||||||
proto_check: F,
|
proto_check: fn(&'static DOMClass) -> bool,
|
||||||
) -> Result<*const libc::c_void, ()>
|
) -> Result<*const libc::c_void, ()> {
|
||||||
where
|
|
||||||
F: Fn(&'static DOMClass) -> bool,
|
|
||||||
{
|
|
||||||
let dom_class = get_dom_class(obj).map_err(|_| ())?;
|
let dom_class = get_dom_class(obj).map_err(|_| ())?;
|
||||||
if proto_check(dom_class) {
|
if proto_check(dom_class) {
|
||||||
trace!("good prototype");
|
trace!("good prototype");
|
||||||
|
|
|
@ -63,12 +63,17 @@ where
|
||||||
/// out references which cannot outlive this new `Root`.
|
/// out references which cannot outlive this new `Root`.
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
pub unsafe fn new(value: T) -> Self {
|
pub unsafe fn new(value: T) -> Self {
|
||||||
debug_assert!(thread_state::get().is_script());
|
unsafe fn add_to_root_list(object: *const dyn JSTraceable) -> *const RootCollection {
|
||||||
STACK_ROOTS.with(|ref root_list| {
|
debug_assert!(thread_state::get().is_script());
|
||||||
let root_list = &*root_list.get().unwrap();
|
STACK_ROOTS.with(|ref root_list| {
|
||||||
root_list.root(value.stable_trace_object());
|
let root_list = &*root_list.get().unwrap();
|
||||||
Root { value, root_list }
|
root_list.root(object);
|
||||||
})
|
root_list
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
let root_list = add_to_root_list(value.stable_trace_object());
|
||||||
|
Root { value, root_list }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue