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} node |
9 * @param {number} sampleTime | 9 * @param {number} sampleTime |
10 */ | 10 */ |
11 WebInspector.CPUProfileNode = function(sourceNode, sampleTime) | 11 WebInspector.CPUProfileNode = function(node, sampleTime) |
12 { | 12 { |
13 if (sourceNode.callFrame) { | 13 var callFrame = node.callFrame || /** @type {!RuntimeAgent.CallFrame} */ ({ |
14 WebInspector.ProfileNode.call(this, sourceNode.callFrame); | 14 // Backward compatibility for old SamplingHeapProfileNode format. |
15 } else { | 15 functionName: node["functionName"], |
16 // Backward compatibility for old CPUProfileNode format. | 16 scriptId: node["scriptId"], |
17 var frame = /** @type {!RuntimeAgent.CallFrame} */(sourceNode); | 17 url: node["url"], |
18 WebInspector.ProfileNode.call(this, { | 18 lineNumber: node["lineNumber"] - 1, |
19 functionName: frame.functionName, | 19 columnNumber: node["columnNumber"] - 1 |
20 scriptId: frame.scriptId, url: frame.url, | 20 }); |
21 lineNumber: frame.lineNumber - 1, | 21 WebInspector.ProfileNode.call(this, callFrame); |
22 columnNumber: frame.columnNumber - 1 | 22 this.id = node.id; |
23 }); | 23 this.self = node.hitCount * sampleTime; |
24 } | 24 this.positionTicks = node.positionTicks; |
25 this.id = sourceNode.id; | 25 this.deoptReason = node.deoptReason; |
26 this.self = sourceNode.hitCount * sampleTime; | |
27 this.positionTicks = sourceNode.positionTicks; | |
28 this.deoptReason = sourceNode.deoptReason; | |
29 } | 26 } |
30 | 27 |
31 WebInspector.CPUProfileNode.prototype = { | 28 WebInspector.CPUProfileNode.prototype = { |
32 __proto__: WebInspector.ProfileNode.prototype | 29 __proto__: WebInspector.ProfileNode.prototype |
33 } | 30 } |
34 | 31 |
35 /** | 32 /** |
36 * @constructor | 33 * @constructor |
37 * @extends {WebInspector.ProfileTreeModel} | 34 * @extends {WebInspector.ProfileTreeModel} |
38 * @param {!ProfilerAgent.CPUProfile} profile | 35 * @param {!ProfilerAgent.CPUProfile} profile |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 * @param {number} index | 298 * @param {number} index |
302 * @return {?WebInspector.CPUProfileNode} | 299 * @return {?WebInspector.CPUProfileNode} |
303 */ | 300 */ |
304 nodeByIndex: function(index) | 301 nodeByIndex: function(index) |
305 { | 302 { |
306 return this._idToNode.get(this.samples[index]) || null; | 303 return this._idToNode.get(this.samples[index]) || null; |
307 }, | 304 }, |
308 | 305 |
309 __proto__: WebInspector.ProfileTreeModel.prototype | 306 __proto__: WebInspector.ProfileTreeModel.prototype |
310 } | 307 } |
OLD | NEW |