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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sdk/ProfileTreeModel.js

Issue 2150803002: [DevTools] Add callFrame to CPUProfileNode & SamplingHeapProfileNode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed comments Created 4 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 * @param {!RuntimeAgent.CallFrame} callFrame
7 */ 8 */
8 WebInspector.ProfileNode = function(functionName, scriptId, url, lineNumber, col umnNumber) 9 WebInspector.ProfileNode = function(callFrame)
9 { 10 {
10 /** @type {!RuntimeAgent.CallFrame} */ 11 /** @type {!RuntimeAgent.CallFrame} */
11 this.frame = { 12 this.callFrame = callFrame;
12 functionName: functionName,
13 scriptId: scriptId,
14 url: url,
15 lineNumber: lineNumber,
16 columnNumber: columnNumber
17 };
18 /** @type {string} */ 13 /** @type {string} */
19 this.callUID = `${this.frame.functionName}@${this.frame.scriptId}:${this.fra me.lineNumber}`; 14 this.callUID = `${this.callFrame.functionName}@${this.callFrame.scriptId}:${ this.callFrame.lineNumber}`;
20 /** @type {number} */ 15 /** @type {number} */
21 this.self = 0; 16 this.self = 0;
22 /** @type {number} */ 17 /** @type {number} */
23 this.total = 0; 18 this.total = 0;
24 /** @type {number} */ 19 /** @type {number} */
25 this.id = 0; 20 this.id = 0;
26 /** @type {?WebInspector.ProfileNode} */ 21 /** @type {?WebInspector.ProfileNode} */
27 this.parent = null; 22 this.parent = null;
28 /** @type {!Array<!WebInspector.ProfileNode>} */ 23 /** @type {!Array<!WebInspector.ProfileNode>} */
29 this.children = []; 24 this.children = [];
30 } 25 }
31 26
32 WebInspector.ProfileNode.prototype = { 27 WebInspector.ProfileNode.prototype = {
33 /** 28 /**
34 * @return {string} 29 * @return {string}
35 */ 30 */
36 get functionName() 31 get functionName()
37 { 32 {
38 return this.frame.functionName; 33 return this.callFrame.functionName;
39 }, 34 },
40 35
41 /** 36 /**
42 * @return {string} 37 * @return {string}
43 */ 38 */
44 get scriptId() 39 get scriptId()
45 { 40 {
46 return this.frame.scriptId; 41 return this.callFrame.scriptId;
47 }, 42 },
48 43
49 /** 44 /**
50 * @return {string} 45 * @return {string}
51 */ 46 */
52 get url() 47 get url()
53 { 48 {
54 return this.frame.url; 49 return this.callFrame.url;
55 }, 50 },
56 51
57 /** 52 /**
58 * @return {number} 53 * @return {number}
59 */ 54 */
60 get lineNumber() 55 get lineNumber()
61 { 56 {
62 return this.frame.lineNumber; 57 return this.callFrame.lineNumber;
63 }, 58 },
64 59
65 /** 60 /**
66 * @return {number} 61 * @return {number}
67 */ 62 */
68 get columnNumber() 63 get columnNumber()
69 { 64 {
70 return this.frame.columnNumber; 65 return this.callFrame.columnNumber;
71 } 66 }
72 } 67 }
73 68
74 /** 69 /**
75 * @constructor 70 * @constructor
76 * @param {!WebInspector.ProfileNode} root 71 * @param {!WebInspector.ProfileNode} root
77 */ 72 */
78 WebInspector.ProfileTreeModel = function(root) 73 WebInspector.ProfileTreeModel = function(root)
79 { 74 {
80 this.root = root; 75 this.root = root;
(...skipping 29 matching lines...) Expand all
110 /** 105 /**
111 * @param {!WebInspector.ProfileNode} node 106 * @param {!WebInspector.ProfileNode} node
112 * @return {number} 107 * @return {number}
113 */ 108 */
114 _calculateTotals: function(node) 109 _calculateTotals: function(node)
115 { 110 {
116 node.total = node.children.reduce((acc, child) => acc + this._calculateT otals(child), node.self); 111 node.total = node.children.reduce((acc, child) => acc + this._calculateT otals(child), node.self);
117 return node.total; 112 return node.total;
118 } 113 }
119 } 114 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698