(workspaceId: string)
| 4033 | } |
| 4034 | |
| 4035 | private startForegroundAwait(workspaceId: string): () => void { |
| 4036 | assert(workspaceId.length > 0, "startForegroundAwait: workspaceId must be non-empty"); |
| 4037 | |
| 4038 | const current = this.foregroundAwaitCountByWorkspaceId.get(workspaceId) ?? 0; |
| 4039 | assert( |
| 4040 | Number.isInteger(current) && current >= 0, |
| 4041 | "startForegroundAwait: expected non-negative integer counter" |
| 4042 | ); |
| 4043 | |
| 4044 | this.foregroundAwaitCountByWorkspaceId.set(workspaceId, current + 1); |
| 4045 | |
| 4046 | return () => { |
| 4047 | const current = this.foregroundAwaitCountByWorkspaceId.get(workspaceId) ?? 0; |
| 4048 | assert( |
| 4049 | Number.isInteger(current) && current > 0, |
| 4050 | "startForegroundAwait cleanup: expected positive integer counter" |
| 4051 | ); |
| 4052 | if (current <= 1) { |
| 4053 | this.foregroundAwaitCountByWorkspaceId.delete(workspaceId); |
| 4054 | } else { |
| 4055 | this.foregroundAwaitCountByWorkspaceId.set(workspaceId, current - 1); |
| 4056 | } |
| 4057 | }; |
| 4058 | } |
| 4059 | |
| 4060 | private registerBackgroundableForegroundWaiter( |
| 4061 | workspaceId: string, |
no test coverage detected