提交 d90d8d9b 编写于 作者: J Johannes Rieken

debt - less TPromise #53526

上级 3aacda87
......@@ -215,7 +215,7 @@ export interface IExtensionService {
}
export interface ProfileSession {
stop(): TPromise<IExtensionHostProfile>;
stop(): Promise<IExtensionHostProfile>;
}
export function checkProposedApiEnabled(extension: IExtensionDescription): void {
......
......@@ -5,7 +5,6 @@
import { Profile, ProfileNode } from 'v8-inspect-profiler';
import { TernarySearchTree } from 'vs/base/common/map';
import { TPromise } from 'vs/base/common/winjs.base';
import { realpathSync } from 'vs/base/node/extfs';
import { IExtensionDescription, IExtensionHostProfile, IExtensionService, ProfileSegmentId, ProfileSession } from 'vs/workbench/services/extensions/common/extensions';
......@@ -14,20 +13,16 @@ export class ExtensionHostProfiler {
constructor(private readonly _port: number, @IExtensionService private readonly _extensionService: IExtensionService) {
}
public start(): TPromise<ProfileSession> {
return TPromise.wrap(import('v8-inspect-profiler')).then(profiler => {
return profiler.startProfiling({ port: this._port }).then(session => {
return {
stop: () => {
return TPromise.wrap(session.stop()).then(profile => {
return this._extensionService.getExtensions().then(extensions => {
return this.distill(profile.profile, extensions);
});
});
}
};
});
});
public async start(): Promise<ProfileSession> {
const profiler = await import('v8-inspect-profiler');
const session = await profiler.startProfiling({ port: this._port });
return {
stop: async () => {
const profile = await session.stop();
const extensions = await this._extensionService.getExtensions();
return this.distill((profile as any).profile, extensions);
}
};
}
private distill(profile: Profile, extensions: IExtensionDescription[]): IExtensionHostProfile {
......
......@@ -238,7 +238,7 @@ export class ExtensionHostProcessManager extends Disposable {
});
}
public startExtensionHostProfile(): TPromise<ProfileSession> {
public startExtensionHostProfile(): Promise<ProfileSession> {
if (this._extensionHostProcessWorker) {
let port = this._extensionHostProcessWorker.getInspectPort();
if (port) {
......@@ -564,7 +564,7 @@ export class ExtensionService extends Disposable implements IExtensionService {
return false;
}
public startExtensionHostProfile(): TPromise<ProfileSession> {
public startExtensionHostProfile(): Promise<ProfileSession> {
for (let i = 0, len = this._extensionHostProcessManagers.length; i < len; i++) {
const extHostProcessManager = this._extensionHostProcessManagers[i];
if (extHostProcessManager.canProfileExtensionHost()) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册