Skip to main content

Module compositor

Module compositor 

Source
Expand description

Compositor — GPU-thread owner of the layer tree and scroll state.

Chrome: cc::LayerTreeHostImpl on the compositor thread.

The view thread builds frames (DisplayList + LayerTree) and commits them. The compositor owns the committed state and produces CompositorFrame for the GPU each vsync. Scroll is handled here — no view thread round-trip.

§Scroll ownership

The compositor exclusively owns scroll offsets. The view thread never sends scroll positions to the compositor. Instead:

  • Compositor → view: ScrollSync(offsets) after each scroll event
  • View thread paints with those offsets (read-only copy)
  • Commit sends topology (ScrollTree) but NOT positions (ScrollOffsets)

This eliminates the stale-offset problem: no matter how many frames the view thread is behind, the compositor’s scroll state is always current.

Modules§

frame
Compositor frame — what the GPU receives each vsync.
layer_tree
Layer tree — arena of compositor layers.

Structs§

Compositor
Receives committed frames from the view thread and produces CompositorFrame for the GPU.