refactor(overlays): hand the shell's overlay host the engine, not the viewer

The controls pass the scene engine to the shell, which initializes the
world overlay on it; initWorldOverlay takes only a globe engine (a viewer
or null is refused), so the shell no longer needs a viewer for its
overlay. engineFromViewer only returns the engine registered for a viewer
(the scene engine until teardown) and never builds one, so no engine can
outlive its viewer without a destroy path. Overlay and detection tests
and the allocation worker build a Cesium engine on their mock viewers and
destroy it with them; frame allocation is unchanged.
This commit is contained in:
German Khokhlov committed 2026-10-15 18:53:57 +04:00
1 parent 3e3aa0bd9f
commit 12c9651a67
10 files changed
+145 -105

No files matched your search

+4 -4
View File
@@ -80,9 +80,9 @@ test('the scene engine is the one engineFromViewer returns for its viewer until
assert.equal(engineFromViewer(viewer), engine);
for (const cleanup of cleanups.reverse()) cleanup();
assert.equal(engine.fake.destroyed, true);
assert.throws(
() => engineFromViewer(viewer),
/createCesiumEngine needs a viewer/,
'no longer registered: a fresh one would be built',
assert.equal(
engineFromViewer(viewer),
null,
'no longer registered, and none is built',
);
});