提交 193f327f 编写于 作者: M Matt Bierner

Strict null check extensionHostProfiler

上级 e90b2e30
......@@ -682,6 +682,7 @@
"./vs/workbench/services/extensions/common/extensions.ts",
"./vs/workbench/services/extensions/common/extensionsRegistry.ts",
"./vs/workbench/services/extensions/electron-browser/cachedExtensionScanner.ts",
"./vs/workbench/services/extensions/electron-browser/extensionHostProfiler.ts",
"./vs/workbench/services/extensions/electron-browser/inactiveExtensionUrlHandler.ts",
"./vs/workbench/services/extensions/node/extensionDescriptionRegistry.ts",
"./vs/workbench/services/extensions/node/extensionManagementServerService.ts",
......
......@@ -102,7 +102,7 @@ export interface IExtensionHostProfile {
/**
* Extension id or one of the four known program states.
*/
export type ProfileSegmentId = string | 'idle' | 'program' | 'gc' | 'self';
export type ProfileSegmentId = string | 'idle' | 'program' | 'gc' | 'self' | null;
export class ActivationTimes {
constructor(
......
......@@ -69,13 +69,13 @@ export class ExtensionHostProfiler {
}
visit(nodes[0], null);
let samples = profile.samples;
let timeDeltas = profile.timeDeltas;
const samples = profile.samples || [];
let timeDeltas = profile.timeDeltas || [];
let distilledDeltas: number[] = [];
let distilledIds: ProfileSegmentId[] = [];
let currSegmentTime = 0;
let currSegmentId: string = void 0;
let currSegmentId: string | undefined;
for (let i = 0; i < samples.length; i++) {
let id = samples[i];
let segmentId = idsToSegmentId.get(id);
......@@ -84,7 +84,7 @@ export class ExtensionHostProfiler {
distilledIds.push(currSegmentId);
distilledDeltas.push(currSegmentTime);
}
currSegmentId = segmentId;
currSegmentId = segmentId || undefined;
currSegmentTime = 0;
}
currSegmentTime += timeDeltas[i];
......@@ -93,9 +93,6 @@ export class ExtensionHostProfiler {
distilledIds.push(currSegmentId);
distilledDeltas.push(currSegmentTime);
}
idsToNodes = null;
idsToSegmentId = null;
searchTree = null;
return {
startTime: profile.startTime,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册