Skip to content

Commit

Permalink
Remove generation, remove filter pop, and add size tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
bholley committed Dec 22, 2016
1 parent ea6a61a commit 940cda1
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 24 deletions.
4 changes: 1 addition & 3 deletions components/layout/traversal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ pub trait PostorderNodeMutTraversal<ConcreteThreadSafeLayoutNode: ThreadSafeLayo
#[inline]
#[allow(unsafe_code)]
fn construct_flows_at<'a, N>(context: &LayoutContext<'a>,
thread_local: &mut ScopedThreadLocalLayoutContext<N::ConcreteElement>,
_thread_local: &mut ScopedThreadLocalLayoutContext<N::ConcreteElement>,
node: N)
where N: LayoutNode,
{
Expand All @@ -139,8 +139,6 @@ fn construct_flows_at<'a, N>(context: &LayoutContext<'a>,
if let Some(el) = node.as_element() {
el.mutate_data().unwrap().persist();
unsafe { el.unset_dirty_descendants(); }

thread_local.style_context.bloom_filter.maybe_pop(el);
}
}

Expand Down
1 change: 0 additions & 1 deletion components/layout_thread/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,6 @@ impl LayoutThread {
viewport_size: self.viewport_size.clone(),
screen_size_changed: screen_size_changed,
stylist: rw_data.stylist.clone(),
generation: self.generation,
goal: goal,
running_animations: self.running_animations.clone(),
expired_animations: self.expired_animations.clone(),
Expand Down
10 changes: 9 additions & 1 deletion components/script/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub mod size_of {
use dom::htmlspanelement::HTMLSpanElement;
use dom::node::Node;
use dom::text::Text;
use layout_wrapper::ServoThreadSafeLayoutNode;
use layout_wrapper::{ServoLayoutElement, ServoLayoutNode, ServoThreadSafeLayoutNode};
use std::mem::size_of;

pub fn CharacterData() -> usize {
Expand Down Expand Up @@ -50,6 +50,14 @@ pub mod size_of {
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 {
size_of::<ServoThreadSafeLayoutNode>()
}
Expand Down
4 changes: 0 additions & 4 deletions components/style/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,6 @@ pub struct SharedStyleContext {
/// The CSS selector 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
pub goal: ReflowGoal,

Expand Down
10 changes: 0 additions & 10 deletions components/style/gecko/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ pub struct PerDocumentStyleDataImpl {
/// Rule processor.
pub stylist: Arc<Stylist>,

/// Last restyle generation.
pub last_restyle_generation: u32,

/// List of stylesheets, mirrored from Gecko.
pub stylesheets: Vec<Arc<Stylesheet>>,

Expand Down Expand Up @@ -67,7 +64,6 @@ impl PerDocumentStyleData {

PerDocumentStyleData(AtomicRefCell::new(PerDocumentStyleDataImpl {
stylist: Arc::new(Stylist::new(device)),
last_restyle_generation: 0,
stylesheets: vec![],
stylesheets_changed: true,
new_animations_sender: new_anims_sender,
Expand Down Expand Up @@ -105,12 +101,6 @@ impl PerDocumentStyleDataImpl {
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 {
Expand Down
4 changes: 0 additions & 4 deletions components/style/traversal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ use std::mem;
use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering};
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
/// `-Z style-sharing-stats` is given.
pub static STYLE_SHARING_CACHE_HITS: AtomicUsize = ATOMIC_USIZE_INIT;
Expand Down
1 change: 0 additions & 1 deletion ports/geckolib/glue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ fn create_shared_context(mut per_doc_data: &mut AtomicRefMut<PerDocumentStyleDat
// FIXME (bug 1303229): Use the actual viewport size here
viewport_size: Size2D::new(Au(0), Au(0)),
screen_size_changed: false,
generation: per_doc_data.next_generation(),
goal: ReflowGoal::ForScriptQuery,
stylist: per_doc_data.stylist.clone(),
running_animations: per_doc_data.running_animations.clone(),
Expand Down
4 changes: 4 additions & 0 deletions tests/unit/script/size_of.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,7 @@ sizeof_checker!(size_span, HTMLSpanElement, 336);
sizeof_checker!(size_text, Text, 184);
sizeof_checker!(size_characterdata, CharacterData, 184);
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);

0 comments on commit 940cda1

Please sign in to comment.