mirror of
https://github.com/servo/servo.git
synced 2025-06-18 13:24:29 +00:00
Remove generation, remove filter pop, and add size tests.
This commit is contained in:
parent
ea6a61af59
commit
940cda1d15
8 changed files with 14 additions and 24 deletions
|
@ -112,7 +112,7 @@ pub trait PostorderNodeMutTraversal<ConcreteThreadSafeLayoutNode: ThreadSafeLayo
|
||||||
#[inline]
|
#[inline]
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
fn construct_flows_at<'a, N>(context: &LayoutContext<'a>,
|
fn construct_flows_at<'a, N>(context: &LayoutContext<'a>,
|
||||||
thread_local: &mut ScopedThreadLocalLayoutContext<N::ConcreteElement>,
|
_thread_local: &mut ScopedThreadLocalLayoutContext<N::ConcreteElement>,
|
||||||
node: N)
|
node: N)
|
||||||
where N: LayoutNode,
|
where N: LayoutNode,
|
||||||
{
|
{
|
||||||
|
@ -139,8 +139,6 @@ fn construct_flows_at<'a, N>(context: &LayoutContext<'a>,
|
||||||
if let Some(el) = node.as_element() {
|
if let Some(el) = node.as_element() {
|
||||||
el.mutate_data().unwrap().persist();
|
el.mutate_data().unwrap().persist();
|
||||||
unsafe { el.unset_dirty_descendants(); }
|
unsafe { el.unset_dirty_descendants(); }
|
||||||
|
|
||||||
thread_local.style_context.bloom_filter.maybe_pop(el);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -520,7 +520,6 @@ impl LayoutThread {
|
||||||
viewport_size: self.viewport_size.clone(),
|
viewport_size: self.viewport_size.clone(),
|
||||||
screen_size_changed: screen_size_changed,
|
screen_size_changed: screen_size_changed,
|
||||||
stylist: rw_data.stylist.clone(),
|
stylist: rw_data.stylist.clone(),
|
||||||
generation: self.generation,
|
|
||||||
goal: goal,
|
goal: goal,
|
||||||
running_animations: self.running_animations.clone(),
|
running_animations: self.running_animations.clone(),
|
||||||
expired_animations: self.expired_animations.clone(),
|
expired_animations: self.expired_animations.clone(),
|
||||||
|
|
|
@ -19,7 +19,7 @@ pub mod size_of {
|
||||||
use dom::htmlspanelement::HTMLSpanElement;
|
use dom::htmlspanelement::HTMLSpanElement;
|
||||||
use dom::node::Node;
|
use dom::node::Node;
|
||||||
use dom::text::Text;
|
use dom::text::Text;
|
||||||
use layout_wrapper::ServoThreadSafeLayoutNode;
|
use layout_wrapper::{ServoLayoutElement, ServoLayoutNode, ServoThreadSafeLayoutNode};
|
||||||
use std::mem::size_of;
|
use std::mem::size_of;
|
||||||
|
|
||||||
pub fn CharacterData() -> usize {
|
pub fn CharacterData() -> usize {
|
||||||
|
@ -50,6 +50,14 @@ pub mod size_of {
|
||||||
size_of::<Node>()
|
size_of::<Node>()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn SendElement() -> usize {
|
||||||
|
size_of::<::style::dom::SendElement<ServoLayoutElement>>()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SendNode() -> usize {
|
||||||
|
size_of::<::style::dom::SendNode<ServoLayoutNode>>()
|
||||||
|
}
|
||||||
|
|
||||||
pub fn ServoThreadSafeLayoutNode() -> usize {
|
pub fn ServoThreadSafeLayoutNode() -> usize {
|
||||||
size_of::<ServoThreadSafeLayoutNode>()
|
size_of::<ServoThreadSafeLayoutNode>()
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,10 +49,6 @@ pub struct SharedStyleContext {
|
||||||
/// The CSS selector stylist.
|
/// The CSS selector stylist.
|
||||||
pub stylist: Arc<Stylist>,
|
pub stylist: Arc<Stylist>,
|
||||||
|
|
||||||
/// Starts at zero, and increased by one every time a layout completes.
|
|
||||||
/// This can be used to easily check for invalid stale data.
|
|
||||||
pub generation: u32,
|
|
||||||
|
|
||||||
/// Why is this reflow occurring
|
/// Why is this reflow occurring
|
||||||
pub goal: ReflowGoal,
|
pub goal: ReflowGoal,
|
||||||
|
|
||||||
|
|
|
@ -25,9 +25,6 @@ pub struct PerDocumentStyleDataImpl {
|
||||||
/// Rule processor.
|
/// Rule processor.
|
||||||
pub stylist: Arc<Stylist>,
|
pub stylist: Arc<Stylist>,
|
||||||
|
|
||||||
/// Last restyle generation.
|
|
||||||
pub last_restyle_generation: u32,
|
|
||||||
|
|
||||||
/// List of stylesheets, mirrored from Gecko.
|
/// List of stylesheets, mirrored from Gecko.
|
||||||
pub stylesheets: Vec<Arc<Stylesheet>>,
|
pub stylesheets: Vec<Arc<Stylesheet>>,
|
||||||
|
|
||||||
|
@ -67,7 +64,6 @@ impl PerDocumentStyleData {
|
||||||
|
|
||||||
PerDocumentStyleData(AtomicRefCell::new(PerDocumentStyleDataImpl {
|
PerDocumentStyleData(AtomicRefCell::new(PerDocumentStyleDataImpl {
|
||||||
stylist: Arc::new(Stylist::new(device)),
|
stylist: Arc::new(Stylist::new(device)),
|
||||||
last_restyle_generation: 0,
|
|
||||||
stylesheets: vec![],
|
stylesheets: vec![],
|
||||||
stylesheets_changed: true,
|
stylesheets_changed: true,
|
||||||
new_animations_sender: new_anims_sender,
|
new_animations_sender: new_anims_sender,
|
||||||
|
@ -105,12 +101,6 @@ impl PerDocumentStyleDataImpl {
|
||||||
self.stylesheets_changed = false;
|
self.stylesheets_changed = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn next_generation(&mut self) -> u32 {
|
|
||||||
self.last_restyle_generation =
|
|
||||||
self.last_restyle_generation.wrapping_add(1);
|
|
||||||
self.last_restyle_generation
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe impl HasFFI for PerDocumentStyleData {
|
unsafe impl HasFFI for PerDocumentStyleData {
|
||||||
|
|
|
@ -18,10 +18,6 @@ use std::mem;
|
||||||
use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering};
|
use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering};
|
||||||
use stylist::Stylist;
|
use stylist::Stylist;
|
||||||
|
|
||||||
/// Every time we do another layout, the old bloom filters are invalid. This is
|
|
||||||
/// detected by ticking a generation number every layout.
|
|
||||||
pub type Generation = u32;
|
|
||||||
|
|
||||||
/// Style sharing candidate cache stats. These are only used when
|
/// Style sharing candidate cache stats. These are only used when
|
||||||
/// `-Z style-sharing-stats` is given.
|
/// `-Z style-sharing-stats` is given.
|
||||||
pub static STYLE_SHARING_CACHE_HITS: AtomicUsize = ATOMIC_USIZE_INIT;
|
pub static STYLE_SHARING_CACHE_HITS: AtomicUsize = ATOMIC_USIZE_INIT;
|
||||||
|
|
|
@ -101,7 +101,6 @@ fn create_shared_context(mut per_doc_data: &mut AtomicRefMut<PerDocumentStyleDat
|
||||||
// FIXME (bug 1303229): Use the actual viewport size here
|
// FIXME (bug 1303229): Use the actual viewport size here
|
||||||
viewport_size: Size2D::new(Au(0), Au(0)),
|
viewport_size: Size2D::new(Au(0), Au(0)),
|
||||||
screen_size_changed: false,
|
screen_size_changed: false,
|
||||||
generation: per_doc_data.next_generation(),
|
|
||||||
goal: ReflowGoal::ForScriptQuery,
|
goal: ReflowGoal::ForScriptQuery,
|
||||||
stylist: per_doc_data.stylist.clone(),
|
stylist: per_doc_data.stylist.clone(),
|
||||||
running_animations: per_doc_data.running_animations.clone(),
|
running_animations: per_doc_data.running_animations.clone(),
|
||||||
|
|
|
@ -38,3 +38,7 @@ sizeof_checker!(size_span, HTMLSpanElement, 336);
|
||||||
sizeof_checker!(size_text, Text, 184);
|
sizeof_checker!(size_text, Text, 184);
|
||||||
sizeof_checker!(size_characterdata, CharacterData, 184);
|
sizeof_checker!(size_characterdata, CharacterData, 184);
|
||||||
sizeof_checker!(size_servothreadsafelayoutnode, ServoThreadSafeLayoutNode, 16);
|
sizeof_checker!(size_servothreadsafelayoutnode, ServoThreadSafeLayoutNode, 16);
|
||||||
|
|
||||||
|
// We use these types in the parallel traversal. They should stay pointer-sized.
|
||||||
|
sizeof_checker!(size_sendelement, SendElement, 8);
|
||||||
|
sizeof_checker!(size_sendnode, SendNode, 8);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue