From af55c2005512b474809370e9b8ef9a4dd1eb659c Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Wed, 7 Sep 2016 10:31:21 +0200 Subject: [PATCH] monitor -> service --- src/vs/workbench/api/node/extHost.api.impl.ts | 4 ++-- .../workbench/api/node/extHost.contribution.ts | 4 ++-- src/vs/workbench/api/node/extHost.protocol.ts | 4 ++-- ...tHostHeapMonitor.ts => extHostHeapService.ts} | 6 +++--- .../api/node/extHostLanguageFeatures.ts | 16 ++++++++-------- ...adHeapMonitor.ts => mainThreadHeapService.ts} | 4 ++-- .../test/node/api/extHostApiCommands.test.ts | 4 ++-- .../node/api/extHostLanguageFeatures.test.ts | 4 ++-- 8 files changed, 23 insertions(+), 23 deletions(-) rename src/vs/workbench/api/node/{extHostHeapMonitor.ts => extHostHeapService.ts} (85%) rename src/vs/workbench/api/node/{mainThreadHeapMonitor.ts => mainThreadHeapService.ts} (90%) diff --git a/src/vs/workbench/api/node/extHost.api.impl.ts b/src/vs/workbench/api/node/extHost.api.impl.ts index 90236ba0053..60c3d773de3 100644 --- a/src/vs/workbench/api/node/extHost.api.impl.ts +++ b/src/vs/workbench/api/node/extHost.api.impl.ts @@ -17,7 +17,7 @@ import {ExtHostConfiguration} from 'vs/workbench/api/node/extHostConfiguration'; import {ExtHostDiagnostics} from 'vs/workbench/api/node/extHostDiagnostics'; import {ExtHostWorkspace} from 'vs/workbench/api/node/extHostWorkspace'; import {ExtHostQuickOpen} from 'vs/workbench/api/node/extHostQuickOpen'; -import {ExtHostHeapMonitor} from 'vs/workbench/api/node/extHostHeapMonitor'; +import {ExtHostHeapService} from 'vs/workbench/api/node/extHostHeapService'; import {ExtHostStatusBar} from 'vs/workbench/api/node/extHostStatusBar'; import {ExtHostCommands} from 'vs/workbench/api/node/extHostCommands'; import {ExtHostOutputService} from 'vs/workbench/api/node/extHostOutputService'; @@ -100,7 +100,7 @@ export class ExtHostAPIImplementation { // Addressable instances const col = new InstanceCollection(); - const extHostHeapMonitor = col.define(ExtHostContext.ExtHostHeapMonitor).set(new ExtHostHeapMonitor()); + const extHostHeapMonitor = col.define(ExtHostContext.ExtHostHeapService).set(new ExtHostHeapService()); const extHostDocuments = col.define(ExtHostContext.ExtHostDocuments).set(new ExtHostDocuments(threadService)); const extHostEditors = col.define(ExtHostContext.ExtHostEditors).set(new ExtHostEditors(threadService, extHostDocuments)); const extHostCommands = col.define(ExtHostContext.ExtHostCommands).set(new ExtHostCommands(threadService, extHostEditors)); diff --git a/src/vs/workbench/api/node/extHost.contribution.ts b/src/vs/workbench/api/node/extHost.contribution.ts index 43fce942a35..56753b05010 100644 --- a/src/vs/workbench/api/node/extHost.contribution.ts +++ b/src/vs/workbench/api/node/extHost.contribution.ts @@ -32,7 +32,7 @@ import {MainThreadTerminalService} from './mainThreadTerminalService'; import {MainThreadWorkspace} from './mainThreadWorkspace'; import {MainProcessExtensionService} from './mainThreadExtensionService'; import {MainThreadFileSystemEventService} from './mainThreadFileSystemEventService'; -import {MainThreadHeapMonitor} from './mainThreadHeapMonitor'; +import {MainThreadHeapService} from './mainThreadHeapService'; // --- other interested parties import {MainProcessTextMateSyntax} from 'vs/editor/node/textMate/TMSyntax'; @@ -88,7 +88,7 @@ export class ExtHostContribution implements IWorkbenchContribution { create(JSONValidationExtensionPoint); create(LanguageConfigurationFileHandler); create(MainThreadFileSystemEventService); - create(MainThreadHeapMonitor); + create(MainThreadHeapService); } } diff --git a/src/vs/workbench/api/node/extHost.protocol.ts b/src/vs/workbench/api/node/extHost.protocol.ts index f6afe370227..a2031bbce9a 100644 --- a/src/vs/workbench/api/node/extHost.protocol.ts +++ b/src/vs/workbench/api/node/extHost.protocol.ts @@ -279,7 +279,7 @@ export namespace ObjectIdentifier { } } -export abstract class ExtHostHeapMonitorShape { +export abstract class ExtHostHeapServiceShape { $onGarbageCollection(ids: number[]): void { throw ni(); } } @@ -339,7 +339,7 @@ export const ExtHostContext = { ExtHostDocuments: createExtId('ExtHostDocuments', ExtHostDocumentsShape), ExtHostEditors: createExtId('ExtHostEditors', ExtHostEditorsShape), ExtHostFileSystemEventService: createExtId('ExtHostFileSystemEventService', ExtHostFileSystemEventServiceShape), - ExtHostHeapMonitor: createExtId('ExtHostHeapMonitor', ExtHostHeapMonitorShape), + ExtHostHeapService: createExtId('ExtHostHeapMonitor', ExtHostHeapServiceShape), ExtHostLanguageFeatures: createExtId('ExtHostLanguageFeatures', ExtHostLanguageFeaturesShape), ExtHostQuickOpen: createExtId('ExtHostQuickOpen', ExtHostQuickOpenShape), ExtHostExtensionService: createExtId('ExtHostExtensionService', ExtHostExtensionServiceShape), diff --git a/src/vs/workbench/api/node/extHostHeapMonitor.ts b/src/vs/workbench/api/node/extHostHeapService.ts similarity index 85% rename from src/vs/workbench/api/node/extHostHeapMonitor.ts rename to src/vs/workbench/api/node/extHostHeapService.ts index af81049ff0d..47a3d8acdbc 100644 --- a/src/vs/workbench/api/node/extHostHeapMonitor.ts +++ b/src/vs/workbench/api/node/extHostHeapService.ts @@ -4,9 +4,9 @@ *--------------------------------------------------------------------------------------------*/ 'use strict'; -import {ExtHostHeapMonitorShape} from './extHost.protocol'; +import {ExtHostHeapServiceShape} from './extHost.protocol'; -export class ExtHostHeapMonitor extends ExtHostHeapMonitorShape { +export class ExtHostHeapService extends ExtHostHeapServiceShape { private static _idPool = 0; @@ -14,7 +14,7 @@ export class ExtHostHeapMonitor extends ExtHostHeapMonitorShape { private _callbacks: { [n: number]: Function } = Object.create(null); keep(obj:any, callback?:() => any): number { - const id = ExtHostHeapMonitor._idPool++; + const id = ExtHostHeapService._idPool++; this._data[id] = obj; if (typeof callback === 'function') { this._callbacks[id] = callback; diff --git a/src/vs/workbench/api/node/extHostLanguageFeatures.ts b/src/vs/workbench/api/node/extHostLanguageFeatures.ts index 990d4ce5c42..02b6c218188 100644 --- a/src/vs/workbench/api/node/extHostLanguageFeatures.ts +++ b/src/vs/workbench/api/node/extHostLanguageFeatures.ts @@ -13,7 +13,7 @@ import * as TypeConverters from 'vs/workbench/api/node/extHostTypeConverters'; import {Range, Disposable, CompletionList, CompletionItem} from 'vs/workbench/api/node/extHostTypes'; import {IPosition, IRange, ISingleEditOperation} from 'vs/editor/common/editorCommon'; import * as modes from 'vs/editor/common/modes'; -import {ExtHostHeapMonitor} from 'vs/workbench/api/node/extHostHeapMonitor'; +import {ExtHostHeapService} from 'vs/workbench/api/node/extHostHeapService'; import {ExtHostDocuments} from 'vs/workbench/api/node/extHostDocuments'; import {ExtHostCommands} from 'vs/workbench/api/node/extHostCommands'; import {ExtHostDiagnostics} from 'vs/workbench/api/node/extHostDiagnostics'; @@ -501,13 +501,13 @@ class RenameAdapter { class SuggestAdapter { private _documents: ExtHostDocuments; - private _heapMonitor: ExtHostHeapMonitor; + private _heapService: ExtHostHeapService; private _provider: vscode.CompletionItemProvider; private _disposables: { [id: number]: IDisposable[] } = []; - constructor(documents: ExtHostDocuments, heapMonitor: ExtHostHeapMonitor, provider: vscode.CompletionItemProvider) { + constructor(documents: ExtHostDocuments, heapMonitor: ExtHostHeapService, provider: vscode.CompletionItemProvider) { this._documents = documents; - this._heapMonitor = heapMonitor; + this._heapService = heapMonitor; this._provider = provider; } @@ -545,7 +545,7 @@ class SuggestAdapter { const item = list.items[i]; const disposables: IDisposable[] = []; const suggestion = TypeConverters.Suggest.from(item, disposables); - const id = this._heapMonitor.keep(item, () => dispose(this._disposables[id])); + const id = this._heapService.keep(item, () => dispose(this._disposables[id])); this._disposables[id] = disposables; ObjectIdentifier.mixin(suggestion, id); @@ -586,7 +586,7 @@ class SuggestAdapter { } const id = ObjectIdentifier.get(suggestion); - const item = this._heapMonitor.get(id); + const item = this._heapService.get(id); if (!item) { return TPromise.as(suggestion); } @@ -662,7 +662,7 @@ export class ExtHostLanguageFeatures extends ExtHostLanguageFeaturesShape { private _proxy: MainThreadLanguageFeaturesShape; private _documents: ExtHostDocuments; private _commands: ExtHostCommands; - private _heapMonitor: ExtHostHeapMonitor; + private _heapMonitor: ExtHostHeapService; private _diagnostics: ExtHostDiagnostics; private _adapter: { [handle: number]: Adapter } = Object.create(null); @@ -670,7 +670,7 @@ export class ExtHostLanguageFeatures extends ExtHostLanguageFeaturesShape { threadService: IThreadService, documents: ExtHostDocuments, commands: ExtHostCommands, - heapMonitor: ExtHostHeapMonitor, + heapMonitor: ExtHostHeapService, diagnostics: ExtHostDiagnostics ) { super(); diff --git a/src/vs/workbench/api/node/mainThreadHeapMonitor.ts b/src/vs/workbench/api/node/mainThreadHeapService.ts similarity index 90% rename from src/vs/workbench/api/node/mainThreadHeapMonitor.ts rename to src/vs/workbench/api/node/mainThreadHeapService.ts index 64c60246ff4..4f3f6f53a26 100644 --- a/src/vs/workbench/api/node/mainThreadHeapMonitor.ts +++ b/src/vs/workbench/api/node/mainThreadHeapService.ts @@ -10,13 +10,13 @@ import {IThreadService} from 'vs/workbench/services/thread/common/threadService' import {ExtHostContext} from './extHost.protocol'; import {onDidGarbageCollectSignals, consumeSignals} from 'gc-signals'; -export class MainThreadHeapMonitor { +export class MainThreadHeapService { private _subscription: IDisposable; private _consumeHandle: number; constructor( @IThreadService threadService: IThreadService) { - const proxy = threadService.get(ExtHostContext.ExtHostHeapMonitor); + const proxy = threadService.get(ExtHostContext.ExtHostHeapService); this._subscription = onDidGarbageCollectSignals(ids => { proxy.$onGarbageCollection(ids); diff --git a/src/vs/workbench/test/node/api/extHostApiCommands.test.ts b/src/vs/workbench/test/node/api/extHostApiCommands.test.ts index f80a1bde549..c4b0d1dbaf3 100644 --- a/src/vs/workbench/test/node/api/extHostApiCommands.test.ts +++ b/src/vs/workbench/test/node/api/extHostApiCommands.test.ts @@ -23,7 +23,7 @@ import {ExtHostLanguageFeatures} from 'vs/workbench/api/node/extHostLanguageFeat import {MainThreadLanguageFeatures} from 'vs/workbench/api/node/mainThreadLanguageFeatures'; import {registerApiCommands} from 'vs/workbench/api/node/extHostApiCommands'; import {ExtHostCommands} from 'vs/workbench/api/node/extHostCommands'; -import {ExtHostHeapMonitor} from 'vs/workbench/api/node/extHostHeapMonitor'; +import {ExtHostHeapService} from 'vs/workbench/api/node/extHostHeapService'; import {MainThreadCommands} from 'vs/workbench/api/node/mainThreadCommands'; import {ExtHostDocuments} from 'vs/workbench/api/node/extHostDocuments'; import * as ExtHostTypeConverters from 'vs/workbench/api/node/extHostTypeConverters'; @@ -109,7 +109,7 @@ suite('ExtHostLanguageFeatureCommands', function() { const diagnostics = new ExtHostDiagnostics(threadService); threadService.set(ExtHostContext.ExtHostDiagnostics, diagnostics); - extHost = new ExtHostLanguageFeatures(threadService, extHostDocuments, commands, new ExtHostHeapMonitor(), diagnostics); + extHost = new ExtHostLanguageFeatures(threadService, extHostDocuments, commands, new ExtHostHeapService(), diagnostics); threadService.set(ExtHostContext.ExtHostLanguageFeatures, extHost); mainThread = threadService.setTestInstance(MainContext.MainThreadLanguageFeatures, instantiationService.createInstance(MainThreadLanguageFeatures)); diff --git a/src/vs/workbench/test/node/api/extHostLanguageFeatures.test.ts b/src/vs/workbench/test/node/api/extHostLanguageFeatures.test.ts index 7cdb832bbbc..e22a9435875 100644 --- a/src/vs/workbench/test/node/api/extHostLanguageFeatures.test.ts +++ b/src/vs/workbench/test/node/api/extHostLanguageFeatures.test.ts @@ -39,7 +39,7 @@ import {getLinks} from 'vs/editor/contrib/links/common/links'; import {asWinJsPromise} from 'vs/base/common/async'; import {MainContext, ExtHostContext} from 'vs/workbench/api/node/extHost.protocol'; import {ExtHostDiagnostics} from 'vs/workbench/api/node/extHostDiagnostics'; -import {ExtHostHeapMonitor} from 'vs/workbench/api/node/extHostHeapMonitor'; +import {ExtHostHeapService} from 'vs/workbench/api/node/extHostHeapService'; const defaultSelector = { scheme: 'far' }; const model: EditorCommon.IModel = EditorModel.createFromString( @@ -98,7 +98,7 @@ suite('ExtHostLanguageFeatures', function() { const diagnostics = new ExtHostDiagnostics(threadService); threadService.set(ExtHostContext.ExtHostDiagnostics, diagnostics); - extHost = new ExtHostLanguageFeatures(threadService, extHostDocuments, commands, new ExtHostHeapMonitor(), diagnostics); + extHost = new ExtHostLanguageFeatures(threadService, extHostDocuments, commands, new ExtHostHeapService(), diagnostics); threadService.set(ExtHostContext.ExtHostLanguageFeatures, extHost); mainThread = threadService.setTestInstance(MainContext.MainThreadLanguageFeatures, instantiationService.createInstance(MainThreadLanguageFeatures)); -- GitLab