//#region src/main/private/multithreadSimdHelper.d.ts /** * A website is in a cross-origin isolated state, * when the response header * * Cross-Origin-Opener-Policy has the value same-origin and the * * Cross-Origin-Embedder-Policy header has the value `require-corp` or `credentialless` * when true `SharedArrayBuffer` class will be available in the scope if browser supports it * @returns if a site is crossOriginIsolated */ declare function isCrossOriginIsolated(): boolean; /** * Even if the site is not crossOriginIsolated this function * check whether or not the browser is capable to use SharedArrayBuffer * @returns if browser supports SharedArrayBuffer regardless crossOriginIsolated value */ declare function hasSharedArrayBufferSupport(): boolean; declare function hasSIMDSupport(): Promise; /** * WebKit 26.x has a bug where v128 SIMD values passed as function arguments get silently corrupted once the * function is promoted to the optimizing JIT tier (`RegisterSet::normalizeWidths()` drops vector-width information), * causing SIMD-heavy code (MRZ, barcode, ArUco) to produce garbage. Fixed in WebKit 27: * https://webkit.org/blog/17967/ * * In practice this has only been observed on x64 (Intel) hardware, not on Apple Silicon (arm64) even though both * run the same WebKit build. There's no spec'd, reliable way for a web page to read the host CPU architecture * (`navigator.userAgent`/`userAgentData` are not trustworthy for this), so instead of guessing at the architecture * we probe for the bug directly: run a tiny WASM module that repeats the exact pattern that triggers it (a v128 * value crossing a function-call boundary, looped enough times to get JIT-compiled) and compare the result against * the value we know is mathematically correct. * * The result is memoized: the probe only needs to run once per page load. * * @returns Whether running WASM SIMD code produced an incorrect result, i.e. SIMD can't be trusted on this device. */ declare function isSIMDCorrupted(): Promise; /** * Checks if browser supports threads and is able to instantiate * a Worker from another Worker. * @returns */ declare function hasThreadsSupport(): Promise; /** * To have full multithread support a browser must be * crossOriginIsolated, support nested workers and capable to use SharedArrayBuffer. * Also, the browser must have at least 2 logical processors available. * @returns Checks if browser has full multithread support */ declare function checkFullMultithreadingSupport(): Promise; /** * @see https://developer.mozilla.org/en-US/docs/Web/API/Navigator/hardwareConcurrency#browser_compatibility */ declare function availableHardwareConcurrency(): number; //#endregion export { availableHardwareConcurrency, checkFullMultithreadingSupport, hasSIMDSupport, hasSharedArrayBufferSupport, hasThreadsSupport, isCrossOriginIsolated, isSIMDCorrupted };