mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Use Untraceable<T> to hold LayoutDataRef instead of manual Encodable implementation.
This commit is contained in:
parent
54d3a0b280
commit
de0866ab42
3 changed files with 9 additions and 9 deletions
|
@ -77,20 +77,20 @@ pub trait LayoutDataAccess {
|
||||||
impl<'ln> LayoutDataAccess for LayoutNode<'ln> {
|
impl<'ln> LayoutDataAccess for LayoutNode<'ln> {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
unsafe fn borrow_layout_data_unchecked(&self) -> *const Option<LayoutDataWrapper> {
|
unsafe fn borrow_layout_data_unchecked(&self) -> *const Option<LayoutDataWrapper> {
|
||||||
mem::transmute(self.get().layout_data.borrow_unchecked())
|
mem::transmute(self.get().layout_data.deref().borrow_unchecked())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn borrow_layout_data<'a>(&'a self) -> Ref<'a,Option<LayoutDataWrapper>> {
|
fn borrow_layout_data<'a>(&'a self) -> Ref<'a,Option<LayoutDataWrapper>> {
|
||||||
unsafe {
|
unsafe {
|
||||||
mem::transmute(self.get().layout_data.borrow())
|
mem::transmute(self.get().layout_data.deref().borrow())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn mutate_layout_data<'a>(&'a self) -> RefMut<'a,Option<LayoutDataWrapper>> {
|
fn mutate_layout_data<'a>(&'a self) -> RefMut<'a,Option<LayoutDataWrapper>> {
|
||||||
unsafe {
|
unsafe {
|
||||||
mem::transmute(self.get().layout_data.borrow_mut())
|
mem::transmute(self.get().layout_data.deref().borrow_mut())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -646,7 +646,7 @@ impl<'ln> ThreadSafeLayoutNode<'ln> {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub fn borrow_layout_data<'a>(&'a self) -> Ref<'a,Option<LayoutDataWrapper>> {
|
pub fn borrow_layout_data<'a>(&'a self) -> Ref<'a,Option<LayoutDataWrapper>> {
|
||||||
unsafe {
|
unsafe {
|
||||||
mem::transmute(self.get().layout_data.borrow())
|
mem::transmute(self.get().layout_data.deref().borrow())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -654,7 +654,7 @@ impl<'ln> ThreadSafeLayoutNode<'ln> {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub fn mutate_layout_data<'a>(&'a self) -> RefMut<'a,Option<LayoutDataWrapper>> {
|
pub fn mutate_layout_data<'a>(&'a self) -> RefMut<'a,Option<LayoutDataWrapper>> {
|
||||||
unsafe {
|
unsafe {
|
||||||
mem::transmute(self.get().layout_data.borrow_mut())
|
mem::transmute(self.get().layout_data.deref().borrow_mut())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ use dom::bindings::global::{GlobalRef, Window};
|
||||||
use dom::bindings::js::{JS, JSRef, RootedReference, Temporary, Root, OptionalUnrootable};
|
use dom::bindings::js::{JS, JSRef, RootedReference, Temporary, Root, OptionalUnrootable};
|
||||||
use dom::bindings::js::{OptionalSettable, TemporaryPushable, OptionalRootedRootable};
|
use dom::bindings::js::{OptionalSettable, TemporaryPushable, OptionalRootedRootable};
|
||||||
use dom::bindings::js::{ResultRootable, OptionalRootable};
|
use dom::bindings::js::{ResultRootable, OptionalRootable};
|
||||||
use dom::bindings::trace::Traceable;
|
use dom::bindings::trace::{Traceable, Untraceable};
|
||||||
use dom::bindings::utils;
|
use dom::bindings::utils;
|
||||||
use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object};
|
use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object};
|
||||||
use dom::characterdata::CharacterData;
|
use dom::characterdata::CharacterData;
|
||||||
|
@ -108,7 +108,7 @@ pub struct Node {
|
||||||
///
|
///
|
||||||
/// Must be sent back to the layout task to be destroyed when this
|
/// Must be sent back to the layout task to be destroyed when this
|
||||||
/// node is finalized.
|
/// node is finalized.
|
||||||
pub layout_data: LayoutDataRef,
|
pub layout_data: Untraceable<LayoutDataRef>,
|
||||||
|
|
||||||
unique_id: RefCell<String>,
|
unique_id: RefCell<String>,
|
||||||
}
|
}
|
||||||
|
@ -1041,7 +1041,7 @@ impl Node {
|
||||||
|
|
||||||
flags: Traceable::new(RefCell::new(NodeFlags::new(type_id))),
|
flags: Traceable::new(RefCell::new(NodeFlags::new(type_id))),
|
||||||
|
|
||||||
layout_data: LayoutDataRef::new(),
|
layout_data: Untraceable::new(LayoutDataRef::new()),
|
||||||
|
|
||||||
unique_id: RefCell::new("".to_string()),
|
unique_id: RefCell::new("".to_string()),
|
||||||
}
|
}
|
||||||
|
@ -1454,7 +1454,7 @@ impl Node {
|
||||||
/// Sends layout data, if any, back to the layout task to be destroyed.
|
/// Sends layout data, if any, back to the layout task to be destroyed.
|
||||||
unsafe fn reap_layout_data(&mut self) {
|
unsafe fn reap_layout_data(&mut self) {
|
||||||
if self.layout_data.is_present() {
|
if self.layout_data.is_present() {
|
||||||
let layout_data = mem::replace(&mut self.layout_data, LayoutDataRef::new());
|
let layout_data = mem::replace(self.layout_data.deref_mut(), LayoutDataRef::new());
|
||||||
let layout_chan = layout_data.take_chan();
|
let layout_chan = layout_data.take_chan();
|
||||||
match layout_chan {
|
match layout_chan {
|
||||||
None => {}
|
None => {}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue