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

debt - less TPromise #53526

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