Index: third_party/WebKit/Source/devtools/front_end/timeline_model/TimelineModel.js |
diff --git a/third_party/WebKit/Source/devtools/front_end/timeline_model/TimelineModel.js b/third_party/WebKit/Source/devtools/front_end/timeline_model/TimelineModel.js |
index c025c3267102021a69cde9434c5af8c2f9835412..36c86326b61652606a7e68f1ebc99fc6177e1d7d 100644 |
--- a/third_party/WebKit/Source/devtools/front_end/timeline_model/TimelineModel.js |
+++ b/third_party/WebKit/Source/devtools/front_end/timeline_model/TimelineModel.js |
@@ -161,7 +161,8 @@ WebInspector.TimelineModel.RecordType = { |
// CpuProfile is a virtual event created on frontend to support |
// serialization of CPU Profiles within tracing timeline data. |
- CpuProfile: "CpuProfile" |
+ CpuProfile: "CpuProfile", |
+ Profile: "Profile" |
} |
WebInspector.TimelineModel.Category = { |
@@ -752,7 +753,7 @@ WebInspector.TimelineModel.prototype = { |
} |
if (!cpuProfile) { |
- cpuProfileEvent = events.find(e => e.name === WebInspector.TimelineModel.RecordType.CpuProfile); |
+ cpuProfileEvent = events.find(e => e.name === WebInspector.TimelineModel.RecordType.Profile); |
if (!cpuProfileEvent) |
return null; |
var profileGroup = tracingModel.profileGroup(cpuProfileEvent.id); |
@@ -773,9 +774,14 @@ WebInspector.TimelineModel.prototype = { |
cpuProfile.startTime = eventData["startTime"]; |
if ("endTime" in eventData) |
cpuProfile.endTime = eventData["endTime"]; |
- cpuProfile.nodes.pushAll(eventData["nodes"] || []); |
- cpuProfile.samples.pushAll(eventData["samples"] || []); |
+ var nodesAndSamples = eventData["cpuProfile"] || {}; |
+ cpuProfile.nodes.pushAll(nodesAndSamples["nodes"] || []); |
+ cpuProfile.samples.pushAll(nodesAndSamples["samples"] || []); |
cpuProfile.timeDeltas.pushAll(eventData["timeDeltas"] || []); |
+ if (cpuProfile.samples.length !== cpuProfile.timeDeltas.length) { |
+ WebInspector.console.error("Failed to parse CPU profile."); |
+ return null; |
+ } |
} |
if (!cpuProfile.endTime) |
cpuProfile.endTime = cpuProfile.timeDeltas.reduce((x, y) => x + y, cpuProfile.startTime); |