MCPcopy Create free account
hub / github.com/Snapchat/Valdi / _claimOutputSlot

Method _claimOutputSlot

valdi/vscode_debugger/src/adapter/threads.ts:535–558  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

533 // slot(output);
534 //
535 _claimOutputSlot(): (payload?: Dap.OutputEventParams) => void {
536 // TODO: should we serialize output between threads? For example, it may be important
537 // when using postMessage between page a worker.
538 const slot = this._serializedOutput;
539 const deferred = getDeferred<void>();
540 const result = async (payload?: Dap.OutputEventParams) => {
541 await slot;
542 if (payload) {
543 const isClearConsole = payload.output === '\x1b[2J';
544 const noop = isClearConsole && !this._consoleIsDirty;
545 if (!noop) {
546 this._dap.with(dap => dap.output(payload));
547 this._consoleIsDirty = !isClearConsole;
548 }
549 }
550 deferred.resolve();
551 };
552
553 this._serializedOutput = slot.then(() => deferred.promise);
554 // Timeout to avoid blocking future slots if this one does stall.
555 setTimeout(deferred.resolve, this._sourceContainer.sourceMapTimeouts().output);
556
557 return result;
558 }
559
560 async _pauseOnScheduledAsyncCall(): Promise<void> {
561 if (!scheduledPauseOnAsyncCall) return;

Callers 2

_initializeMethod · 0.95
_queryObjectsMethod · 0.95

Calls 4

getDeferredFunction · 0.90
sourceMapTimeoutsMethod · 0.80
thenMethod · 0.65
setTimeoutFunction · 0.50

Tested by

no test coverage detected