mirror of
https://github.com/servo/servo.git
synced 2025-07-31 19:20:22 +01:00
Remove the Root.jsref member.
It is simpler to just construct it when the methods are called.
This commit is contained in:
parent
d8c2c88bbd
commit
4036206734
1 changed files with 4 additions and 7 deletions
|
@ -584,7 +584,7 @@ pub struct Root<T> {
|
||||||
/// List that ensures correct dynamic root ordering
|
/// List that ensures correct dynamic root ordering
|
||||||
root_list: &'static RootCollection,
|
root_list: &'static RootCollection,
|
||||||
/// Reference to rooted value that must not outlive this container
|
/// Reference to rooted value that must not outlive this container
|
||||||
jsref: JSRef<'static, T>,
|
ptr: NonZero<*const T>,
|
||||||
/// On-stack JS pointer to assuage conservative stack scanner
|
/// On-stack JS pointer to assuage conservative stack scanner
|
||||||
js_ptr: *mut JSObject,
|
js_ptr: *mut JSObject,
|
||||||
}
|
}
|
||||||
|
@ -596,10 +596,7 @@ impl<T: Reflectable> Root<T> {
|
||||||
fn new(roots: &'static RootCollection, unrooted: &JS<T>) -> Root<T> {
|
fn new(roots: &'static RootCollection, unrooted: &JS<T>) -> Root<T> {
|
||||||
let root = Root {
|
let root = Root {
|
||||||
root_list: roots,
|
root_list: roots,
|
||||||
jsref: JSRef {
|
ptr: unrooted.ptr,
|
||||||
ptr: unrooted.ptr.clone(),
|
|
||||||
chain: ContravariantLifetime,
|
|
||||||
},
|
|
||||||
js_ptr: unrooted.reflector().get_jsobject(),
|
js_ptr: unrooted.reflector().get_jsobject(),
|
||||||
};
|
};
|
||||||
roots.root(&root);
|
roots.root(&root);
|
||||||
|
@ -610,7 +607,7 @@ impl<T: Reflectable> Root<T> {
|
||||||
/// the lifetime of this root.
|
/// the lifetime of this root.
|
||||||
pub fn r<'b>(&'b self) -> JSRef<'b, T> {
|
pub fn r<'b>(&'b self) -> JSRef<'b, T> {
|
||||||
JSRef {
|
JSRef {
|
||||||
ptr: self.jsref.ptr,
|
ptr: self.ptr,
|
||||||
chain: ContravariantLifetime,
|
chain: ContravariantLifetime,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -621,7 +618,7 @@ impl<T: Reflectable> Root<T> {
|
||||||
/// DO NOT CALL.
|
/// DO NOT CALL.
|
||||||
pub fn get_unsound_ref_forever<'b>(&self) -> JSRef<'b, T> {
|
pub fn get_unsound_ref_forever<'b>(&self) -> JSRef<'b, T> {
|
||||||
JSRef {
|
JSRef {
|
||||||
ptr: self.jsref.ptr,
|
ptr: self.ptr,
|
||||||
chain: ContravariantLifetime,
|
chain: ContravariantLifetime,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue