Donner 0.5.1
Embeddable browser-grade SVG2 engine
Loading...
Searching...
No Matches
CommandQueue.h File Reference

CommandQueue is the per-frame EditorCommand queue described in the "AsyncSVGDocument: single-threaded command queue" section of docs/design_docs/editor.md. It accumulates editor-initiated DOM mutations on the UI thread and coalesces them at flush time. More...

#include <deque>
#include <vector>
#include "donner/editor/EditorCommand.h"
Include dependency graph for CommandQueue.h:
This graph shows which files directly or indirectly include this file:

Classes

class  donner::editor::CommandQueue
struct  donner::editor::CommandQueue::FlushResult

Namespaces

namespace  donner
 Top-level Donner namespace, which is split into different sub-namespaces such as donner::svg and donner::css.

Detailed Description

CommandQueue is the per-frame EditorCommand queue described in the "AsyncSVGDocument: single-threaded command queue" section of docs/design_docs/editor.md. It accumulates editor-initiated DOM mutations on the UI thread and coalesces them at flush time.

Coalescing rules (applied in flush()):

  1. ReplaceDocument is exclusive: it drops every command queued before it (their entity references would be invalidated by the re-parse). Commands queued after a ReplaceDocument apply against the new document.
  2. SetTransform collapses by entity: multiple SetTransform commands targeting the same Entity flush as a single command carrying the most recent transform. A drag that produces 60 mouse-move SetTransform commands per second flushes as a single setTransform() call.
  3. No reordering across commands targeting different entities. Coalescing only collapses redundant writes.

The queue is single-threaded — it must only be touched from the UI thread. The render thread reads document state via the snapshot hand-off in AsyncSVGDocument, never via the queue directly.


Class Documentation

◆ donner::editor::CommandQueue::FlushResult

struct donner::editor::CommandQueue::FlushResult
Collaboration diagram for donner::editor::CommandQueue::FlushResult:
[legend]
Class Members
vector< EditorCommand > effectiveCommands
bool hadReplaceDocument = false True when any ReplaceDocument was drained from the raw pending batch.
bool preserveUndoOnReparse = false True only when the drained batch contained at least one ReplaceDocument and every drained ReplaceDocument carried the preserve-undo marker.