mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-25 11:08:51 +01:00
compute performance baseline in a webworker (#172405)
* compute performance baseline in a webworker https://github.com/microsoft/vscode/issues/172239 * make build happy, better change overall
This commit is contained in:
@@ -9,6 +9,13 @@ import { IWorker, IWorkerCallback, IWorkerFactory, logOnceWebWorkerWarning } fro
|
||||
|
||||
const ttPolicy = window.trustedTypes?.createPolicy('defaultWorkerFactory', { createScriptURL: value => value });
|
||||
|
||||
export function createBlobWorker(blobUrl: string, options?: WorkerOptions): Worker {
|
||||
if (!blobUrl.startsWith('blob:')) {
|
||||
throw new URIError('Not a blob-url: ' + blobUrl);
|
||||
}
|
||||
return new Worker(ttPolicy ? ttPolicy.createScriptURL(blobUrl) as unknown as string : blobUrl, options);
|
||||
}
|
||||
|
||||
function getWorker(label: string): Worker | Promise<Worker> {
|
||||
// Option for hosts to overwrite the worker script (used in the standalone editor)
|
||||
if (globals.MonacoEnvironment) {
|
||||
|
||||
Reference in New Issue
Block a user