Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @constructor | 6 * @constructor |
| 7 * @extends {WebInspector.ProfileNode} | 7 * @extends {WebInspector.ProfileNode} |
| 8 * @param {!ProfilerAgent.CPUProfileNode} sourceNode | 8 * @param {!ProfilerAgent.CPUProfileNode} sourceNode |
| 9 * @param {number} sampleTime | 9 * @param {number} sampleTime |
| 10 */ | 10 */ |
| 11 WebInspector.CPUProfileNode = function(sourceNode, sampleTime) | 11 WebInspector.CPUProfileNode = function(sourceNode, sampleTime) |
| 12 { | 12 { |
| 13 WebInspector.ProfileNode.call(this, sourceNode.functionName, sourceNode.scri ptId, sourceNode.url, sourceNode.lineNumber, sourceNode.columnNumber); | 13 WebInspector.ProfileNode.call(this, sourceNode.callFrame); |
|
alph
2016/07/14 17:56:00
ditto
kozy
2016/07/14 21:35:04
Done.
| |
| 14 this.id = sourceNode.id; | 14 this.id = sourceNode.id; |
| 15 this.self = sourceNode.hitCount * sampleTime; | 15 this.self = sourceNode.hitCount * sampleTime; |
| 16 this.callUID = sourceNode.callUID; | 16 this.callUID = sourceNode.callUID; |
| 17 this.positionTicks = sourceNode.positionTicks; | 17 this.positionTicks = sourceNode.positionTicks; |
| 18 this.deoptReason = sourceNode.deoptReason; | 18 this.deoptReason = sourceNode.deoptReason; |
| 19 } | 19 } |
| 20 | 20 |
| 21 WebInspector.CPUProfileNode.prototype = { | 21 WebInspector.CPUProfileNode.prototype = { |
| 22 __proto__: WebInspector.ProfileNode.prototype | 22 __proto__: WebInspector.ProfileNode.prototype |
| 23 } | 23 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 59 function computeHitCountForSubtree(node) | 59 function computeHitCountForSubtree(node) |
| 60 { | 60 { |
| 61 return node.children.reduce((acc, node) => acc + computeHitCountForS ubtree(node), node.hitCount); | 61 return node.children.reduce((acc, node) => acc + computeHitCountForS ubtree(node), node.hitCount); |
| 62 } | 62 } |
| 63 /** | 63 /** |
| 64 * @param {!ProfilerAgent.CPUProfileNode} node | 64 * @param {!ProfilerAgent.CPUProfileNode} node |
| 65 * @return {boolean} | 65 * @return {boolean} |
| 66 */ | 66 */ |
| 67 function isNativeNode(node) | 67 function isNativeNode(node) |
| 68 { | 68 { |
| 69 return !!node.url && node.url.startsWith("native "); | 69 return !!node.callFrame.url && node.callFrame.url.startsWith("native "); |
| 70 } | 70 } |
| 71 this.totalHitCount = computeHitCountForSubtree(root); | 71 this.totalHitCount = computeHitCountForSubtree(root); |
| 72 var sampleTime = (this.profileEndTime - this.profileStartTime) / this.to talHitCount; | 72 var sampleTime = (this.profileEndTime - this.profileStartTime) / this.to talHitCount; |
| 73 var keepNatives = !!WebInspector.moduleSetting("showNativeFunctionsInJSP rofile").get(); | 73 var keepNatives = !!WebInspector.moduleSetting("showNativeFunctionsInJSP rofile").get(); |
| 74 /** @type {!Map<number, number>} */ | 74 /** @type {!Map<number, number>} */ |
| 75 var idMap = new Map([[root.id, root.id]]); | 75 var idMap = new Map([[root.id, root.id]]); |
| 76 var resultRoot = new WebInspector.CPUProfileNode(root, sampleTime); | 76 var resultRoot = new WebInspector.CPUProfileNode(root, sampleTime); |
| 77 var parentNodeStack = root.children.map(() => resultRoot); | 77 var parentNodeStack = root.children.map(() => resultRoot); |
| 78 var sourceNodeStack = root.children; | 78 var sourceNodeStack = root.children; |
| 79 while (sourceNodeStack.length) { | 79 while (sourceNodeStack.length) { |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 289 * @param {number} index | 289 * @param {number} index |
| 290 * @return {?WebInspector.CPUProfileNode} | 290 * @return {?WebInspector.CPUProfileNode} |
| 291 */ | 291 */ |
| 292 nodeByIndex: function(index) | 292 nodeByIndex: function(index) |
| 293 { | 293 { |
| 294 return this._idToNode.get(this.samples[index]) || null; | 294 return this._idToNode.get(this.samples[index]) || null; |
| 295 }, | 295 }, |
| 296 | 296 |
| 297 __proto__: WebInspector.ProfileTreeModel.prototype | 297 __proto__: WebInspector.ProfileTreeModel.prototype |
| 298 } | 298 } |
| OLD | NEW |