Document which inputs a warm cached renderer keeps from the application that built it

This commit is contained in:
German Khokhlov committed 2026-11-03 14:47:36 +04:00
1 parent 64759c552e
commit 64c5cd25e6
1 file changed
+16 -7
+16 -7
View File
@@ -32,10 +32,12 @@ export async function createApplicationScene({
layerSession, layerSession,
...options ...options
}) { }) {
const operations = layerSession?.operations ?? createApplicationOperations({ const operations =
requests: requestServices, layerSession?.operations ??
signal: layerSession?.lifetime.signal ?? signal, createApplicationOperations({
}); requests: requestServices,
signal: layerSession?.lifetime.signal ?? signal,
});
if (layerSession) layerSession.operations = operations; if (layerSession) layerSession.operations = operations;
defer(initLogoGaze()); defer(initLogoGaze());
const previousKey = window.__GOOGLE_MAPS_API_KEY__; const previousKey = window.__GOOGLE_MAPS_API_KEY__;
@@ -47,6 +49,12 @@ export async function createApplicationScene({
else window.__GOOGLE_MAPS_API_KEY__ = previousKey; else window.__GOOGLE_MAPS_API_KEY__ = previousKey;
}); });
} }
// A cached renderer is built once, by the first application that asks for
// its engine, and later applications reuse it warm. Everything this closure
// captures from that application (its abort signal, the loader status
// element, Navara's `?look=` read from location.search) is read only while
// the renderer is being built; nothing in the built scene keeps using it.
// A changed `?look=` therefore applies to a renderer built after it.
const build = (resources) => const build = (resources) =>
createRenderer({ createRenderer({
...options, ...options,
@@ -54,9 +62,10 @@ export async function createApplicationScene({
signal, signal,
...resources, ...resources,
}); });
const { viewer, engine, tileset, mapStackController, packRenderer } = rendererCache const { viewer, engine, tileset, mapStackController, packRenderer } =
? await rendererCache.acquire(options.engineKind, build, defer) rendererCache
: await build({ defer }); ? await rendererCache.acquire(options.engineKind, build, defer)
: await build({ defer });
if (layerSession) { if (layerSession) {
// DEM cells belong to the session. Mesh samples came from the outgoing // DEM cells belong to the session. Mesh samples came from the outgoing
// scene, including when the incoming canvas was warm in the cache. // scene, including when the incoming canvas was warm in the cache.