(headers: Uint8Array, payloads: Map<bigint, Uint8Array>)
| 649 | } |
| 650 | |
| 651 | function processRecords(headers: Uint8Array, payloads: Map<bigint, Uint8Array>): void { |
| 652 | const count = Math.floor(headers.byteLength / DEBUG_RECORD_HEADER_SIZE); |
| 653 | |
| 654 | for (let i = 0; i < count; i++) { |
| 655 | const offset = i * DEBUG_RECORD_HEADER_SIZE; |
| 656 | const headerResult = parseRecordHeader(headers, offset); |
| 657 | |
| 658 | if (!headerResult.ok) { |
| 659 | continue; |
| 660 | } |
| 661 | |
| 662 | const header = headerResult.value; |
| 663 | let payload: DebugPayload | null = null; |
| 664 | |
| 665 | const payloadBytes = payloads.get(header.recordId); |
| 666 | if (payloadBytes) { |
| 667 | const payloadResult = parsePayload(header.category, payloadBytes); |
| 668 | if (payloadResult.ok) { |
| 669 | payload = payloadResult.value; |
| 670 | } |
| 671 | } |
| 672 | |
| 673 | const record: DebugRecord = { header, payload }; |
| 674 | |
| 675 | // Route to appropriate component based on category |
| 676 | switch (header.category) { |
| 677 | case "frame": |
| 678 | if (payload && payloadBytes) { |
| 679 | const frameResult = parseFrameRecord(payloadBytes); |
| 680 | if (frameResult.ok) { |
| 681 | frameInspector.addFrame(frameResult.value, header.timestampUs); |
| 682 | } |
| 683 | } |
| 684 | break; |
| 685 | |
| 686 | case "event": |
| 687 | if (payload && payloadBytes) { |
| 688 | const eventResult = parseEventRecord(payloadBytes); |
| 689 | if (eventResult.ok) { |
| 690 | eventTrace.addEvent(eventResult.value, header.recordId, header.timestampUs); |
| 691 | } |
| 692 | } |
| 693 | break; |
| 694 | |
| 695 | case "error": |
| 696 | if (payload && payloadBytes) { |
| 697 | const errorResult = parseErrorRecord(payloadBytes); |
| 698 | if (errorResult.ok) { |
| 699 | errorAggregator.addError( |
| 700 | errorResult.value, |
| 701 | header.category, |
| 702 | header.severity, |
| 703 | header.timestampUs, |
| 704 | ); |
| 705 | } |
| 706 | } |
| 707 | break; |
| 708 | } |
nothing calls this directly
no test coverage detected