MCPcopy Index your code
hub / github.com/CapSoftware/Cap / cleanup

Function cleanup

apps/desktop/src/utils/socket.ts:373–450  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

371 }
372
373 function cleanup() {
374 if (isCleanedUp) return;
375 isCleanedUp = true;
376
377 ws.onmessage = null;
378
379 if (producer) {
380 producer.signalShutdown();
381 producer = null;
382 }
383
384 if (worker) {
385 worker.onmessage = null;
386 worker.terminate();
387 worker = null;
388 }
389
390 if (strideWorker) {
391 strideWorker.onmessage = null;
392 strideWorker.terminate();
393 strideWorker = null;
394 }
395
396 pendingFrame = null;
397 nextFrame = null;
398 isProcessing = false;
399 isProcessingSharedFrame = false;
400
401 if (mainThreadWebGPU) {
402 disposeWebGPU(mainThreadWebGPU);
403 mainThreadWebGPU = null;
404 }
405
406 mainThreadWebGPUInitializing = false;
407 pendingNv12Frame = null;
408 pendingRgbaFrame = null;
409 pendingCanvas2DRgbaFrame = null;
410 if (pendingNv12RafId !== null) {
411 cancelAnimationFrame(pendingNv12RafId);
412 pendingNv12RafId = null;
413 }
414 if (pendingRgbaRafId !== null) {
415 cancelAnimationFrame(pendingRgbaRafId);
416 pendingRgbaRafId = null;
417 }
418 if (pendingCanvas2DNv12RafId !== null) {
419 cancelAnimationFrame(pendingCanvas2DNv12RafId);
420 pendingCanvas2DNv12RafId = null;
421 }
422 if (pendingCanvas2DRgbaRafId !== null) {
423 cancelAnimationFrame(pendingCanvas2DRgbaRafId);
424 pendingCanvas2DRgbaRafId = null;
425 }
426 mainThreadNv12Buffer = null;
427 mainThreadNv12BufferSize = 0;
428 cachedDirectImageData = null;
429 cachedDirectWidth = 0;
430 cachedDirectHeight = 0;

Callers 3

createImageDataWSFunction · 0.70
createTauriEventListenerFunction · 0.70
createLicenseQueryFunction · 0.70

Calls 2

disposeWebGPUFunction · 0.90
signalShutdownMethod · 0.80

Tested by

no test coverage detected