TileScheduler Class

Definition

Decides which tiles a viewer draws and when: visible tiles first (each visible page's low-resolution placeholder, then its sharp tiles), then the tiles near the viewport, then the tiles ahead in the scroll direction; cancels work the viewport has left; keeps the tiles on the surface, the tiles being drawn and the document's render caches within one memory budget.

public sealed class TileScheduler : IDisposable

Remarks

Spec #33 viewer capabilities 1 (tiles from cached display lists), 3 (render-ahead with cancellation) and 13 (one memory budget). ISO 32000-2 §10.7.1 (rendering through display lists).

The shell calls Update(in Viewport) whenever the viewport changes and RunFrame(TimeSpan) once per frame (for example from requestAnimationFrame) while it returns true. With a cooperative session (the browser, one thread) the frame does the work itself, in slices of the session's SliceBudget, until the frame's budget is spent: at most one display-list build runs per frame, and only while no slow build has run in it yet, because a build cannot be interrupted, so a frame overruns its budget by at most one build. With a background session the frame only plans: it queues up to MaxConcurrency tile jobs on the thread pool and returns at once, and each job loads its page, builds or takes its display list, renders and presents on workers, so Present(Tile, Bitmap) and Evict(Tile) are then called on worker threads too (#357): the UI thread only draws what the surface holds.

A tile of a lower priority starts only once every wanted tile of a higher one is on the surface (or failed), so an off-screen tile never renders before a visible one. A render the viewport has left is cancelled and never reaches the surface. The tiles on the surface are kept (scrolling back shows them without rendering) until the budget needs their bytes: tiles no longer wanted go first, least recently wanted first, then the document's caches are trimmed (TrimCaches(Int64)), then wanted tiles of a lower priority than the one being started. The surface drops evicted tiles in Evict(Tile).

Use from one thread (the UI thread); the background renders it starts take its lock to report back. Disposing it cancels its renders; it does not close the session or clear the surface.

Tip: use kind:method, kind:property, kind:ctor. Press Esc to clear.

Constructors (1)

Properties (4)

Methods (8)