record capture time

This commit is contained in:
Simon Knott 2024-08-07 14:29:13 +02:00
parent 74439a8077
commit 59a5817f87
No known key found for this signature in database
GPG key ID: 8CEDC00028084AEC

View file

@ -408,6 +408,8 @@ export function frameSnapshotStreamer(snapshotStreamer: string, removeNoScript:
}; };
if (nodeName === 'CANVAS') { if (nodeName === 'CANVAS') {
const start = performance.now();
const canvas = node as HTMLCanvasElement; const canvas = node as HTMLCanvasElement;
const requestedMIME = 'image/webp'; const requestedMIME = 'image/webp';
const dataURL = canvas.toDataURL(requestedMIME); const dataURL = canvas.toDataURL(requestedMIME);
@ -422,6 +424,9 @@ export function frameSnapshotStreamer(snapshotStreamer: string, removeNoScript:
this._capturedCanvases.add(sha); this._capturedCanvases.add(sha);
canvasRenderResults[sha] = contentsB64; canvasRenderResults[sha] = contentsB64;
} }
const duration = performance.now() - start;
attrs['__playwright_canvas_time_'] = duration + 'ms';
} }
if (nodeType === Node.DOCUMENT_FRAGMENT_NODE) if (nodeType === Node.DOCUMENT_FRAGMENT_NODE)