Replacing IDisposible[] with DisposableStore

#74250
This commit is contained in:
Matt Bierner
2019-07-02 16:11:17 -07:00
parent 6e4e5397ee
commit 98b5ee978b
7 changed files with 38 additions and 40 deletions

View File

@@ -16,7 +16,7 @@ import { IContextMenuItem } from 'vs/base/parts/contextmenu/common/contextmenu';
import { popup } from 'vs/base/parts/contextmenu/electron-browser/contextmenu';
import { ProcessItem } from 'vs/base/common/processes';
import { addDisposableListener } from 'vs/base/browser/dom';
import { IDisposable } from 'vs/base/common/lifecycle';
import { DisposableStore } from 'vs/base/common/lifecycle';
import { isRemoteDiagnosticError, IRemoteDiagnosticError } from 'vs/platform/diagnostics/common/diagnosticsService';
@@ -24,7 +24,7 @@ let mapPidToWindowTitle = new Map<number, string>();
const DEBUG_FLAGS_PATTERN = /\s--(inspect|debug)(-brk|port)?=(\d+)?/;
const DEBUG_PORT_PATTERN = /\s--(inspect|debug)-port=(\d+)/;
const listeners: IDisposable[] = [];
const listeners = new DisposableStore();
const collapsedStateCache: Map<string, boolean> = new Map<string, boolean>();
let lastRequestTime: number;
@@ -171,7 +171,7 @@ function renderProcessGroupHeader(sectionName: string, body: HTMLElement, contai
updateSectionCollapsedState(!collapsedStateCache.get(sectionName), body, twistie, sectionName);
data.prepend(twistie);
listeners.push(addDisposableListener(data, 'click', (e) => {
listeners.add(addDisposableListener(data, 'click', (e) => {
const isHidden = body.classList.contains('hidden');
updateSectionCollapsedState(isHidden, body, twistie, sectionName);
}));
@@ -222,7 +222,7 @@ function renderTableSection(sectionName: string, processList: FormattedProcessIt
row.append(cpu, memory, pid, name);
listeners.push(addDisposableListener(row, 'contextmenu', (e) => {
listeners.add(addDisposableListener(row, 'contextmenu', (e) => {
showContextMenu(e, p, sectionIsLocal);
}));
@@ -239,7 +239,7 @@ function updateProcessInfo(processLists: [{ name: string, rootProcess: ProcessIt
}
container.innerHTML = '';
listeners.forEach(l => l.dispose());
listeners.clear();
const tableHead = document.createElement('thead');
tableHead.innerHTML = `<tr>