From 1650e3dd34368e9a66d64cf2c08b8c1ecbeecaaf Mon Sep 17 00:00:00 2001 From: Joe Heffernan Date: Tue, 15 Oct 2024 13:56:37 -0700 Subject: [PATCH] remove vis data workers --- src/controller/index.ts | 1 - src/simularium/VisData.ts | 36 +----------------------------------- 2 files changed, 1 insertion(+), 36 deletions(-) diff --git a/src/controller/index.ts b/src/controller/index.ts index eae54ad5..c8ddf2d6 100644 --- a/src/controller/index.ts +++ b/src/controller/index.ts @@ -338,7 +338,6 @@ export default class SimulariumController { this.visData.WaitForFrame(0); this.visData.clearForNewTrajectory(); - this.visData.cancelAllWorkers(); this.stop(); diff --git a/src/simularium/VisData.ts b/src/simularium/VisData.ts index b12f4d58..175953db 100644 --- a/src/simularium/VisData.ts +++ b/src/simularium/VisData.ts @@ -2,7 +2,6 @@ import { noop } from "lodash"; import { nullCachedFrame } from "../util"; -import * as util from "./ThreadUtil"; import { VisDataMessage, CachedFrame } from "./types"; import { parseVisDataMessage } from "./VisDataParse"; import { VisDataCache } from "./VisDataCache"; @@ -11,7 +10,6 @@ import { BYTE_SIZE_64_BIT_NUM } from "../constants"; class VisData { public frameCache: VisDataCache; - private webWorker: Worker | null; private frameToWaitFor: number; private lockedForFrame: boolean; @@ -38,21 +36,7 @@ class VisData { return frameData; } - private setupWebWorker() { - this.webWorker = new Worker( - new URL("../visGeometry/workers/visDataWorker", import.meta.url), - { type: "module" } - ); - this.webWorker.onmessage = (event) => { - this.addFrameToCache(event.data); - }; - } - public constructor() { - this.webWorker = null; - if (util.ThreadUtil.browserSupportsWebWorkers()) { - this.setupWebWorker(); - } this.currentFrameNumber = -1; this.frameCache = new VisDataCache(); this.frameToWaitFor = 0; @@ -127,17 +111,6 @@ class VisData { this.clearCache(); } - public cancelAllWorkers(): void { - // we need to be able to terminate any queued work in the worker during trajectory changeovers - if ( - util.ThreadUtil.browserSupportsWebWorkers() && - this.webWorker !== null - ) { - this.webWorker.terminate(); - this.setupWebWorker(); - } - } - private parseAgentsFromVisDataMessage(msg: VisDataMessage): void { /** * visDataMsg = { @@ -170,14 +143,7 @@ class VisData { this.frameExceedsCacheSizeError(parsedMsg.size); return; } - if ( - util.ThreadUtil.browserSupportsWebWorkers() && - this.webWorker !== null - ) { - this.webWorker.postMessage(parsedMsg); - } else { - this.addFrameToCache(parsedMsg); - } + this.addFrameToCache(parsedMsg); } public parseAgentsFromFrameData(msg: VisDataMessage | ArrayBuffer): void {