Donner 0.8.0-pre
Embeddable browser-grade SVG2 engine
Loading...
Searching...
No Matches
donner::svg::DocumentState Class Reference

Shared mutable state behind SVGDocument and SVGElement facades. More...

#include "donner/svg/DocumentState.h"

Public Member Functions

 DocumentState ()
 Create a new empty document state.
 DocumentState (std::shared_ptr< Registry > registry)
 Wrap an existing shared registry.
Registryregistry ()
 Get the underlying ECS registry.
const Registryregistry () const
 Get the underlying ECS registry.
std::shared_ptr< RegistrysharedRegistry () const
 Get the shared registry retained by this state.
DocumentReadAccess read ()
 Acquire read access to the document.
DocumentWriteAccess write ()
 Acquire write access to the document.
std::uint64_t revision () const
 Current document mutation revision.
std::uint64_t mutationSequence () const
 Latest mutation-log sequence number.
DocumentMutationLogSnapshot mutationRecordsSince (std::uint64_t afterSequence) const
 Return mutation records after a previously observed sequence.
DocumentAccessDiagnostics accessDiagnostics () const
 Current document access diagnostics.
void resetAccessDiagnostics ()
 Reset cumulative access diagnostics.
bool currentThreadHasWriteAccess () const
 Returns true if this thread currently holds reentrant write access to this document.
bool currentThreadHasAccess () const
 Returns true if this thread currently holds read or write access to this document.
void bumpMutationRevision ()
 Mark the document as mutated.
DetachedNodeStatedetachedNodeState ()
 Detached-node collection state for this document.
const DetachedNodeStatedetachedNodeState () const
 Detached-node collection state for this document.
DetachedNodeCollectionDeferral deferDetachedNodeCollection ()
 Defer detached-node collection while a render snapshot or observer epoch may use it.
bool hasActiveDetachedNodeCollectionDeferral () const
 Returns true when a render snapshot or observer epoch is deferring collection.
std::uint64_t activeDetachedNodeCollectionEpoch () const
 Current detached-node collection epoch high-water.
ThreadingMode threadingMode () const
 Current DOM threading policy.
void setThreadingMode (ThreadingMode mode)
 Set the DOM threading policy.

Friends

class DetachedNodeCollectionDeferral
class DocumentReadAccess
class DocumentMutationBatch
class DocumentWriteAccess

Detailed Description

Shared mutable state behind SVGDocument and SVGElement facades.

This currently owns the ECS registry and a mutation revision. It is intentionally a thin indirection layer so later phases can add reader/writer guards and render snapshots without changing the public DOM handles again.

Constructor & Destructor Documentation

◆ DocumentState()

donner::svg::DocumentState::DocumentState ( std::shared_ptr< Registry > registry)
inlineexplicit

Wrap an existing shared registry.

Parameters
registryRegistry to retain.

Member Function Documentation

◆ mutationRecordsSince()

DocumentMutationLogSnapshot donner::svg::DocumentState::mutationRecordsSince ( std::uint64_t afterSequence) const
inline

Return mutation records after a previously observed sequence.

This is a polling hook for renderers, editor integrations, scripting, and future mutation observers. It intentionally does not invoke callbacks while document write access is held.

Parameters
afterSequenceLast sequence number already observed by the caller.

◆ resetAccessDiagnostics()

void donner::svg::DocumentState::resetAccessDiagnostics ( )
inline

Reset cumulative access diagnostics.

Active lock state is not modified. Callers should only reset diagnostics between measured intervals when no access guard is held if they need a clean lock-hold sample.

◆ setThreadingMode()

void donner::svg::DocumentState::setThreadingMode ( ThreadingMode mode)
inline

Set the DOM threading policy.

Parameters
modeNew threading mode.

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