Changeset 49891 in webkit
- Timestamp:
- Oct 20, 2009 4:10:46 PM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r49890 r49891 1 2009-10-20 Mikhail Naganov <mnaganov@chromium.org> 2 3 Reviewed by Pavel Feldman. 4 5 Web Inspector: populate child nodes before sorting them. 6 7 https://bugs.webkit.org/show_bug.cgi?id=29673 8 9 * inspector/front-end/BottomUpProfileDataGridTree.js: 10 (WebInspector.BottomUpProfileDataGridNode): Swapped with BottomUpProfileDataGridTree to be consistent with TopDownProfileDataGridNode. 11 (WebInspector.BottomUpProfileDataGridNode.prototype._takePropertiesFromProfileDataGridNode): 12 (WebInspector.BottomUpProfileDataGridNode.prototype._keepOnlyChild): 13 (WebInspector.BottomUpProfileDataGridNode.prototype._exclude): 14 (WebInspector.BottomUpProfileDataGridNode.prototype._merge): 15 (WebInspector.BottomUpProfileDataGridNode.prototype._sharedPopulate): 16 (WebInspector.BottomUpProfileDataGridTree.prototype.exclude): 17 * inspector/front-end/ProfileDataGridTree.js: 18 (WebInspector.ProfileDataGridNode.prototype.sort): Added missing parentheses. 19 (WebInspector.ProfileDataGridNode.prototype.get _parent): 20 (WebInspector.ProfileDataGridNode.prototype._populate): 21 * inspector/front-end/TopDownProfileDataGridTree.js: 22 (WebInspector.TopDownProfileDataGridNode.prototype._sharedPopulate): 23 1 24 2009-10-20 Jens Alfke <snej@chromium.org> 2 25 -
trunk/WebCore/inspector/front-end/BottomUpProfileDataGridTree.js
r44698 r49891 30 30 // because a root node can represent itself AND an ancestor. 31 31 32 WebInspector.BottomUpProfileDataGridNode = function(/*ProfileView*/ profileView, /*ProfileNode*/ profileNode, /*BottomUpProfileDataGridTree*/ owningTree) 33 { 34 // In bottom up mode, our parents are our children since we display an inverted tree. 35 // However, we don't want to show the very top parent since it is redundant. 36 var hasChildren = !!(profileNode.parent && profileNode.parent.parent); 37 38 WebInspector.ProfileDataGridNode.call(this, profileView, profileNode, owningTree, hasChildren); 39 40 this._remainingNodeInfos = []; 41 } 42 43 WebInspector.BottomUpProfileDataGridNode.prototype = { 44 _takePropertiesFromProfileDataGridNode: function(/*ProfileDataGridNode*/ profileDataGridNode) 45 { 46 this._save(); 47 48 this.selfTime = profileDataGridNode.selfTime; 49 this.totalTime = profileDataGridNode.totalTime; 50 this.numberOfCalls = profileDataGridNode.numberOfCalls; 51 }, 52 53 // When focusing, we keep just the members of the callstack. 54 _keepOnlyChild: function(/*ProfileDataGridNode*/ child) 55 { 56 this._save(); 57 58 this.removeChildren(); 59 this.appendChild(child); 60 }, 61 62 _exclude: function(aCallUID) 63 { 64 if (this._remainingNodeInfos) 65 this._populate(); 66 67 this._save(); 68 69 var children = this.children; 70 var index = this.children.length; 71 72 while (index--) 73 children[index]._exclude(aCallUID); 74 75 var child = this.childrenByCallUID[aCallUID]; 76 77 if (child) 78 this._merge(child, true); 79 }, 80 81 _merge: function(/*ProfileDataGridNode*/ child, /*Boolean*/ shouldAbsorb) 82 { 83 this.selfTime -= child.selfTime; 84 85 WebInspector.ProfileDataGridNode.prototype._merge.call(this, child, shouldAbsorb); 86 }, 87 88 _sharedPopulate: function() 89 { 90 var remainingNodeInfos = this._remainingNodeInfos; 91 var count = remainingNodeInfos.length; 92 93 for (var index = 0; index < count; ++index) { 94 var nodeInfo = remainingNodeInfos[index]; 95 var ancestor = nodeInfo.ancestor; 96 var focusNode = nodeInfo.focusNode; 97 var child = this.findChild(ancestor); 98 99 // If we already have this child, then merge the data together. 100 if (child) { 101 var totalTimeAccountedFor = nodeInfo.totalTimeAccountedFor; 102 103 child.selfTime += focusNode.selfTime; 104 child.numberOfCalls += focusNode.numberOfCalls; 105 106 if (!totalTimeAccountedFor) 107 child.totalTime += focusNode.totalTime; 108 } else { 109 // If not, add it as a true ancestor. 110 // In heavy mode, we take our visual identity from ancestor node... 111 var child = new WebInspector.BottomUpProfileDataGridNode(this.profileView, ancestor, this.tree); 112 113 if (ancestor !== focusNode) { 114 // but the actual statistics from the "root" node (bottom of the callstack). 115 child.selfTime = focusNode.selfTime; 116 child.totalTime = focusNode.totalTime; 117 child.numberOfCalls = focusNode.numberOfCalls; 118 } 119 120 this.appendChild(child); 121 } 122 123 var parent = ancestor.parent; 124 if (parent && parent.parent) { 125 nodeInfo.ancestor = parent; 126 child._remainingNodeInfos.push(nodeInfo); 127 } 128 } 129 130 delete this._remainingNodeInfos; 131 } 132 } 133 134 WebInspector.BottomUpProfileDataGridNode.prototype.__proto__ = WebInspector.ProfileDataGridNode.prototype; 135 32 136 WebInspector.BottomUpProfileDataGridTree = function(/*ProfileView*/ aProfileView, /*ProfileNode*/ aProfileNode) 33 137 { … … 140 244 if (this.lastComparator) 141 245 this.sort(this.lastComparator, true); 142 } 246 }, 247 248 _sharedPopulate: WebInspector.BottomUpProfileDataGridNode.prototype._sharedPopulate 143 249 } 144 250 145 251 WebInspector.BottomUpProfileDataGridTree.prototype.__proto__ = WebInspector.ProfileDataGridTree.prototype; 146 252 147 WebInspector.BottomUpProfileDataGridNode = function(/*ProfileView*/ profileView, /*ProfileNode*/ profileNode, /*BottomUpProfileDataGridTree*/ owningTree)148 {149 // In bottom up mode, our parents are our children since we display an inverted tree.150 // However, we don't want to show the very top parent since it is redundant.151 var hasChildren = !!(profileNode.parent && profileNode.parent.parent);152 153 WebInspector.ProfileDataGridNode.call(this, profileView, profileNode, owningTree, hasChildren);154 155 this._remainingNodeInfos = [];156 }157 158 WebInspector.BottomUpProfileDataGridNode.prototype = {159 _takePropertiesFromProfileDataGridNode: function(/*ProfileDataGridNode*/ profileDataGridNode)160 {161 this._save();162 163 this.selfTime = profileDataGridNode.selfTime;164 this.totalTime = profileDataGridNode.totalTime;165 this.numberOfCalls = profileDataGridNode.numberOfCalls;166 },167 168 // When focusing, we keep just the members of the callstack.169 _keepOnlyChild: function(/*ProfileDataGridNode*/ child)170 {171 this._save();172 173 this.removeChildren();174 this.appendChild(child);175 },176 177 _exclude: function(aCallUID)178 {179 if (this._remainingNodeInfos)180 this._populate();181 182 this._save();183 184 var children = this.children;185 var index = this.children.length;186 187 while (index--)188 children[index]._exclude(aCallUID);189 190 var child = this.childrenByCallUID[aCallUID];191 192 if (child)193 this._merge(child, true);194 },195 196 _merge: function(/*ProfileDataGridNode*/ child, /*Boolean*/ shouldAbsorb)197 {198 this.selfTime -= child.selfTime;199 200 WebInspector.ProfileDataGridNode.prototype._merge.call(this, child, shouldAbsorb);201 },202 203 _populate: function(event)204 {205 var remainingNodeInfos = this._remainingNodeInfos;206 var count = remainingNodeInfos.length;207 208 for (var index = 0; index < count; ++index) {209 var nodeInfo = remainingNodeInfos[index];210 var ancestor = nodeInfo.ancestor;211 var focusNode = nodeInfo.focusNode;212 var child = this.findChild(ancestor);213 214 // If we already have this child, then merge the data together.215 if (child) {216 var totalTimeAccountedFor = nodeInfo.totalTimeAccountedFor;217 218 child.selfTime += focusNode.selfTime;219 child.numberOfCalls += focusNode.numberOfCalls;220 221 if (!totalTimeAccountedFor)222 child.totalTime += focusNode.totalTime;223 } else {224 // If not, add it as a true ancestor.225 // In heavy mode, we take our visual identity from ancestor node...226 var child = new WebInspector.BottomUpProfileDataGridNode(this.profileView, ancestor, this.tree);227 228 if (ancestor !== focusNode) {229 // but the actual statistics from the "root" node (bottom of the callstack).230 child.selfTime = focusNode.selfTime;231 child.totalTime = focusNode.totalTime;232 child.numberOfCalls = focusNode.numberOfCalls;233 }234 235 this.appendChild(child);236 }237 238 var parent = ancestor.parent;239 if (parent && parent.parent) {240 nodeInfo.ancestor = parent;241 child._remainingNodeInfos.push(nodeInfo);242 }243 }244 245 delete this._remainingNodeInfos;246 247 if (this.removeEventListener)248 this.removeEventListener("populate", this._populate, this);249 }250 }251 252 WebInspector.BottomUpProfileDataGridNode.prototype.__proto__ = WebInspector.ProfileDataGridNode.prototype; -
trunk/WebCore/inspector/front-end/ProfileDataGridTree.js
r48742 r49891 127 127 }, 128 128 129 expand: function()130 {131 if (!this.parent) {132 var currentComparator = this.parent.lastComparator;133 134 if (!currentComparator || (currentComparator === this.lastComparator))135 return;136 137 this.sort(currentComparator);138 }139 140 WebInspector.DataGridNode.prototype.expand.call(this);141 },142 143 129 sort: function(/*Function*/ comparator, /*Boolean*/ force) 144 130 { … … 154 140 // If the grid node is collapsed, then don't sort children (save operation for later). 155 141 // If the grid node has the same sorting as previously, then there is no point in sorting it again. 156 if (!force && !gridNode.expanded || gridNode.lastComparator === comparator) {142 if (!force && (!gridNode.expanded || gridNode.lastComparator === comparator)) { 157 143 if (gridNode.children.length) 158 144 gridNode.shouldRefreshChildren = true; … … 223 209 { 224 210 return this.totalTime / this.tree.totalTime * 100.0; 211 }, 212 213 get _parent() 214 { 215 return this.parent !== this.dataGrid ? this.parent : this.tree; 216 }, 217 218 _populate: function(event) 219 { 220 this._sharedPopulate(); 221 222 if (this._parent) { 223 var currentComparator = this._parent.lastComparator; 224 225 if (currentComparator) 226 this.sort(currentComparator, true); 227 } 228 229 if (this.removeEventListener) 230 this.removeEventListener("populate", this._populate, this); 225 231 }, 226 232 -
trunk/WebCore/inspector/front-end/TopDownProfileDataGridTree.js
r42808 r49891 34 34 35 35 WebInspector.TopDownProfileDataGridNode.prototype = { 36 _ populate: function(event)36 _sharedPopulate: function() 37 37 { 38 38 var children = this._remainingChildren; … … 41 41 for (var i = 0; i < childrenLength; ++i) 42 42 this.appendChild(new WebInspector.TopDownProfileDataGridNode(this.profileView, children[i], this.tree)); 43 44 if (this.removeEventListener)45 this.removeEventListener("populate", this._populate, this);46 43 47 44 this._remainingChildren = null; … … 106 103 }, 107 104 108 _merge: WebInspector.TopDownProfileDataGridNode.prototype._merge 105 _merge: WebInspector.TopDownProfileDataGridNode.prototype._merge, 106 107 _sharedPopulate: WebInspector.TopDownProfileDataGridNode.prototype._sharedPopulate 109 108 } 110 109
Note: See TracChangeset
for help on using the changeset viewer.