Index: Source/devtools/front_end/profiler/CPUProfileDataGrid.js |
diff --git a/Source/devtools/front_end/profiler/CPUProfileDataGrid.js b/Source/devtools/front_end/profiler/CPUProfileDataGrid.js |
index 9fd11dc9135eeea3f2c1200f7b4968ae97013f86..09fff07350ed55dea276b7df975d93a6f0fead0c 100644 |
--- a/Source/devtools/front_end/profiler/CPUProfileDataGrid.js |
+++ b/Source/devtools/front_end/profiler/CPUProfileDataGrid.js |
@@ -255,21 +255,20 @@ WebInspector.ProfileDataGridNode.prototype = { |
populate: function() |
{ |
- if (this._populated) |
- return; |
- this._populated = true; |
- |
- this._sharedPopulate(); |
- |
- var currentComparator = this.tree.lastComparator; |
+ WebInspector.ProfileDataGridNode.populate(this); |
+ }, |
- if (currentComparator) |
- this.sort(currentComparator, true); |
+ /** |
+ * FIXME: make protected when compiler is fixed |
+ */ |
+ populateChildren: function() |
+ { |
}, |
// When focusing and collapsing we modify lots of nodes in the tree. |
// This allows us to restore them all to their original state when we revert. |
- _save: function() |
+ |
+ save: function() |
{ |
if (this._savedChildren) |
return; |
@@ -280,9 +279,12 @@ WebInspector.ProfileDataGridNode.prototype = { |
this._savedChildren = this.children.slice(); |
}, |
- // When focusing and collapsing we modify lots of nodes in the tree. |
- // This allows us to restore them all to their original state when we revert. |
- _restore: function() |
+ /** |
+ * When focusing and collapsing we modify lots of nodes in the tree. |
+ * This allows us to restore them all to their original state when we revert. |
+ * FIXME: make protected when compiler is fixed |
+ */ |
+ restore: function() |
{ |
if (!this._savedChildren) |
return; |
@@ -296,44 +298,75 @@ WebInspector.ProfileDataGridNode.prototype = { |
var count = children.length; |
for (var index = 0; index < count; ++index) { |
- children[index]._restore(); |
+ children[index].restore(); |
this.appendChild(children[index]); |
} |
}, |
- _merge: function(child, shouldAbsorb) |
+ /** |
+ * @param {!WebInspector.ProfileDataGridNode} child |
+ * @param {boolean} shouldAbsorb |
+ */ |
+ merge: function(child, shouldAbsorb) |
{ |
- this.selfTime += child.selfTime; |
+ WebInspector.ProfileDataGridNode.merge(this, child, shouldAbsorb); |
+ }, |
- if (!shouldAbsorb) |
- this.totalTime += child.totalTime; |
+ __proto__: WebInspector.DataGridNode.prototype |
+} |
- var children = this.children.slice(); |
+/** |
+ * @param {!WebInspector.ProfileDataGridNode|!WebInspector.ProfileDataGridTree} container |
+ * @param {!WebInspector.ProfileDataGridNode} child |
+ * @param {boolean} shouldAbsorb |
+ */ |
+WebInspector.ProfileDataGridNode.merge = function(container, child, shouldAbsorb) |
+{ |
+ container.selfTime += child.selfTime; |
- this.removeChildren(); |
+ if (!shouldAbsorb) |
+ container.totalTime += child.totalTime; |
- var count = children.length; |
+ var children = container.children.slice(); |
- for (var index = 0; index < count; ++index) { |
- if (!shouldAbsorb || children[index] !== child) |
- this.appendChild(children[index]); |
- } |
+ container.removeChildren(); |
- children = child.children.slice(); |
- count = children.length; |
+ var count = children.length; |
- for (var index = 0; index < count; ++index) { |
- var orphanedChild = children[index], |
- existingChild = this.childrenByCallUID[orphanedChild.callUID]; |
+ for (var index = 0; index < count; ++index) { |
+ if (!shouldAbsorb || children[index] !== child) |
+ container.appendChild(children[index]); |
+ } |
- if (existingChild) |
- existingChild._merge(orphanedChild, false); |
- else |
- this.appendChild(orphanedChild); |
- } |
- }, |
+ children = child.children.slice(); |
+ count = children.length; |
- __proto__: WebInspector.DataGridNode.prototype |
+ for (var index = 0; index < count; ++index) { |
+ var orphanedChild = children[index]; |
+ var existingChild = container.childrenByCallUID[orphanedChild.callUID]; |
+ |
+ if (existingChild) |
+ existingChild.merge(orphanedChild, false); |
+ else |
+ container.appendChild(orphanedChild); |
+ } |
+} |
+ |
+/** |
+ * @param {!WebInspector.ProfileDataGridNode|!WebInspector.ProfileDataGridTree} container |
+ */ |
+WebInspector.ProfileDataGridNode.populate = function(container) |
+{ |
+ if (container._populated) |
+ return; |
+ container._populated = true; |
+ |
+ container.populateChildren(); |
+ |
+ var currentComparator = container.tree.lastComparator; |
+ |
+ if (currentComparator) |
+ container.sort(currentComparator, true); |
} |
/** |
@@ -377,10 +410,17 @@ WebInspector.ProfileDataGridTree.prototype = { |
this.childrenByCallUID = {}; |
}, |
+ populateChildren: function() |
+ { |
+ }, |
+ |
findChild: WebInspector.ProfileDataGridNode.prototype.findChild, |
sort: WebInspector.ProfileDataGridNode.prototype.sort, |
- _save: function() |
+ /** |
+ * FIXME: make protected when compiler is fixed |
+ */ |
+ save: function() |
{ |
if (this._savedChildren) |
return; |
@@ -401,7 +441,7 @@ WebInspector.ProfileDataGridTree.prototype = { |
var count = children.length; |
for (var index = 0; index < count; ++index) |
- children[index]._restore(); |
+ children[index].restore(); |
this._savedChildren = null; |
} |