提交 6c59d053 编写于 作者: J Johannes Rieken

move mainThread[H,L], #70319

上级 f49b168f
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { ExtHostContext, IExtHostContext } from '../common/extHost.protocol';
import { Disposable } from 'vs/base/common/lifecycle';
import { extHostCustomer } from 'vs/workbench/api/common/extHostCustomers';
import { IHeapService } from 'vs/workbench/services/heap/common/heap';
@extHostCustomer
export class MainThreadHeapService extends Disposable {
constructor(
extHostContext: IExtHostContext,
@IHeapService heapService: IHeapService,
) {
super();
const proxy = extHostContext.getProxy(ExtHostContext.ExtHostHeapService);
this._register(heapService.onGarbageCollection((ids) => {
// send to ext host
proxy.$onGarbageCollection(ids);
}));
}
}
......@@ -14,7 +14,6 @@ import { Range as EditorRange } from 'vs/editor/common/core/range';
import { ExtHostContext, MainThreadLanguageFeaturesShape, ExtHostLanguageFeaturesShape, MainContext, IExtHostContext, ISerializedLanguageConfiguration, ISerializedRegExp, ISerializedIndentationRule, ISerializedOnEnterRule, LocationDto, WorkspaceSymbolDto, CodeActionDto, reviveWorkspaceEditDto, ISerializedDocumentFilter, DefinitionLinkDto, ISerializedSignatureHelpProviderMetadata, CodeInsetDto, LinkDto, CallHierarchyDto } from '../common/extHost.protocol';
import { LanguageConfigurationRegistry } from 'vs/editor/common/modes/languageConfigurationRegistry';
import { LanguageConfiguration, IndentationRule, OnEnterRule } from 'vs/editor/common/modes/languageConfiguration';
import { IHeapService } from './mainThreadHeapService';
import { IModeService } from 'vs/editor/common/services/modeService';
import { extHostNamedCustomer } from 'vs/workbench/api/common/extHostCustomers';
import { URI } from 'vs/base/common/uri';
......@@ -22,6 +21,7 @@ import { Selection } from 'vs/editor/common/core/selection';
import * as codeInset from 'vs/workbench/contrib/codeinset/common/codeInset';
import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions';
import * as callh from 'vs/workbench/contrib/callHierarchy/common/callHierarchy';
import { IHeapService } from 'vs/workbench/services/heap/common/heap';
@extHostNamedCustomer(MainContext.MainThreadLanguageFeatures)
export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesShape {
......
......@@ -29,7 +29,9 @@ import '../browser/mainThreadEditors';
import '../browser/mainThreadErrors';
import '../browser/mainThreadFileSystem';
import '../browser/mainThreadFileSystemEventService';
import '../browser/mainThreadHeapService';
import '../browser/mainThreadLanguages';
import '../browser/mainThreadLanguageFeatures';
import '../browser/mainThreadLogService';
import '../browser/mainThreadMessageService';
import '../browser/mainThreadOutputService';
......@@ -49,8 +51,6 @@ import '../browser/mainThreadWorkspace';
import './mainThreadComments';
import './mainThreadConsole';
import './mainThreadExtensionService';
import './mainThreadHeapService';
import './mainThreadLanguageFeatures';
import './mainThreadTask';
import './mainThreadWebview';
import 'vs/workbench/api/node/apiCommands';
......
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { Event } from 'vs/base/common/event';
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
export const IHeapService = createDecorator<IHeapService>('heapService');
export interface ObjectIdentifier {
$ident?: number;
}
export interface IHeapService {
_serviceBrand: any;
readonly onGarbageCollection: Event<number[]>;
/**
* Track gc-collection for the given object
*/
trackObject(obj: ObjectIdentifier | undefined): void;
}
export class NullHeapService implements IHeapService {
_serviceBrand: any;
onGarbageCollection = Event.None;
trackObject() { }
}
......@@ -3,26 +3,10 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { ExtHostContext, ObjectIdentifier, IExtHostContext } from '../common/extHost.protocol';
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
import { Event, Emitter } from 'vs/base/common/event';
import { IDisposable } from 'vs/base/common/lifecycle';
import { extHostCustomer } from 'vs/workbench/api/common/extHostCustomers';
import { GCSignal } from 'gc-signals';
export const IHeapService = createDecorator<IHeapService>('heapService');
export interface IHeapService {
_serviceBrand: any;
readonly onGarbageCollection: Event<number[]>;
/**
* Track gc-collection for the given object
*/
trackObject(obj: ObjectIdentifier | undefined): void;
}
import { IHeapService, ObjectIdentifier } from 'vs/workbench/services/heap/common/heap';
export class HeapService implements IHeapService {
......@@ -93,26 +77,4 @@ export class HeapService implements IHeapService {
}
}
@extHostCustomer
export class MainThreadHeapService {
private readonly _toDispose: IDisposable;
constructor(
extHostContext: IExtHostContext,
@IHeapService heapService: IHeapService,
) {
const proxy = extHostContext.getProxy(ExtHostContext.ExtHostHeapService);
this._toDispose = heapService.onGarbageCollection((ids) => {
// send to ext host
proxy.$onGarbageCollection(ids);
});
}
public dispose(): void {
this._toDispose.dispose();
}
}
registerSingleton(IHeapService, HeapService, true);
......@@ -15,8 +15,8 @@ import { IMarkerService } from 'vs/platform/markers/common/markers';
import { ICommandService, CommandsRegistry } from 'vs/platform/commands/common/commands';
import { IModelService } from 'vs/editor/common/services/modelService';
import { ExtHostLanguageFeatures } from 'vs/workbench/api/node/extHostLanguageFeatures';
import { MainThreadLanguageFeatures } from 'vs/workbench/api/electron-browser/mainThreadLanguageFeatures';
import { IHeapService } from 'vs/workbench/api/electron-browser/mainThreadHeapService';
import { MainThreadLanguageFeatures } from 'vs/workbench/api/browser/mainThreadLanguageFeatures';
import { IHeapService, NullHeapService } from 'vs/workbench/services/heap/common/heap';
import { ExtHostApiCommands } from 'vs/workbench/api/node/extHostApiCommands';
import { ExtHostCommands } from 'vs/workbench/api/node/extHostCommands';
import { ExtHostHeapService } from 'vs/workbench/api/node/extHostHeapService';
......@@ -67,12 +67,7 @@ suite('ExtHostLanguageFeatureCommands', function () {
{
let instantiationService = new TestInstantiationService();
rpcProtocol = new TestRPCProtocol();
instantiationService.stub(IHeapService, {
_serviceBrand: undefined,
trackObject(_obj: any) {
// nothing
}
});
instantiationService.stub(IHeapService, NullHeapService);
instantiationService.stub(ICommandService, {
_serviceBrand: undefined,
executeCommand(id: string, args: any): any {
......
......@@ -15,10 +15,10 @@ import { TestRPCProtocol } from './testRPCProtocol';
import { IMarkerService } from 'vs/platform/markers/common/markers';
import { MarkerService } from 'vs/platform/markers/common/markerService';
import { ExtHostLanguageFeatures } from 'vs/workbench/api/node/extHostLanguageFeatures';
import { MainThreadLanguageFeatures } from 'vs/workbench/api/electron-browser/mainThreadLanguageFeatures';
import { MainThreadLanguageFeatures } from 'vs/workbench/api/browser/mainThreadLanguageFeatures';
import { ExtHostCommands } from 'vs/workbench/api/node/extHostCommands';
import { MainThreadCommands } from 'vs/workbench/api/browser/mainThreadCommands';
import { IHeapService } from 'vs/workbench/api/electron-browser/mainThreadHeapService';
import { IHeapService, NullHeapService } from 'vs/workbench/services/heap/common/heap';
import { ExtHostDocuments } from 'vs/workbench/api/node/extHostDocuments';
import { ExtHostDocumentsAndEditors } from 'vs/workbench/api/node/extHostDocumentsAndEditors';
import { getDocumentSymbols } from 'vs/editor/contrib/quickOpen/quickOpen';
......@@ -81,12 +81,7 @@ suite('ExtHostLanguageFeatures', function () {
{
let instantiationService = new TestInstantiationService();
instantiationService.stub(IMarkerService, MarkerService);
instantiationService.stub(IHeapService, {
_serviceBrand: undefined,
trackObject(_obj: any) {
// nothing
}
});
instantiationService.stub(IHeapService, NullHeapService);
inst = instantiationService;
}
......
......@@ -134,6 +134,7 @@ import 'vs/workbench/services/extensions/electron-browser/extensionManagementSer
import 'vs/workbench/services/remote/electron-browser/remoteAgentServiceImpl';
import 'vs/workbench/services/notification/common/notificationService';
import 'vs/workbench/services/remote/common/remoteEnvironmentService';
import 'vs/workbench/services/heap/node/heap';
registerSingleton(IMenuService, MenuService, true);
registerSingleton(IListService, ListService, true);
......
......@@ -136,6 +136,7 @@ import 'vs/workbench/services/label/common/labelService';
// import 'vs/workbench/services/remote/electron-browser/remoteAgentServiceImpl';
import 'vs/workbench/services/notification/common/notificationService';
import 'vs/workbench/services/remote/common/remoteEnvironmentService';
// import 'vs/workbench/services/heap/node/heap';
registerSingleton(IMenuService, MenuService, true);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册