mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
stylo: Allow computing change hints during the traversal.
This commit is contained in:
parent
67ac81f440
commit
1470d5b174
7 changed files with 55 additions and 21 deletions
|
@ -13,7 +13,6 @@ pub struct ArcHelpers<GeckoType, ServoType> {
|
|||
phantom2: PhantomData<ServoType>,
|
||||
}
|
||||
|
||||
|
||||
impl<GeckoType, ServoType> ArcHelpers<GeckoType, ServoType> {
|
||||
pub fn with<F, Output>(raw: *mut GeckoType, cb: F) -> Output
|
||||
where F: FnOnce(&Arc<ServoType>) -> Output {
|
||||
|
@ -47,6 +46,10 @@ impl<GeckoType, ServoType> ArcHelpers<GeckoType, ServoType> {
|
|||
unsafe { transmute(owned) }
|
||||
}
|
||||
|
||||
pub unsafe fn borrow(borrowed: &Arc<ServoType>) -> *const &mut GeckoType {
|
||||
transmute(borrowed)
|
||||
}
|
||||
|
||||
pub unsafe fn addref(ptr: *mut GeckoType) {
|
||||
Self::with(ptr, |arc| forget(arc.clone()));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue