mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-25 02:58:56 +01:00
monitor -> service
This commit is contained in:
@@ -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<ExtHostHeapMonitor>(new ExtHostHeapMonitor());
|
||||
const extHostHeapMonitor = col.define(ExtHostContext.ExtHostHeapService).set<ExtHostHeapService>(new ExtHostHeapService());
|
||||
const extHostDocuments = col.define(ExtHostContext.ExtHostDocuments).set<ExtHostDocuments>(new ExtHostDocuments(threadService));
|
||||
const extHostEditors = col.define(ExtHostContext.ExtHostEditors).set<ExtHostEditors>(new ExtHostEditors(threadService, extHostDocuments));
|
||||
const extHostCommands = col.define(ExtHostContext.ExtHostCommands).set<ExtHostCommands>(new ExtHostCommands(threadService, extHostEditors));
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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<ExtHostDocumentsShape>('ExtHostDocuments', ExtHostDocumentsShape),
|
||||
ExtHostEditors: createExtId<ExtHostEditorsShape>('ExtHostEditors', ExtHostEditorsShape),
|
||||
ExtHostFileSystemEventService: createExtId<ExtHostFileSystemEventServiceShape>('ExtHostFileSystemEventService', ExtHostFileSystemEventServiceShape),
|
||||
ExtHostHeapMonitor: createExtId<ExtHostHeapMonitorShape>('ExtHostHeapMonitor', ExtHostHeapMonitorShape),
|
||||
ExtHostHeapService: createExtId<ExtHostHeapServiceShape>('ExtHostHeapMonitor', ExtHostHeapServiceShape),
|
||||
ExtHostLanguageFeatures: createExtId<ExtHostLanguageFeaturesShape>('ExtHostLanguageFeatures', ExtHostLanguageFeaturesShape),
|
||||
ExtHostQuickOpen: createExtId<ExtHostQuickOpenShape>('ExtHostQuickOpen', ExtHostQuickOpenShape),
|
||||
ExtHostExtensionService: createExtId<ExtHostExtensionServiceShape>('ExtHostExtensionService', ExtHostExtensionServiceShape),
|
||||
|
||||
@@ -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;
|
||||
@@ -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<CompletionItem>(id);
|
||||
const item = this._heapService.get<CompletionItem>(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();
|
||||
|
||||
@@ -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);
|
||||
Reference in New Issue
Block a user