Shared live-memory envelope for a root SVG document and all cached subdocuments.
More...
#include "donner/svg/components/DocumentResourceFamilyBudget.h"
|
| enum class | Kind : std::size_t {
ParsedPayload
,
Geometry
,
ComputedFilter
,
ComputedStyle
,
DecodedImage
,
Count
} |
| | Categories charged against the shared document-family envelope.
|
|
| | DocumentResourceFamilyBudget (Limits limits) |
| | Construct a shared envelope with caller-supplied limits.
|
| bool | canReserve (Kind kind, std::size_t bytes) const |
| | Check a reservation without changing the counters or refusal state.
|
| std::size_t | availableBytes (Kind kind) const |
| | Return the additional bytes currently admissible under both category and total limits.
|
| bool | reserve (Kind kind, std::size_t bytes) |
| | Charge retained bytes, permanently recording any refusal.
|
|
bool | reserveTextPathMeasurementWork (std::size_t units) |
| | Preflight text-path measurement work before it can allocate adaptive samples.
|
|
std::size_t | availableTextPathMeasurementWork () const |
| | Remaining cumulative text-path measurement work before fail-closed rejection.
|
|
void | rejectTextPathMeasurementWork () |
| | Refuse the rest of the current epoch after an admitted measurement exhausts its allowance.
|
|
void | beginTextPathMeasurementWorkEpoch () |
| | Begin a nestable render/preparation epoch for cumulative text-path measurement work.
|
|
void | endTextPathMeasurementWorkEpoch () |
| | End a text-path measurement epoch begun by beginTextPathMeasurementWorkEpoch().
|
|
void | releaseUnusedTextPathMeasurementWork (std::size_t units) |
| | Refund preflight work that the measurement did not consume.
|
| void | release (Kind kind, std::size_t bytes) |
| | Release up to the currently retained bytes for one resource category.
|
| std::size_t | retainedBytes (Kind kind) const |
| | Return the retained byte count for a category.
|
|
std::size_t | totalRetainedBytes () const |
| | Return the aggregate retained bytes across all resource kinds.
|
|
const Limits & | limits () const |
| | Return the active per-kind and aggregate byte ceilings.
|
|
const SecurityStats & | securityStats () const |
| | Return the current counters and sticky refusal state.
|
|
|
static constexpr std::size_t | kDefaultMaximumTotalRetainedBytes = 128 * 1024 * 1024 |
| | Default maximum aggregate retained bytes across all resource kinds.
|
|
|
class | SubDocumentAdmission |
Shared live-memory envelope for a root SVG document and all cached subdocuments.
◆ donner::svg::components::DocumentResourceFamilyBudget::Limits
| struct donner::svg::components::DocumentResourceFamilyBudget::Limits |
Per-kind and aggregate retained-byte ceilings.
| Class Members |
|
size_t |
computedFilterBytes = 64 * 1024 * 1024 |
Maximum retained computed-filter bytes. |
|
size_t |
computedStyleBytes = 64 * 1024 * 1024 |
Maximum retained computed-style bytes. |
|
size_t |
decodedImageBytes = 64 * 1024 * 1024 |
Maximum retained decoded raster-image bytes across the document family. |
|
size_t |
geometryBytes = 64 * 1024 * 1024 |
Maximum retained geometry bytes. |
|
size_t |
maximumTotalRetainedBytes = kDefaultMaximumTotalRetainedBytes |
Maximum bytes retained across every kind combined. |
|
size_t |
parsedPayloadBytes = 64 * 1024 * 1024 |
Maximum retained parsed payload bytes. |
|
size_t |
textPathMeasurementWorkUnits = 32 * 1024 * 1024 |
Maximum cumulative text-path measurement work across the document family. |
◆ donner::svg::components::DocumentResourceFamilyBudget::SecurityStats
| struct donner::svg::components::DocumentResourceFamilyBudget::SecurityStats |
Current charges and sticky refusal state for diagnostics.
| Class Members |
|
bool |
rejected = false |
Whether any reservation has been refused. |
|
size_t |
rejectedReservations = 0 |
Number of refused reservation attempts. |
|
array< size_t, static_cast< size_t >(Count)> |
retainedBytes {} |
Retained bytes indexed by Kind. |
|
bool |
textPathMeasurementWorkRejected = false |
Whether text-path measurement work was refused in the current epoch. |
|
size_t |
textPathMeasurementWorkUnits = 0 |
Cumulative admitted text-path measurement work that was actually consumed. |
|
size_t |
totalRetainedBytes = 0 |
Retained bytes across all resource kinds. |
◆ DocumentResourceFamilyBudget()
| donner::svg::components::DocumentResourceFamilyBudget::DocumentResourceFamilyBudget |
( |
Limits | limits | ) |
|
|
inlineexplicit |
Construct a shared envelope with caller-supplied limits.
- Parameters
-
| limits | Per-kind and aggregate retained-byte ceilings. |
◆ availableBytes()
| std::size_t donner::svg::components::DocumentResourceFamilyBudget::availableBytes |
( |
Kind | kind | ) |
const |
|
inline |
Return the additional bytes currently admissible under both category and total limits.
- Parameters
-
| kind | Resource category to inspect. |
◆ canReserve()
| bool donner::svg::components::DocumentResourceFamilyBudget::canReserve |
( |
Kind | kind, |
|
|
std::size_t | bytes ) const |
|
inline |
Check a reservation without changing the counters or refusal state.
- Parameters
-
| kind | Resource category to charge. |
| bytes | Additional retained bytes requested. |
- Returns
- True when the budget is not rejected and both ceilings admit the charge.
◆ release()
| void donner::svg::components::DocumentResourceFamilyBudget::release |
( |
Kind | kind, |
|
|
std::size_t | bytes ) |
|
inline |
Release up to the currently retained bytes for one resource category.
- Parameters
-
| kind | Resource category to debit. |
| bytes | Requested byte reduction, clamped to the retained amount. |
◆ reserve()
| bool donner::svg::components::DocumentResourceFamilyBudget::reserve |
( |
Kind | kind, |
|
|
std::size_t | bytes ) |
|
inline |
Charge retained bytes, permanently recording any refusal.
- Parameters
-
| kind | Resource category to charge. |
| bytes | Additional retained bytes requested. |
- Returns
- True when the charge was accepted; false after a prior or current refusal.
◆ retainedBytes()
| std::size_t donner::svg::components::DocumentResourceFamilyBudget::retainedBytes |
( |
Kind | kind | ) |
const |
|
inline |
Return the retained byte count for a category.
- Parameters
-
| kind | Resource category to inspect. |
- Returns
- Current bytes for a valid category, or zero for an invalid one.
The documentation for this class was generated from the following file: