Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(347)

Unified Diff: third_party/WebKit/Source/devtools/front_end/sdk/CPUProfileDataModel.js

Issue 2262303002: DevTooos: Profiler domain refactoring: Make deoptReason and positionTicks fields optional. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressing caseq comments Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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}

Powered by Google App Engine
This is Rietveld 408576698