MCPcopy Create free account
hub / github.com/RtlZeroMemory/Rezi / processTurn

Function processTurn

packages/core/src/app/createApp/eventLoop.ts:413–484  ·  view source on GitHub ↗
(items: readonly WorkItem[])

Source from the content-addressed store, hash-verified

411 }
412
413 function processTurn(items: readonly WorkItem[]): void {
414 options.setRenderRequestQueuedForCurrentTurn(false);
415 const releasedBatches = new Set<BackendEventBatch>();
416 const runtimeState = options.getRuntimeState();
417 if (runtimeState === "Disposed" || runtimeState === "Faulted") {
418 drainIgnored(items, releasedBatches);
419 return;
420 }
421
422 let sawKick = false;
423 for (const item of items) {
424 if (options.getRuntimeState() === "Faulted" || options.getRuntimeState() === "Disposed") {
425 drainIgnored(items, releasedBatches);
426 return;
427 }
428
429 switch (item.kind) {
430 case "fatal": {
431 options.doFatal(item.code, item.detail);
432 drainIgnored(items, releasedBatches);
433 return;
434 }
435 case "eventBatch": {
436 if (options.getRuntimeState() !== "Running") {
437 releasedBatches.add(item.batch);
438 try {
439 item.batch.release();
440 } catch {
441 // ignore
442 }
443 break;
444 }
445 processEventBatch(item.batch, releasedBatches);
446 if (options.getRuntimeState() !== "Running") {
447 drainIgnored(items, releasedBatches);
448 return;
449 }
450 commitUpdates();
451 break;
452 }
453 case "userCommit": {
454 options.setUserCommitScheduled(false);
455 if (options.getRuntimeState() === "Running") commitUpdates();
456 break;
457 }
458 case "kick": {
459 sawKick = true;
460 break;
461 }
462 case "renderRequest": {
463 break;
464 }
465 case "frameDone": {
466 options.setFramesInFlight(Math.max(0, options.getFramesInFlight() - 1));
467 break;
468 }
469 case "frameError": {
470 options.setFramesInFlight(Math.max(0, options.getFramesInFlight() - 1));

Callers

nothing calls this directly

Calls 5

drainIgnoredFunction · 0.85
processEventBatchFunction · 0.85
commitUpdatesFunction · 0.85
describeThrownFunction · 0.50
addMethod · 0.45

Tested by

no test coverage detected