resolveWebAccelerator function
Resolves a requested LiteRT.js accelerator ('auto' / 'webgpu' /
'wasm') into a concrete backend for this browser.
Explicit values pass through untouched. 'auto' resolves to 'webgpu'
only when the browser is Chromium-based AND navigator.gpu yields a
hardware adapter; everything else resolves to 'wasm'.
The Chromium gate is deliberate: LiteRT.js's WebGPU delegate is developed
and tuned against Chrome's Dawn. Firefox 152 (and Safari) expose a WebGPU
that compiles and runs small vision models without ever throwing, but at
unusable speed (measured 22x slower than single-threaded WASM SIMD on
Firefox 152 / Apple Silicon), so API presence alone must not select it.
Callers can still force 'webgpu' explicitly, and
WebGpuFallback.maybeSwapIfWebGpuSlow catches slow-but-functional stacks
that slip through.
The 'auto' probe runs once per page load and is cached.
Implementation
Future<String> resolveWebAccelerator(String requested) {
if (requested != 'auto') return Future<String>.value(requested);
return _cachedAutoDecision ??= _probeAuto();
}