Donner 0.5.1
Embeddable browser-grade SVG2 engine
Loading...
Searching...
No Matches
donner::editor::sandbox::SandboxHost Class Reference

Spawns and communicates with the sandbox child binary. Not thread-safe: construct one instance per thread that needs to render. More...

#include "donner/editor/sandbox/SandboxHost.h"

Public Member Functions

 SandboxHost (std::string childBinaryPath)
RenderResult renderToBackend (std::string_view svgBytes, int width, int height, svg::RendererInterface &target)
 Renders svgBytes into a caller-provided RendererInterface via the sandbox child + host-side ReplayingRenderer. The child's wire stream is decoded into target — after this call returns with kOk, the target has received beginFrame(), a sequence of drawing calls, and endFrame(), same as if the driver had run in-process.
RenderResult render (std::string_view svgBytes, int width, int height)
 Convenience wrapper: renders via renderToBackend into a host-side Renderer and encodes the snapshot to PNG. Preserves the S1 public contract so existing callers (tests, CLIs) don't have to change.

Detailed Description

Spawns and communicates with the sandbox child binary. Not thread-safe: construct one instance per thread that needs to render.

Constructor & Destructor Documentation

◆ SandboxHost()

donner::editor::sandbox::SandboxHost::SandboxHost ( std::string childBinaryPath)
explicit
Parameters
childBinaryPathAbsolute path to the donner_parser_child executable. Callers in tests should resolve this via donner::Runfiles.

Member Function Documentation

◆ renderToBackend()

RenderResult donner::editor::sandbox::SandboxHost::renderToBackend ( std::string_view svgBytes,
int width,
int height,
svg::RendererInterface & target )

Renders svgBytes into a caller-provided RendererInterface via the sandbox child + host-side ReplayingRenderer. The child's wire stream is decoded into target — after this call returns with kOk, the target has received beginFrame(), a sequence of drawing calls, and endFrame(), same as if the driver had run in-process.

Parameters
svgBytesRaw SVG source (may contain any bytes; not NUL-terminated).
widthCanvas width in CSS pixels.
heightCanvas height in CSS pixels.
targetDestination renderer. Must outlive this call.

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