Index: third_party/WebKit/Source/devtools/front_end/sdk/CPUProfileDataModel.js |
diff --git a/third_party/WebKit/Source/devtools/front_end/sdk/CPUProfileDataModel.js b/third_party/WebKit/Source/devtools/front_end/sdk/CPUProfileDataModel.js |
index a93f1e099b3aa1b2fce035f4a67777ad70dc4cf6..04832da81bc4c4cd324ca85f5fde0dd1d3383e08 100644 |
--- a/third_party/WebKit/Source/devtools/front_end/sdk/CPUProfileDataModel.js |
+++ b/third_party/WebKit/Source/devtools/front_end/sdk/CPUProfileDataModel.js |
@@ -22,7 +22,8 @@ WebInspector.CPUProfileNode = function(node, sampleTime) |
this.id = node.id; |
this.self = node.hitCount * sampleTime; |
this.positionTicks = node.positionTicks; |
- this.deoptReason = node.deoptReason; |
+ // Compatibility: legacy backends could provide "no reason" for optimized functions. |
+ this.deoptReason = node.deoptReason && node.deoptReason !== "no reason" ? node.deoptReason : null; |
} |
WebInspector.CPUProfileNode.prototype = { |
@@ -36,7 +37,7 @@ WebInspector.CPUProfileNode.prototype = { |
*/ |
WebInspector.CPUProfileDataModel = function(profile) |
{ |
- var isLegacyFormat = !!profile.head; |
+ var isLegacyFormat = !!profile["head"]; |
if (isLegacyFormat) { |
// Legacy format contains raw timestamps and start/stop times are in seconds. |
this.profileStartTime = profile.startTime * 1000; |
@@ -73,7 +74,7 @@ WebInspector.CPUProfileDataModel.prototype = { |
var nodes = []; |
convertNodesTree(profile.head); |
profile.nodes = nodes; |
- profile.head = null; |
+ delete profile.head; |
/** |
* @param {!ProfilerAgent.CPUProfileNode} node |
* @return {number} |