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

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: 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 */
80 initialize: function(root)
dgozman 2016/10/26 00:31:01 @protected
81 {
82 this.root = root;
83 this._assignDepthsAndParents();
84 this.total = this._calculateTotals(this.root);
85 },
86
81 _assignDepthsAndParents: function() 87 _assignDepthsAndParents: function()
82 { 88 {
83 var root = this.root; 89 var root = this.root;
84 root.depth = -1; 90 root.depth = -1;
85 root.parent = null; 91 root.parent = null;
86 this.maxDepth = 0; 92 this.maxDepth = 0;
87 var nodesToTraverse = [root]; 93 var nodesToTraverse = [root];
88 while (nodesToTraverse.length) { 94 while (nodesToTraverse.length) {
89 var parent = nodesToTraverse.pop(); 95 var parent = nodesToTraverse.pop();
90 var depth = parent.depth + 1; 96 var depth = parent.depth + 1;
(...skipping 25 matching lines...) Expand all
116 dfsList.push(node); 122 dfsList.push(node);
117 nodesToTraverse.push(...node.children); 123 nodesToTraverse.push(...node.children);
118 } 124 }
119 while (dfsList.length > 1) { 125 while (dfsList.length > 1) {
120 var node = dfsList.pop(); 126 var node = dfsList.pop();
121 node.parent.total += node.total; 127 node.parent.total += node.total;
122 } 128 }
123 return root.total; 129 return root.total;
124 } 130 }
125 }; 131 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698