Shared live-memory envelope for a root SVG document and all cached subdocuments. More...
#include "donner/svg/components/DocumentResourceFamilyBudget.h"
Classes | |
| struct | Limits |
| Per-kind and aggregate retained-byte ceilings. More... | |
| struct | SecurityStats |
| Current charges and sticky refusal state for diagnostics. More... | |
Public Types | |
| enum class | Kind : std::size_t { ParsedPayload , Geometry , ComputedFilter , ComputedStyle , DecodedImage , Count } |
| Categories charged against the shared document-family envelope. | |
Public Member Functions | |
| 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 | tryReserveStylePreparation (std::size_t bytes) |
| Reserve temporary style memory without consuming logical headroom or latching a refusal. | |
| void | releaseStylePreparation (std::size_t bytes) |
| Release the caller's exact temporary reservation. | |
| std::size_t | stylePreparationBytes () const |
| Bytes reserved by live provisional style contexts across this document family. | |
| bool | reserve (Kind kind, std::size_t bytes) |
| Charge retained bytes, permanently recording any refusal. | |
| bool | tryReserveRetainedGeometry (std::size_t bytes) |
| Charge executed retained geometry without latching a refusal before a full-frame retry. | |
| 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. | |
| SecurityStats | securityStats () const |
| Return the current counters and sticky refusal state. | |
Friends | |
| class | SubDocumentAdmission |
Shared live-memory envelope for a root SVG document and all cached subdocuments.
| 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 | stylePreparationBytes = kMaximumStylePreparationBytes | Temporary style memory may exceed the logical retained-byte charge up to this ceiling. |
| size_t | textPathMeasurementWorkUnits = 32 * 1024 * 1024 | Maximum cumulative text-path measurement work across the document family. |
| 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. |
|
inlineexplicit |
Construct a shared envelope with caller-supplied limits.
| limits | Per-kind and aggregate retained-byte ceilings. |
|
inline |
Return the additional bytes currently admissible under both category and total limits.
| kind | Resource category to inspect. |
|
inline |
Check a reservation without changing the counters or refusal state.
| kind | Resource category to charge. |
| bytes | Additional retained bytes requested. |
|
inline |
Release up to the currently retained bytes for one resource category.
| kind | Resource category to debit. |
| bytes | Requested byte reduction, clamped to the retained amount. |
|
inline |
Charge retained bytes, permanently recording any refusal.
| kind | Resource category to charge. |
| bytes | Additional retained bytes requested. |
|
inline |
Return the retained byte count for a category.
| kind | Resource category to inspect. |