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

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

Issue 2450663004: DevTools: do not allow using 'this' before call into super. (Closed)
Patch Set: rebaselined Created 4 years, 1 month 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 * @param {!RuntimeAgent.CallFrame} callFrame
8 */ 8 */
9 WebInspector.ProfileNode = function(callFrame) 9 WebInspector.ProfileNode = function(callFrame)
10 { 10 {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 * @return {number} 61 * @return {number}
62 */ 62 */
63 get columnNumber() 63 get columnNumber()
64 { 64 {
65 return this.callFrame.columnNumber; 65 return this.callFrame.columnNumber;
66 } 66 }
67 }; 67 };
68 68
69 /** 69 /**
70 * @constructor 70 * @constructor
71 * @param {!WebInspector.ProfileNode} root
72 */ 71 */
73 WebInspector.ProfileTreeModel = function(root) 72 WebInspector.ProfileTreeModel = function()
74 { 73 {
75 this.root = root;
76 this._assignDepthsAndParents();
77 this.total = this._calculateTotals(this.root);
78 }; 74 };
79 75
80 WebInspector.ProfileTreeModel.prototype = { 76 WebInspector.ProfileTreeModel.prototype = {
77 /**
78 * @param {!WebInspector.ProfileNode} root
79 * @protected
80 */
81 initialize: function(root)
82 {
83 this.root = root;
84 this._assignDepthsAndParents();
85 this.total = this._calculateTotals(this.root);
86 },
87
81 _assignDepthsAndParents: function() 88 _assignDepthsAndParents: function()
82 { 89 {
83 var root = this.root; 90 var root = this.root;
84 root.depth = -1; 91 root.depth = -1;
85 root.parent = null; 92 root.parent = null;
86 this.maxDepth = 0; 93 this.maxDepth = 0;
87 var nodesToTraverse = [root]; 94 var nodesToTraverse = [root];
88 while (nodesToTraverse.length) { 95 while (nodesToTraverse.length) {
89 var parent = nodesToTraverse.pop(); 96 var parent = nodesToTraverse.pop();
90 var depth = parent.depth + 1; 97 var depth = parent.depth + 1;
(...skipping 25 matching lines...) Expand all
116 dfsList.push(node); 123 dfsList.push(node);
117 nodesToTraverse.push(...node.children); 124 nodesToTraverse.push(...node.children);
118 } 125 }
119 while (dfsList.length > 1) { 126 while (dfsList.length > 1) {
120 var node = dfsList.pop(); 127 var node = dfsList.pop();
121 node.parent.total += node.total; 128 node.parent.total += node.total;
122 } 129 }
123 return root.total; 130 return root.total;
124 } 131 }
125 }; 132 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698