Skip to content

Commit 3f48f0c

Browse files
committed
Clear active owner and use resource map
1 parent 0bc10a4 commit 3f48f0c

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/vs/workbench/api/browser/mainThreadDiagnostics.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { MainThreadDiagnosticsShape, MainContext, ExtHostDiagnosticsShape, ExtHo
99
import { extHostNamedCustomer, IExtHostContext } from '../../services/extensions/common/extHostCustomers.js';
1010
import { IDisposable } from '../../../base/common/lifecycle.js';
1111
import { IUriIdentityService } from '../../../platform/uriIdentity/common/uriIdentity.js';
12+
import { ResourceMap } from '../../../base/common/map.js';
1213

1314
@extHostNamedCustomer(MainContext.MainThreadDiagnostics)
1415
export class MainThreadDiagnostics implements MainThreadDiagnosticsShape {
@@ -35,22 +36,22 @@ export class MainThreadDiagnostics implements MainThreadDiagnosticsShape {
3536
dispose(): void {
3637
this._markerListener.dispose();
3738
for (const owner of this._activeOwners) {
38-
const markersData: Map<string, { resource: URI; local: IMarker[] }> = new Map();
39+
const markersData: ResourceMap<IMarker[]> = new ResourceMap<IMarker[]>();
3940
for (const marker of this._markerService.read({ owner })) {
40-
const resource = marker.resource.toString();
41-
let data = markersData.get(resource);
41+
let data = markersData.get(marker.resource);
4242
if (data === undefined) {
43-
data = { resource: marker.resource, local: [] };
44-
markersData.set(resource, data);
43+
data = [];
44+
markersData.set(marker.resource, data);
4545
}
4646
if (marker.origin !== this.extHostId) {
47-
data.local.push(marker);
47+
data.push(marker);
4848
}
4949
}
50-
for (const { resource, local } of markersData.values()) {
50+
for (const [resource, local] of markersData.entries()) {
5151
this._markerService.changeOne(owner, resource, local);
5252
}
5353
}
54+
this._activeOwners.clear();
5455
}
5556

5657
private _forwardMarkers(resources: readonly URI[]): void {

0 commit comments

Comments
 (0)