Donner SVG 0.8.0-pre
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
donner::svg::RetainedSpanDocumentState Struct Reference

Document-wide state for retained coverage, stored in the registry context. More...

#include "donner/svg/renderer/RetainedSpans.h"

Public Attributes

std::size_t liveBytes = 0
 Bytes currently held by every retained entry in this document.
std::size_t budgetBytes = kDefaultBudgetBytes
 Ceiling on liveBytes.
bool disabled = false
 Set when the working set did not fit the budget, which turns retention off for this document until it is reset. Falling back wholesale is cheaper and more predictable than re-capturing the same shapes every frame.
std::uint64_t evictions = 0
 Entries evicted to stay under budget, across the document's lifetime.
std::uint64_t frameCounter = 0
 Issues frame identities. Every frame of every renderer drawing this document takes the next value, so "already drawn in this frame" cannot be confused with "drawn by another renderer".

Static Public Attributes

static constexpr std::size_t kDefaultBudgetBytes = 32u * 1024u * 1024u
 Default budget. Sized so a full-viewport document of a few hundred shapes fits while a pathological one cannot grow unbounded.

Detailed Description

Document-wide state for retained coverage, stored in the registry context.

Retained coverage is attacker-influenced: a document chooses how many shapes exist and how much coverage each produces. The budget here is what keeps that bounded. Exceeding it evicts the coldest entries, and a working set that does not fit at all turns retention off for the document rather than growing without limit.

It also issues frame identities, because retained entries belong to the document rather than to any one renderer: several renderers can draw one document, and each of their frames needs an identity the others cannot collide with.


The documentation for this struct was generated from the following file: