Donner SVG main
0.8.0 ยท 382bd0190.8.0 main
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
donner::svg::components::AnimationResourceBudget Class Reference

Per-document animation admission with optional owner-frame contextual preparation admission. More...

#include "donner/svg/components/animation/AnimationResourceBudget.h"

Public Member Functions

std::size_t remainingReferenceWork () const
 Remaining shared reference lookup work.
bool reserveReferenceWork (std::size_t work)
 Admit reference work before copying IDs, comparing bytes, or advancing the tree.
std::size_t remainingContextualWork () const
 Remaining contextual work; shared by scalar/font stacks and every contextual length consumer.
void resetContextualWork ()
 Begin preparation for another occurrence without replenishing its shared owner allowance.
void setContextualWorkBudget (std::shared_ptr< AnimationContextualWorkBudget > budget)
 Bind an owner allowance, or detach it.
std::shared_ptr< AnimationContextualWorkBudget > contextualWorkBudget () const
 Return the owned binding so a nested scope can restore only its own changes.
bool reserveContextualWork (std::size_t work)
 Admit consumer work before evaluating a recipe. Refused consumers retain their base value.
std::size_t remainingGeometryWork () const
 Remaining path work for this frame.
bool reserveGeometryWork (std::size_t work)
 Charge bounded path parsing or measurement work; reject on exhaustion.
bool reserveAnimation (std::size_t sourceBytes)
 Charge one animation and its source payload to the frame envelope.
bool reserveSourceBytes (std::size_t bytes)
 Admit additional source bytes before copying an underlying or referenced value.
bool reserveOutput (std::size_t bytes)
 Charge produced animation data to the frame output envelope.
std::size_t animations () const
 Number of animations admitted so far.
std::size_t sourceBytes () const
 Aggregate animation source bytes admitted so far.
std::size_t outputBytes () const
 Aggregate animation output bytes admitted so far.
bool rejected () const
 Whether declaration, source, output or path-work admission rejected the sample.

Static Public Attributes

static constexpr std::size_t kMaximumAnimations = 4096
 Maximum number of animation declarations accepted in one frame.
static constexpr std::size_t kMaximumSourceBytes = 1024 * 1024
 Maximum aggregate source bytes retained for animation values.
static constexpr std::size_t kMaximumOutputBytes = 4 * 1024 * 1024
 Maximum aggregate output bytes produced by animation evaluation.
static constexpr std::size_t kMaximumNumbersPerValue = 64
 Maximum numeric values accepted in one animated value.
static constexpr std::size_t kMaximumPathValueBytes = 64 * 1024
 Maximum source bytes accepted for one animated path value.
static constexpr std::size_t kMaximumGeometryWork = 262144
 Maximum path parsing and arc-length work across one animation sample.
static constexpr std::size_t kMaximumContextualWork = AnimationContextualWorkBudget::kMaximumWork
 Aggregate contextual-length evaluation and measurement work during render preparation.
static constexpr std::size_t kMaximumReferenceWork = 4 * 1024 * 1024
 Maximum ID hashing, comparison and document traversal work per sample or event.

Detailed Description

Per-document animation admission with optional owner-frame contextual preparation admission.

Member Function Documentation

◆ reserveAnimation()

bool donner::svg::components::AnimationResourceBudget::reserveAnimation ( std::size_t sourceBytes)
inline

Charge one animation and its source payload to the frame envelope.

Parameters
sourceBytesSource bytes retained for this animation.
Returns
False when the animation-count or source-byte limit is exceeded.

◆ reserveContextualWork()

bool donner::svg::components::AnimationResourceBudget::reserveContextualWork ( std::size_t work)
inline

Admit consumer work before evaluating a recipe. Refused consumers retain their base value.

Parameters
workConservative parsing/interpolation or measured path-work cost.

◆ reserveOutput()

bool donner::svg::components::AnimationResourceBudget::reserveOutput ( std::size_t bytes)
inline

Charge produced animation data to the frame output envelope.

Parameters
bytesAdditional output bytes to reserve.
Returns
False when the output-byte limit is exceeded.

◆ reserveReferenceWork()

bool donner::svg::components::AnimationResourceBudget::reserveReferenceWork ( std::size_t work)
inline

Admit reference work before copying IDs, comparing bytes, or advancing the tree.

Parameters
workConservative byte or node-operation count.

◆ reserveSourceBytes()

bool donner::svg::components::AnimationResourceBudget::reserveSourceBytes ( std::size_t bytes)
inline

Admit additional source bytes before copying an underlying or referenced value.

Parameters
bytesSource bytes to retain or parse.
Returns
False when the aggregate source envelope is exceeded.

◆ setContextualWorkBudget()

void donner::svg::components::AnimationResourceBudget::setContextualWorkBudget ( std::shared_ptr< AnimationContextualWorkBudget > budget)
inline

Bind an owner allowance, or detach it.

Parameters
budgetShared preparation counter, or null.

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