Expand description
A processor that runs the layout builder on a background thread.
build_layout_and_info_* is expensive (CSS cascade, text measurement,
layout-tree construction), so it is offloaded to a background thread to
keep the UI thread responsive. The builder walks a Send DomSnapshot,
so the snapshot is the only input that needs to be handed to the thread.
Per-frame lightweight layout (LayoutEngine::layout) still runs on the UI
thread as before. This processor only handles the heavier tree build.
Tasks are coalesced: each task carries a monotonic sequence number, and the thread skips a task as soon as a newer one has been queued. The newest task always captures the latest DOM/styles/images, so the skipped build’s work would be wasted anyway.
Structs§
- Layout
Processor - A processor that accepts a
DomSnapshotand returns the layout result produced by the thread. - Layout
Result - The layout the builder finished on the background thread.
- Layout
Task - The complete set of inputs the builder needs to run on the background thread.