提交 26ff5f8b 编写于 作者: M Matt Bierner

Strict null work in extensionProfileService

上级 4180c4f1
...@@ -33,8 +33,8 @@ export class ExtensionHostProfileService extends Disposable implements IExtensio ...@@ -33,8 +33,8 @@ export class ExtensionHostProfileService extends Disposable implements IExtensio
public readonly onDidChangeLastProfile: Event<void> = this._onDidChangeLastProfile.event; public readonly onDidChangeLastProfile: Event<void> = this._onDidChangeLastProfile.event;
private readonly _unresponsiveProfiles = new Map<string, IExtensionHostProfile>(); private readonly _unresponsiveProfiles = new Map<string, IExtensionHostProfile>();
private _profile: IExtensionHostProfile; private _profile: IExtensionHostProfile | null;
private _profileSession: ProfileSession; private _profileSession: ProfileSession | null;
private _state: ProfileSessionState; private _state: ProfileSessionState;
public get state() { return this._state; } public get state() { return this._state; }
...@@ -71,7 +71,7 @@ export class ExtensionHostProfileService extends Disposable implements IExtensio ...@@ -71,7 +71,7 @@ export class ExtensionHostProfileService extends Disposable implements IExtensio
this._onDidChangeState.fire(undefined); this._onDidChangeState.fire(undefined);
} }
public startProfiling(): Promise<any> { public startProfiling(): Promise<any> | null {
if (this._state !== ProfileSessionState.None) { if (this._state !== ProfileSessionState.None) {
return null; return null;
} }
...@@ -102,7 +102,7 @@ export class ExtensionHostProfileService extends Disposable implements IExtensio ...@@ -102,7 +102,7 @@ export class ExtensionHostProfileService extends Disposable implements IExtensio
} }
public stopProfiling(): void { public stopProfiling(): void {
if (this._state !== ProfileSessionState.Running) { if (this._state !== ProfileSessionState.Running || !this._profileSession) {
return; return;
} }
...@@ -142,7 +142,7 @@ export class ProfileExtHostStatusbarItem implements IStatusbarItem { ...@@ -142,7 +142,7 @@ export class ProfileExtHostStatusbarItem implements IStatusbarItem {
private label: HTMLElement; private label: HTMLElement;
private timeStarted: number; private timeStarted: number;
private labelUpdater: any; private labelUpdater: any;
private clickHandler: () => void; private clickHandler: (() => void) | null;
constructor() { constructor() {
ProfileExtHostStatusbarItem.instance = this; ProfileExtHostStatusbarItem.instance = this;
......
...@@ -62,12 +62,12 @@ export interface IExtensionHostProfileService { ...@@ -62,12 +62,12 @@ export interface IExtensionHostProfileService {
readonly onDidChangeLastProfile: Event<void>; readonly onDidChangeLastProfile: Event<void>;
readonly state: ProfileSessionState; readonly state: ProfileSessionState;
readonly lastProfile: IExtensionHostProfile; readonly lastProfile: IExtensionHostProfile | null;
startProfiling(): void; startProfiling(): void;
stopProfiling(): void; stopProfiling(): void;
getUnresponsiveProfile(extensionId: ExtensionIdentifier): IExtensionHostProfile; getUnresponsiveProfile(extensionId: ExtensionIdentifier): IExtensionHostProfile | undefined;
setUnresponsiveProfile(extensionId: ExtensionIdentifier, profile: IExtensionHostProfile): void; setUnresponsiveProfile(extensionId: ExtensionIdentifier, profile: IExtensionHostProfile): void;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册