[][src]Struct layout_thread::LayoutThread

pub struct LayoutThread {
    id: PipelineId,
    top_level_browsing_context_id: TopLevelBrowsingContextId,
    url: ServoUrl,
    stylist: Stylist,
    is_iframe: bool,
    port: Receiver<Msg>,
    pipeline_port: Receiver<LayoutControlMsg>,
    font_cache_receiver: Receiver<()>,
    font_cache_sender: IpcSender<()>,
    background_hang_monitor: Box<dyn BackgroundHangMonitor>,
    constellation_chan: IpcSender<ConstellationMsg>,
    script_chan: IpcSender<ConstellationControlMsg>,
    time_profiler_chan: ProfilerChan,
    mem_profiler_chan: ProfilerChan,
    image_cache: Arc<dyn ImageCache>,
    font_cache_thread: FontCacheThread,
    first_reflow: Cell<bool>,
    parallel_flag: bool,
    generation: Cell<u32>,
    outstanding_web_fonts: Arc<AtomicUsize>,
    root_flow: RefCell<Option<FlowRef>>,
    document_shared_lock: Option<SharedRwLock>,
    epoch: Cell<Epoch>,
    viewport_size: UntypedSize2D<Au>,
    rw_data: Arc<Mutex<LayoutThreadData>>,
    webrender_image_cache: Arc<RwLock<FnvHashMap<(ServoUrl, UsePlaceholder), WebRenderImageInfo>>>,
    registered_painters: RegisteredPaintersImpl,
    webrender_api: WebrenderIpcSender,
    paint_time_metrics: PaintTimeMetrics,
    layout_query_waiting_time: Histogram,
    last_iframe_sizes: RefCell<HashMap<BrowsingContextId, Size2D<f32, CSSPixel>>>,
    busy: Arc<AtomicBool>,
    load_webfonts_synchronously: bool,
    dump_display_list: bool,
    dump_display_list_json: bool,
    dump_style_tree: bool,
    dump_rule_tree: bool,
    relayout_event: bool,
    nonincremental_layout: bool,
    trace_layout: bool,
    dump_flow_tree: bool,
}

Information needed by the layout thread.

Fields

id: PipelineId

The ID of the pipeline that we belong to.

top_level_browsing_context_id: TopLevelBrowsingContextId

The ID of the top-level browsing context that we belong to.

url: ServoUrl

The URL of the pipeline that we belong to.

stylist: Stylist

Performs CSS selector matching and style resolution.

is_iframe: bool

Is the current reflow of an iframe, as opposed to a root window?

port: Receiver<Msg>

The port on which we receive messages from the script thread.

pipeline_port: Receiver<LayoutControlMsg>

The port on which we receive messages from the constellation.

font_cache_receiver: Receiver<()>

The port on which we receive messages from the font cache thread.

font_cache_sender: IpcSender<()>

The channel on which the font cache can send messages to us.

background_hang_monitor: Box<dyn BackgroundHangMonitor>

A means of communication with the background hang monitor.

constellation_chan: IpcSender<ConstellationMsg>

The channel on which messages can be sent to the constellation.

script_chan: IpcSender<ConstellationControlMsg>

The channel on which messages can be sent to the script thread.

time_profiler_chan: ProfilerChan

The channel on which messages can be sent to the time profiler.

mem_profiler_chan: ProfilerChan

The channel on which messages can be sent to the memory profiler.

image_cache: Arc<dyn ImageCache>

Reference to the script thread image cache.

font_cache_thread: FontCacheThread

Public interface to the font cache thread.

first_reflow: Cell<bool>

Is this the first reflow in this LayoutThread?

parallel_flag: bool

Flag to indicate whether to use parallel operations

generation: Cell<u32>

Starts at zero, and increased by one every time a layout completes. This can be used to easily check for invalid stale data.

outstanding_web_fonts: Arc<AtomicUsize>

The number of Web fonts that have been requested but not yet loaded.

root_flow: RefCell<Option<FlowRef>>

The root of the flow tree.

document_shared_lock: Option<SharedRwLock>

The document-specific shared lock used for author-origin stylesheets

epoch: Cell<Epoch>

A counter for epoch messages

viewport_size: UntypedSize2D<Au>

The size of the viewport. This may be different from the size of the screen due to viewport constraints.

rw_data: Arc<Mutex<LayoutThreadData>>

A mutex to allow for fast, read-only RPC of layout's internal data structures, while still letting the LayoutThread modify them.

All the other elements of this struct are read-only.

webrender_image_cache: Arc<RwLock<FnvHashMap<(ServoUrl, UsePlaceholder), WebRenderImageInfo>>>registered_painters: RegisteredPaintersImpl

The executors for paint worklets.

webrender_api: WebrenderIpcSender

Webrender interface.

paint_time_metrics: PaintTimeMetrics

Paint time metrics.

layout_query_waiting_time: Histogram

The time a layout query has waited before serviced by layout thread.

last_iframe_sizes: RefCell<HashMap<BrowsingContextId, Size2D<f32, CSSPixel>>>

The sizes of all iframes encountered during the last layout operation.

busy: Arc<AtomicBool>

Flag that indicates if LayoutThread is busy handling a request.

load_webfonts_synchronously: bool

Load web fonts synchronously to avoid non-deterministic network-driven reflows.

dump_display_list: bool

Dumps the display list form after a layout.

dump_display_list_json: bool

Dumps the display list in JSON form after a layout.

dump_style_tree: bool

Dumps the DOM after restyle.

dump_rule_tree: bool

Dumps the flow tree after a layout.

relayout_event: bool

Emits notifications when there is a relayout.

nonincremental_layout: bool

True to turn off incremental layout.

trace_layout: bool

True if each step of layout is traced to an external JSON file for debugging purposes. Setting this implies sequential layout and paint.

dump_flow_tree: bool

Dumps the flow tree after a layout.

Implementations

impl LayoutThread[src]

fn new(
    id: PipelineId,
    top_level_browsing_context_id: TopLevelBrowsingContextId,
    url: ServoUrl,
    is_iframe: bool,
    port: Receiver<Msg>,
    pipeline_port: IpcReceiver<LayoutControlMsg>,
    background_hang_monitor: Box<dyn BackgroundHangMonitor>,
    constellation_chan: IpcSender<ConstellationMsg>,
    script_chan: IpcSender<ConstellationControlMsg>,
    image_cache: Arc<dyn ImageCache>,
    font_cache_thread: FontCacheThread,
    time_profiler_chan: ProfilerChan,
    mem_profiler_chan: ProfilerChan,
    webrender_api: WebrenderIpcSender,
    paint_time_metrics: PaintTimeMetrics,
    busy: Arc<AtomicBool>,
    load_webfonts_synchronously: bool,
    window_size: WindowSizeData,
    dump_display_list: bool,
    dump_display_list_json: bool,
    dump_style_tree: bool,
    dump_rule_tree: bool,
    relayout_event: bool,
    nonincremental_layout: bool,
    trace_layout: bool,
    dump_flow_tree: bool
) -> LayoutThread
[src]

Creates a new LayoutThread structure.

fn start(self)[src]

Starts listening on the port.

fn build_layout_context<'a>(
    &'a self,
    guards: StylesheetGuards<'a>,
    snapshot_map: &'a SnapshotMap,
    origin: ImmutableOrigin,
    animation_timeline_value: f64,
    animations: &DocumentAnimationSet,
    stylesheets_changed: bool
) -> LayoutContext<'a>
[src]

fn notify_activity_to_hang_monitor(&self, request: &Msg)[src]

fn handle_request<'a, 'b>(
    &mut self,
    possibly_locked_rw_data: &mut RwData<'a, 'b>
) -> bool
[src]

Receives and dispatches messages from the script and constellation threads

fn handle_request_helper<'a, 'b>(
    &mut self,
    request: Msg,
    possibly_locked_rw_data: &mut RwData<'a, 'b>
) -> bool
[src]

Receives and dispatches messages from other threads.

fn collect_reports<'a, 'b>(
    &self,
    reports_chan: ReportsChan,
    possibly_locked_rw_data: &mut RwData<'a, 'b>
)
[src]

fn create_layout_thread(&self, info: LayoutThreadInit)[src]

fn prepare_to_exit(&mut self, response_chan: Sender<()>)[src]

Enters a quiescent state in which no new messages will be processed until an ExitNow is received. A pong is immediately sent on the given response channel.

fn exit_now(&mut self)[src]

Shuts down the layout thread now. If there are any DOM nodes left, layout will now (safely) crash.

fn handle_add_stylesheet(
    &self,
    stylesheet: &Stylesheet,
    guard: &SharedRwLockReadGuard
)
[src]

fn handle_set_quirks_mode<'a, 'b>(&mut self, quirks_mode: QuirksMode)[src]

Sets quirks mode for the document, causing the quirks mode stylesheet to be used.

fn try_get_layout_root<'dom>(
    &self,
    node: impl LayoutNode<'dom>
) -> Option<FlowRef>
[src]

fn solve_constraints(layout_root: &mut dyn Flow, layout_context: &LayoutContext)[src]

Performs layout constraint solving.

This corresponds to Reflow() in Gecko and layout() in WebKit/Blink and should be benchmarked against those two. It is marked #[inline(never)] to aid profiling.

fn solve_constraints_parallel(
    traversal: &ThreadPool,
    layout_root: &mut dyn Flow,
    profiler_metadata: Option<TimerMetadata>,
    time_profiler_chan: ProfilerChan,
    layout_context: &LayoutContext
)
[src]

Performs layout constraint solving in parallel.

This corresponds to Reflow() in Gecko and layout() in WebKit/Blink and should be benchmarked against those two. It is marked #[inline(never)] to aid profiling.

fn compute_abs_pos_and_build_display_list(
    &self,
    data: &Reflow,
    reflow_goal: &ReflowGoal,
    document: Option<&ServoLayoutDocument>,
    layout_root: &mut dyn Flow,
    layout_context: &mut LayoutContext,
    rw_data: &mut LayoutThreadData
)
[src]

Computes the stacking-relative positions of all flows and, if the painting is dirty and the reflow type need it, builds the display list.

fn handle_reflow<'a, 'b>(
    &mut self,
    data: &mut ScriptReflowResult,
    possibly_locked_rw_data: &mut RwData<'a, 'b>
)
[src]

The high-level routine that performs layout threads.

fn respond_to_query_if_necessary(
    &self,
    reflow_goal: &ReflowGoal,
    rw_data: &mut LayoutThreadData,
    context: &mut LayoutContext,
    reflow_result: &mut ReflowComplete,
    shared_lock: &SharedRwLock
)
[src]

fn set_scroll_states<'a, 'b>(
    &mut self,
    new_scroll_states: Vec<ScrollState>,
    possibly_locked_rw_data: &mut RwData<'a, 'b>
)
[src]

fn cancel_animations_for_nodes_not_in_flow_tree(
    animations: &mut FxHashMap<AnimationSetKey, ElementAnimationSet>,
    root_flow: &mut dyn Flow
)
[src]

Cancel animations for any nodes which have been removed from flow tree. TODO(mrobinson): We should look into a way of doing this during flow tree construction. This also doesn't yet handles nodes that have been reparented.

fn perform_post_style_recalc_layout_passes(
    &self,
    root_flow: &mut FlowRef,
    data: &Reflow,
    reflow_goal: &ReflowGoal,
    document: Option<&ServoLayoutDocument>,
    rw_data: &mut LayoutThreadData,
    context: &mut LayoutContext
)
[src]

fn perform_post_main_layout_passes(
    &self,
    data: &Reflow,
    root_flow: &mut FlowRef,
    reflow_goal: &ReflowGoal,
    document: Option<&ServoLayoutDocument>,
    rw_data: &mut LayoutThreadData,
    layout_context: &mut LayoutContext
)
[src]

fn reflow_all_nodes(flow: &mut dyn Flow)[src]

fn profiler_metadata(&self) -> Option<TimerMetadata>[src]

Returns profiling information which is passed to the time profiler.

Trait Implementations

impl LayoutThreadFactory for LayoutThread[src]

type Message = Msg

fn create(
    id: PipelineId,
    top_level_browsing_context_id: TopLevelBrowsingContextId,
    url: ServoUrl,
    is_iframe: bool,
    chan: (Sender<Msg>, Receiver<Msg>),
    pipeline_port: IpcReceiver<LayoutControlMsg>,
    background_hang_monitor_register: Box<dyn BackgroundHangMonitorRegister>,
    constellation_chan: IpcSender<ConstellationMsg>,
    script_chan: IpcSender<ConstellationControlMsg>,
    image_cache: Arc<dyn ImageCache>,
    font_cache_thread: FontCacheThread,
    time_profiler_chan: ProfilerChan,
    mem_profiler_chan: ProfilerChan,
    webrender_api_sender: WebrenderIpcSender,
    paint_time_metrics: PaintTimeMetrics,
    busy: Arc<AtomicBool>,
    load_webfonts_synchronously: bool,
    window_size: WindowSizeData,
    dump_display_list: bool,
    dump_display_list_json: bool,
    dump_style_tree: bool,
    dump_rule_tree: bool,
    relayout_event: bool,
    nonincremental_layout: bool,
    trace_layout: bool,
    dump_flow_tree: bool
)
[src]

Spawns a new layout thread.

impl ProfilerMetadataFactory for LayoutThread[src]

Auto Trait Implementations

impl !RefUnwindSafe for LayoutThread

impl !Send for LayoutThread

impl !Sync for LayoutThread

impl Unpin for LayoutThread

impl !UnwindSafe for LayoutThread

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Erased for T[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> MaybeBoxed<Box<T>> for T[src]

impl<T> MaybeBoxed<T> for T[src]

impl<T> Same<T> for T[src]

type Output = T

Should always be Self

impl<T> SetParameter for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]