LCOV - code coverage report
Current view: top level - src/utils - objectUrlUtil.ts Coverage Total Hit
Test: ComfyUI E2E Coverage Lines: 100.0 % 17 17
Test Date: 2026-11-17 04:17:53

            Line data    Source code
       1         2356 : const objectUrlRefCounts = new Map<string, number>()
       2              : 
       3         2356 : const isBlobUrl = (url: string) => url.startsWith('blob:')
       4              : 
       5           29 : export function createSharedObjectUrl(blob: Blob): string {
       6           29 :   const url = URL.createObjectURL(blob)
       7           29 :   objectUrlRefCounts.set(url, 1)
       8           29 :   return url
       9              : }
      10              : 
      11           41 : export function retainSharedObjectUrl(url: string | undefined): void {
      12           41 :   if (!url || !isBlobUrl(url)) return
      13           41 :   objectUrlRefCounts.set(url, (objectUrlRefCounts.get(url) ?? 0) + 1)
      14              : }
      15              : 
      16           45 : export function releaseSharedObjectUrl(url: string | undefined): void {
      17           45 :   if (!url || !isBlobUrl(url)) return
      18              : 
      19           43 :   const currentCount = objectUrlRefCounts.get(url)
      20           45 :   if (currentCount === undefined || currentCount <= 1) {
      21           11 :     objectUrlRefCounts.delete(url)
      22           11 :     URL.revokeObjectURL(url)
      23           11 :     return
      24              :   }
      25              : 
      26           32 :   objectUrlRefCounts.set(url, currentCount - 1)
      27              : }
        

Generated by: LCOV version 2.0-1