mirror of
https://github.com/servo/servo.git
synced 2025-06-20 07:08:59 +01:00
auto merge of #1585 : pcwalton/servo/parallel-aux-init, r=metajack
Brings aux initialization time down to essentially zero (!) r? @metajack
This commit is contained in:
commit
ad2d1e9d87
3 changed files with 19 additions and 4 deletions
|
@ -17,6 +17,7 @@ use std::rt::task::Task;
|
|||
|
||||
use geom::size::Size2D;
|
||||
use gfx::font_context::{FontContext, FontContextInfo};
|
||||
use script::layout_interface::LayoutChan;
|
||||
use servo_msg::constellation_msg::ConstellationChan;
|
||||
use servo_net::local_image_cache::LocalImageCache;
|
||||
use servo_util::geometry::Au;
|
||||
|
@ -40,6 +41,9 @@ pub struct LayoutContext {
|
|||
/// The set of leaf DOM nodes.
|
||||
dom_leaf_set: MutexArc<DomLeafSet>,
|
||||
|
||||
/// A channel up to the layout task.
|
||||
layout_chan: LayoutChan,
|
||||
|
||||
/// The set of leaf flows.
|
||||
flow_leaf_set: MutexArc<FlowLeafSet>,
|
||||
|
||||
|
|
|
@ -324,6 +324,7 @@ impl LayoutTask {
|
|||
constellation_chan: self.constellation_chan.clone(),
|
||||
dom_leaf_set: self.dom_leaf_set.clone(),
|
||||
flow_leaf_set: self.flow_leaf_set.clone(),
|
||||
layout_chan: self.chan.clone(),
|
||||
font_context_info: font_context_info,
|
||||
stylist: &*self.stylist,
|
||||
reflow_root: OpaqueNode::from_layout_node(reflow_root),
|
||||
|
@ -549,10 +550,13 @@ impl LayoutTask {
|
|||
|| {
|
||||
// Initialize layout data for each node.
|
||||
//
|
||||
// FIXME: This is inefficient. We don't need an entire traversal to do this!
|
||||
profile(time::LayoutAuxInitCategory, self.profiler_chan.clone(), || {
|
||||
node.initialize_style_for_subtree(self.chan.clone());
|
||||
});
|
||||
// FIXME(pcwalton): This is inefficient. We don't need an entire traversal to do this
|
||||
// in sequential mode!
|
||||
if self.parallel_traversal.is_none() {
|
||||
profile(time::LayoutAuxInitCategory, self.profiler_chan.clone(), || {
|
||||
node.initialize_style_for_subtree(self.chan.clone());
|
||||
});
|
||||
}
|
||||
|
||||
// Perform CSS selector matching if necessary.
|
||||
match data.damage.level {
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
use css::matching::MatchMethods;
|
||||
use layout::context::LayoutContext;
|
||||
use layout::extra::LayoutAuxMethods;
|
||||
use layout::flow::{Flow, FlowLeafSet, PostorderFlowTraversal};
|
||||
use layout::flow;
|
||||
use layout::layout_task::{AssignHeightsAndStoreOverflowTraversal, BubbleWidthsTraversal};
|
||||
|
@ -130,6 +131,12 @@ fn match_and_cascade_node(unsafe_layout_node: UnsafeLayoutNode,
|
|||
// Get a real layout node.
|
||||
let node: LayoutNode = cast::transmute(unsafe_layout_node);
|
||||
|
||||
// Initialize layout data.
|
||||
//
|
||||
// FIXME(pcwalton): Stop allocating here. Ideally this should just be done by the HTML
|
||||
// parser.
|
||||
node.initialize_layout_data(layout_context.layout_chan.clone());
|
||||
|
||||
if node.is_element() {
|
||||
// Perform the CSS selector matching.
|
||||
let stylist: &Stylist = cast::transmute(layout_context.stylist);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue