stylo: Allow computing change hints during the traversal.

This commit is contained in:
Emilio Cobos Álvarez 2016-07-28 19:36:37 -07:00
parent 67ac81f440
commit 1470d5b174
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
7 changed files with 55 additions and 21 deletions

View file

@ -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()));
}