parent
6e4e5397ee
commit
98b5ee978b
7 changed files with 38 additions and 40 deletions
|
@ -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>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
import { basename, dirname, join } from 'vs/base/common/path';
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { dispose, IDisposable, toDisposable } from 'vs/base/common/lifecycle';
|
||||
import { toDisposable, DisposableStore } from 'vs/base/common/lifecycle';
|
||||
import { readdir, rimraf, stat } from 'vs/base/node/pfs';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import product from 'vs/platform/product/node/product';
|
||||
|
@ -16,7 +16,7 @@ export class NodeCachedDataCleaner {
|
|||
? 1000 * 60 * 60 * 24 * 7 // roughly 1 week
|
||||
: 1000 * 60 * 60 * 24 * 30 * 3; // roughly 3 months
|
||||
|
||||
private _disposables: IDisposable[] = [];
|
||||
private readonly _disposables = new DisposableStore();
|
||||
|
||||
constructor(
|
||||
@IEnvironmentService private readonly _environmentService: IEnvironmentService
|
||||
|
@ -25,7 +25,7 @@ export class NodeCachedDataCleaner {
|
|||
}
|
||||
|
||||
dispose(): void {
|
||||
this._disposables = dispose(this._disposables);
|
||||
this._disposables.dispose();
|
||||
}
|
||||
|
||||
private _manageCachedDataSoon(): void {
|
||||
|
@ -76,7 +76,7 @@ export class NodeCachedDataCleaner {
|
|||
|
||||
}, 30 * 1000);
|
||||
|
||||
this._disposables.push(toDisposable(() => {
|
||||
this._disposables.add(toDisposable(() => {
|
||||
if (handle) {
|
||||
clearTimeout(handle);
|
||||
handle = undefined;
|
||||
|
|
|
@ -37,7 +37,7 @@ import { ILocalizationsService } from 'vs/platform/localizations/common/localiza
|
|||
import { LocalizationsChannel } from 'vs/platform/localizations/node/localizationsIpc';
|
||||
import { DialogChannelClient } from 'vs/platform/dialogs/node/dialogIpc';
|
||||
import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
|
||||
import { IDisposable, dispose, combinedDisposable } from 'vs/base/common/lifecycle';
|
||||
import { combinedDisposable, DisposableStore } from 'vs/base/common/lifecycle';
|
||||
import { DownloadService } from 'vs/platform/download/node/downloadService';
|
||||
import { IDownloadService } from 'vs/platform/download/common/download';
|
||||
import { IChannel, IServerChannel, StaticRouter } from 'vs/base/parts/ipc/common/ipc';
|
||||
|
@ -85,24 +85,24 @@ class MainProcessService implements IMainProcessService {
|
|||
async function main(server: Server, initData: ISharedProcessInitData, configuration: ISharedProcessConfiguration): Promise<void> {
|
||||
const services = new ServiceCollection();
|
||||
|
||||
const disposables: IDisposable[] = [];
|
||||
const disposables = new DisposableStore();
|
||||
|
||||
const onExit = () => dispose(disposables);
|
||||
const onExit = () => disposables.dispose();
|
||||
process.once('exit', onExit);
|
||||
ipcRenderer.once('handshake:goodbye', onExit);
|
||||
|
||||
disposables.push(server);
|
||||
disposables.add(server);
|
||||
|
||||
const environmentService = new EnvironmentService(initData.args, process.execPath);
|
||||
|
||||
const mainRouter = new StaticRouter(ctx => ctx === 'main');
|
||||
const logLevelClient = new LogLevelSetterChannelClient(server.getChannel('loglevel', mainRouter));
|
||||
const logService = new FollowerLogService(logLevelClient, new SpdLogService('sharedprocess', environmentService.logsPath, initData.logLevel));
|
||||
disposables.push(logService);
|
||||
disposables.add(logService);
|
||||
logService.info('main', JSON.stringify(configuration));
|
||||
|
||||
const configurationService = new ConfigurationService(environmentService.settingsResource);
|
||||
disposables.push(configurationService);
|
||||
disposables.add(configurationService);
|
||||
await configurationService.initialize();
|
||||
|
||||
services.set(IEnvironmentService, environmentService);
|
||||
|
@ -137,7 +137,7 @@ async function main(server: Server, initData: ISharedProcessInitData, configurat
|
|||
if (!extensionDevelopmentLocationURI && !environmentService.args['disable-telemetry'] && product.enableTelemetry) {
|
||||
if (product.aiConfig && product.aiConfig.asimovKey && isBuilt) {
|
||||
appInsightsAppender = new AppInsightsAppender(eventPrefix, null, product.aiConfig.asimovKey, telemetryLogService);
|
||||
disposables.push(appInsightsAppender); // Ensure the AI appender is disposed so that it flushes remaining data
|
||||
disposables.add(appInsightsAppender); // Ensure the AI appender is disposed so that it flushes remaining data
|
||||
}
|
||||
const config: ITelemetryServiceConfig = {
|
||||
appender: combinedAppender(appInsightsAppender, new LogAppender(logService)),
|
||||
|
@ -179,13 +179,13 @@ async function main(server: Server, initData: ISharedProcessInitData, configurat
|
|||
// update localizations cache
|
||||
(localizationsService as LocalizationsService).update();
|
||||
// cache clean ups
|
||||
disposables.push(combinedDisposable(
|
||||
disposables.add(combinedDisposable(
|
||||
instantiationService2.createInstance(NodeCachedDataCleaner),
|
||||
instantiationService2.createInstance(LanguagePackCachedDataCleaner),
|
||||
instantiationService2.createInstance(StorageDataCleaner),
|
||||
instantiationService2.createInstance(LogsDataCleaner)
|
||||
));
|
||||
disposables.push(extensionManagementService as ExtensionManagementService);
|
||||
disposables.add(extensionManagementService as ExtensionManagementService);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ import { Barrier } from 'vs/base/common/async';
|
|||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { ILifecycleService } from 'vs/platform/lifecycle/electron-main/lifecycleMain';
|
||||
import { IThemeMainService } from 'vs/platform/theme/electron-main/themeMainService';
|
||||
import { dispose, toDisposable, IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { toDisposable, DisposableStore } from 'vs/base/common/lifecycle';
|
||||
|
||||
export class SharedProcess implements ISharedProcess {
|
||||
|
||||
|
@ -66,10 +66,10 @@ export class SharedProcess implements ISharedProcess {
|
|||
|
||||
this.window.on('close', onClose);
|
||||
|
||||
const disposables: IDisposable[] = [];
|
||||
const disposables = new DisposableStore();
|
||||
|
||||
this.lifecycleService.onWillShutdown(() => {
|
||||
dispose(disposables);
|
||||
disposables.dispose();
|
||||
|
||||
// Shut the shared process down when we are quitting
|
||||
//
|
||||
|
@ -103,7 +103,7 @@ export class SharedProcess implements ISharedProcess {
|
|||
logLevel: this.logService.getLevel()
|
||||
});
|
||||
|
||||
disposables.push(toDisposable(() => sender.send('handshake:goodbye')));
|
||||
disposables.add(toDisposable(() => sender.send('handshake:goodbye')));
|
||||
ipcMain.once('handshake:im ready', () => c(undefined));
|
||||
});
|
||||
});
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as dom from 'vs/base/browser/dom';
|
||||
import { IDisposable, dispose as disposeAll } from 'vs/base/common/lifecycle';
|
||||
import { IDisposable, DisposableStore } from 'vs/base/common/lifecycle';
|
||||
import * as strings from 'vs/base/common/strings';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
|
||||
|
@ -123,7 +123,7 @@ interface ProviderArguments {
|
|||
|
||||
class DecorationTypeOptionsProvider implements IModelDecorationOptionsProvider {
|
||||
|
||||
private _disposables: IDisposable[];
|
||||
private readonly _disposables = new DisposableStore();
|
||||
public refCount: number;
|
||||
|
||||
public className: string | undefined;
|
||||
|
@ -138,11 +138,10 @@ class DecorationTypeOptionsProvider implements IModelDecorationOptionsProvider {
|
|||
|
||||
constructor(themeService: IThemeService, providerArgs: ProviderArguments) {
|
||||
this.refCount = 0;
|
||||
this._disposables = [];
|
||||
|
||||
const createCSSRules = (type: ModelDecorationCSSRuleType) => {
|
||||
const rules = new DecorationCSSRules(type, providerArgs, themeService);
|
||||
this._disposables.push(rules);
|
||||
this._disposables.add(rules);
|
||||
if (rules.hasContent) {
|
||||
return rules.className;
|
||||
}
|
||||
|
@ -150,7 +149,7 @@ class DecorationTypeOptionsProvider implements IModelDecorationOptionsProvider {
|
|||
};
|
||||
const createInlineCSSRules = (type: ModelDecorationCSSRuleType) => {
|
||||
const rules = new DecorationCSSRules(type, providerArgs, themeService);
|
||||
this._disposables.push(rules);
|
||||
this._disposables.add(rules);
|
||||
if (rules.hasContent) {
|
||||
return { className: rules.className, hasLetterSpacing: rules.hasLetterSpacing };
|
||||
}
|
||||
|
@ -202,7 +201,7 @@ class DecorationTypeOptionsProvider implements IModelDecorationOptionsProvider {
|
|||
}
|
||||
|
||||
public dispose(): void {
|
||||
this._disposables = disposeAll(this._disposables);
|
||||
this._disposables.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Emitter, Event } from 'vs/base/common/event';
|
||||
import { Disposable, IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import { Disposable, IDisposable, DisposableStore } from 'vs/base/common/lifecycle';
|
||||
import * as platform from 'vs/base/common/platform';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { EDITOR_MODEL_DEFAULTS } from 'vs/editor/common/config/editorOptions';
|
||||
|
@ -30,7 +30,7 @@ class ModelData implements IDisposable {
|
|||
private _languageSelection: ILanguageSelection | null;
|
||||
private _languageSelectionListener: IDisposable | null;
|
||||
|
||||
private _modelEventListeners: IDisposable[];
|
||||
private readonly _modelEventListeners = new DisposableStore();
|
||||
|
||||
constructor(
|
||||
model: ITextModel,
|
||||
|
@ -42,9 +42,8 @@ class ModelData implements IDisposable {
|
|||
this._languageSelection = null;
|
||||
this._languageSelectionListener = null;
|
||||
|
||||
this._modelEventListeners = [];
|
||||
this._modelEventListeners.push(model.onWillDispose(() => onWillDispose(model)));
|
||||
this._modelEventListeners.push(model.onDidChangeLanguage((e) => onDidChangeLanguage(model, e)));
|
||||
this._modelEventListeners.add(model.onWillDispose(() => onWillDispose(model)));
|
||||
this._modelEventListeners.add(model.onDidChangeLanguage((e) => onDidChangeLanguage(model, e)));
|
||||
}
|
||||
|
||||
private _disposeLanguageSelection(): void {
|
||||
|
@ -59,7 +58,7 @@ class ModelData implements IDisposable {
|
|||
}
|
||||
|
||||
public dispose(): void {
|
||||
this._modelEventListeners = dispose(this._modelEventListeners);
|
||||
this._modelEventListeners.dispose();
|
||||
this._disposeLanguageSelection();
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ import { ActionViewItem, Separator } from 'vs/base/browser/ui/actionbar/actionba
|
|||
import { IAnchor } from 'vs/base/browser/ui/contextview/contextview';
|
||||
import { IAction } from 'vs/base/common/actions';
|
||||
import { KeyCode, KeyMod, ResolvedKeybinding } from 'vs/base/common/keyCodes';
|
||||
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import { DisposableStore } from 'vs/base/common/lifecycle';
|
||||
import { ICodeEditor, IEditorMouseEvent, MouseTargetType } from 'vs/editor/browser/editorBrowser';
|
||||
import { EditorAction, ServicesAccessor, registerEditorAction, registerEditorContribution } from 'vs/editor/browser/editorExtensions';
|
||||
import { IEditorContribution, ScrollType } from 'vs/editor/common/editorCommon';
|
||||
|
@ -31,7 +31,7 @@ export class ContextMenuController implements IEditorContribution {
|
|||
return editor.getContribution<ContextMenuController>(ContextMenuController.ID);
|
||||
}
|
||||
|
||||
private _toDispose: IDisposable[] = [];
|
||||
private readonly _toDispose = new DisposableStore();
|
||||
private _contextMenuIsBeingShownCount: number = 0;
|
||||
private readonly _editor: ICodeEditor;
|
||||
|
||||
|
@ -45,13 +45,13 @@ export class ContextMenuController implements IEditorContribution {
|
|||
) {
|
||||
this._editor = editor;
|
||||
|
||||
this._toDispose.push(this._editor.onContextMenu((e: IEditorMouseEvent) => this._onContextMenu(e)));
|
||||
this._toDispose.push(this._editor.onMouseWheel((e: IMouseWheelEvent) => {
|
||||
this._toDispose.add(this._editor.onContextMenu((e: IEditorMouseEvent) => this._onContextMenu(e)));
|
||||
this._toDispose.add(this._editor.onMouseWheel((e: IMouseWheelEvent) => {
|
||||
if (this._contextMenuIsBeingShownCount > 0) {
|
||||
this._contextViewService.hideContextView();
|
||||
}
|
||||
}));
|
||||
this._toDispose.push(this._editor.onKeyDown((e: IKeyboardEvent) => {
|
||||
this._toDispose.add(this._editor.onKeyDown((e: IKeyboardEvent) => {
|
||||
if (e.keyCode === KeyCode.ContextMenu) {
|
||||
// Chrome is funny like that
|
||||
e.preventDefault();
|
||||
|
@ -217,7 +217,7 @@ export class ContextMenuController implements IEditorContribution {
|
|||
this._contextViewService.hideContextView();
|
||||
}
|
||||
|
||||
this._toDispose = dispose(this._toDispose);
|
||||
this._toDispose.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue