+2012-04-11 Yury Semikhatsky <yurys@chromium.org>
+
+ Web Inspector: add closure compiler annotations for profiler code
+ https://bugs.webkit.org/show_bug.cgi?id=83700
+
+ Basic type annotations are added to most of the profiler front-end. Some
+ dead code removed.
+
+ Reviewed by Pavel Feldman.
+
+ * inspector/compile-front-end.py:
+ * inspector/front-end/BinarySearch.js:
+ (Object.defineProperty):
+ * inspector/front-end/BottomUpProfileDataGridTree.js:
+ (WebInspector.BottomUpProfileDataGridNode.prototype._restore):
+ (WebInspector.BottomUpProfileDataGridNode.prototype._sharedPopulate):
+ (WebInspector.BottomUpProfileDataGridNode.prototype._willHaveChildren):
+ (WebInspector.BottomUpProfileDataGridTree):
+ * inspector/front-end/DataGrid.js:
+ * inspector/front-end/DetailedHeapshotGridNodes.js:
+ (WebInspector.HeapSnapshotInstanceNode.prototype._createChildNode):
+ (WebInspector.HeapSnapshotDiffNode.prototype.populateChildren.firstProviderPopulated):
+ (WebInspector.HeapSnapshotDiffNode.prototype.populateChildren.else.firstProviderPopulated):
+ (WebInspector.HeapSnapshotDiffNode.prototype.populateChildren):
+ * inspector/front-end/DetailedHeapshotView.js:
+ (WebInspector.DetailedHeapshotView.prototype._changeBase):
+ (WebInspector.DetailedHeapshotView.prototype._setRetainmentDataGridSource):
+ (WebInspector.DetailedHeapshotView.prototype._helpClicked.appendHelp):
+ (WebInspector.DetailedHeapshotView.prototype._helpClicked):
+ * inspector/front-end/HeapSnapshot.js:
+ (WebInspector.HeapSnapshot):
+ (HeapSnapshotMetainfo):
+ (WebInspector.HeapSnapshot.prototype._buildRetainers):
+ (WebInspector.HeapSnapshot.prototype._buildDominatedNodes):
+ (WebInspector.HeapSnapshot.prototype._markQueriableHeapObjects):
+ * inspector/front-end/ProfileDataGridTree.js:
+ (WebInspector.ProfileDataGridNode.prototype.insertChild):
+ (WebInspector.ProfileDataGridNode.prototype.removeChild):
+ (WebInspector.ProfileDataGridNode.prototype.removeChildren):
+ (WebInspector.ProfileDataGridNode.prototype._populate):
+ (WebInspector.ProfileDataGridTree.propertyComparator):
+ * inspector/front-end/ProfileView.js:
+ * inspector/front-end/ProfilesPanel.js:
+ (WebInspector.ProfileHeader):
+ (WebInspector.ProfilesPanel.prototype._finishHeapSnapshot.parsed):
+ (WebInspector.ProfilesPanel.prototype._finishHeapSnapshot):
+ (WebInspector.ProfilesPanel.prototype.performSearch.finishedCallback):
+ (WebInspector.ProfilesPanel.prototype.setRecordingProfile):
+ (WebInspector.ProfilesPanel.prototype.takeHeapSnapshot):
+ (WebInspector.ProfilerDispatcher.prototype.addProfileHeader):
+ * inspector/front-end/TopDownProfileDataGridTree.js:
+ (WebInspector.TopDownProfileDataGridTree):
+ (WebInspector.TopDownProfileDataGridTree.prototype.exclude):
+ * inspector/front-end/externs.js:
+ (Array.prototype.binaryIndexOf):
+ (Array.prototype.sortRange):
+ (WebInspector.CSSSelectorProfileType):
+ (WebInspector.HeapSnapshotWorker):
+ (WebInspector.HeapSnapshotWorker.prototype.createObject):
+ (WebInspector.HeapSnapshotWorker.prototype.startCheckingForLongRunningCalls):
+ * inspector/front-end/heapProfiler.css:
+
2012-04-12 Zalan Bujtas <zbujtas@gmail.com>
[Qt][WK2] Zoom gesture with double tap crashes on iframe when main frame has scroll offset.
"TestController.js",
]
},
+ {
+ "target_name": "profiler",
+ "dependencies": ["components"],
+ "sources": [
+ "BottomUpProfileDataGridTree.js",
+ "DetailedHeapshotView.js",
+ "DetailedHeapshotGridNodes.js",
+ "ProfileDataGridTree.js",
+ "ProfilesPanel.js",
+ "ProfileLauncherView.js",
+ "ProfileView.js",
+ "TopDownProfileDataGridTree.js",
+ "HeapSnapshot.js",
+ ]
+ },
# {
# "target_name": "tokenizers",
# "dependencies": ["components"],
#
# [Profiler]
# CSSSelectorProfileView
-# BottomUpProfileDataGridTree
-# DetailedHeapshotGridNodes
-# DetailedHeapshotView
-# HeapSnapshot
# HeapSnapshotProxy
# HeapSnapshotWorker
# HeapSnapshotWorkerDispatcher
-# ProfileDataGridTree
-# ProfilesPanel
-# ProfileView
-# TopDownProfileDataGridTree
#
# [Misc]
# inspector
return -(first + 1);
}
-Object.defineProperty(Array.prototype, "binaryIndexOf", { value: function(value, comparator)
+Object.defineProperty(Array.prototype, "binaryIndexOf",
{
- var result = binarySearch(value, this, comparator);
- return result >= 0 ? result : -1;
-}});
+ /**
+ * @this {Array.<*>}
+ */
+ value: function(value, comparator)
+ {
+ var result = binarySearch(value, this, comparator);
+ return result >= 0 ? result : -1;
+ }
+});
/**
* @param {*} anObject
// each child still represent the root node. We have to be particularly careful of recursion with this mode
// because a root node can represent itself AND an ancestor.
+/**
+ * @constructor
+ * @extends {WebInspector.ProfileDataGridNode}
+ */
WebInspector.BottomUpProfileDataGridNode = function(/*ProfileView*/ profileView, /*ProfileNode*/ profileNode, /*BottomUpProfileDataGridTree*/ owningTree)
{
WebInspector.ProfileDataGridNode.call(this, profileView, profileNode, owningTree, this._willHaveChildren(profileNode));
WebInspector.ProfileDataGridNode.prototype._restore();
if (!this.children.length)
- this.hasChildren = this._willHaveChildren();
+ this.hasChildren = this._willHaveChildren(this.profileNode);
},
_merge: function(/*ProfileDataGridNode*/ child, /*Boolean*/ shouldAbsorb)
} else {
// If not, add it as a true ancestor.
// In heavy mode, we take our visual identity from ancestor node...
- var child = new WebInspector.BottomUpProfileDataGridNode(this.profileView, ancestor, this.tree);
+ child = new WebInspector.BottomUpProfileDataGridNode(this.profileView, ancestor, this.tree);
if (ancestor !== focusNode) {
// but the actual statistics from the "root" node (bottom of the callstack).
_willHaveChildren: function(profileNode)
{
- profileNode = profileNode || this.profileNode;
// In bottom up mode, our parents are our children since we display an inverted tree.
// However, we don't want to show the very top parent since it is redundant.
return !!(profileNode.parent && profileNode.parent.parent);
WebInspector.BottomUpProfileDataGridNode.prototype.__proto__ = WebInspector.ProfileDataGridNode.prototype;
+/**
+ * @constructor
+ * @extends {WebInspector.ProfileDataGridTree}
+ */
WebInspector.BottomUpProfileDataGridTree = function(/*ProfileView*/ aProfileView, /*ProfileNode*/ aProfileNode)
{
WebInspector.ProfileDataGridTree.call(this, aProfileView, aProfileNode);
}
// Populate the top level nodes.
- WebInspector.BottomUpProfileDataGridNode.prototype._populate.call(this);
+ var any = /** @type{*} */this;
+ var node = /** @type{WebInspector.ProfileDataGridNode} */any;
+ WebInspector.BottomUpProfileDataGridNode.prototype._populate.call(node);
return this;
}
this.insertChild(child, this.children.length);
},
+ /**
+ * @this {WebInspector.DataGrid|WebInspector.DataGridNode}
+ */
insertChild: function(child, index)
{
if (!child)
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+/**
+ * @constructor
+ * @extends {WebInspector.DataGridNode}
+ */
WebInspector.HeapSnapshotGridNode = function(tree, hasChildren)
{
WebInspector.DataGridNode.call(this, null, hasChildren);
WebInspector.HeapSnapshotGridNode.prototype.__proto__ = WebInspector.DataGridNode.prototype;
+/**
+ * @constructor
+ * @extends {WebInspector.HeapSnapshotGridNode}
+ */
WebInspector.HeapSnapshotLazyGridNode = function(tree, hasChildren)
{
WebInspector.HeapSnapshotGridNode.call(this, tree, hasChildren);
WebInspector.HeapSnapshotLazyGridNode.prototype.__proto__ = WebInspector.HeapSnapshotGridNode.prototype;
+/**
+ * @constructor
+ * @extends {WebInspector.HeapSnapshotGridNode}
+ */
WebInspector.HeapSnapshotGenericObjectNode = function(tree, node)
{
WebInspector.HeapSnapshotGridNode.call(this, tree, false);
return cell;
},
- get _countPercent()
- {
- return this._count / this.dataGrid.snapshot.nodeCount * 100.0;
- },
-
get data()
{
var data = this._emptyData();
WebInspector.HeapSnapshotGenericObjectNode.prototype.__proto__ = WebInspector.HeapSnapshotGridNode.prototype;
+/**
+ * @constructor
+ * @extends {WebInspector.HeapSnapshotGenericObjectNode}
+ */
WebInspector.HeapSnapshotObjectNode = function(tree, isFromBaseSnapshot, edge, parentGridNode)
{
WebInspector.HeapSnapshotGenericObjectNode.call(this, tree, edge.node);
WebInspector.HeapSnapshotObjectNode.prototype.__proto__ = WebInspector.HeapSnapshotGenericObjectNode.prototype;
+/**
+ * @constructor
+ * @extends {WebInspector.HeapSnapshotGenericObjectNode}
+ */
WebInspector.HeapSnapshotInstanceNode = function(tree, baseSnapshot, snapshot, node)
{
WebInspector.HeapSnapshotGenericObjectNode.call(this, tree, node);
WebInspector.HeapSnapshotInstanceNode.prototype = {
_createChildNode: function(item)
{
- return new WebInspector.HeapSnapshotObjectNode(this.dataGrid, this._isDeletedNode, item);
+ return new WebInspector.HeapSnapshotObjectNode(this.dataGrid, this._isDeletedNode, item, null);
},
_createProvider: function(snapshot, nodeIndex)
WebInspector.HeapSnapshotInstanceNode.prototype.__proto__ = WebInspector.HeapSnapshotGenericObjectNode.prototype;
+/**
+ * @constructor
+ * @extends {WebInspector.HeapSnapshotLazyGridNode}
+ */
WebInspector.HeapSnapshotConstructorNode = function(tree, className, aggregate, aggregatesKey)
{
WebInspector.HeapSnapshotLazyGridNode.call(this, tree, aggregate.count > 0);
WebInspector.HeapSnapshotConstructorNode.prototype.__proto__ = WebInspector.HeapSnapshotLazyGridNode.prototype;
+/**
+ * @constructor
+ */
WebInspector.HeapSnapshotIteratorsTuple = function(it1, it2)
{
this._it1 = it1;
}
};
+/**
+ * @constructor
+ * @extends {WebInspector.HeapSnapshotLazyGridNode}
+ */
WebInspector.HeapSnapshotDiffNode = function(tree, className, baseAggregate, aggregate)
{
WebInspector.HeapSnapshotLazyGridNode.call(this, tree, true);
if (!provider && !howMany) {
var firstProviderPopulated = function()
{
- WebInspector.HeapSnapshotGridNode.prototype.populateChildren.call(this, this._provider._it2, this._defaultPopulateCount, atIndex, afterPopulate);
+ WebInspector.HeapSnapshotGridNode.prototype.populateChildren.call(this, this._provider._it2, this._defaultPopulateCount, atIndex, afterPopulate, false);
};
WebInspector.HeapSnapshotGridNode.prototype.populateChildren.call(this, this._provider._it1, this._defaultPopulateCount, atIndex, firstProviderPopulated.bind(this), true);
} else if (!howMany) {
var firstProviderPopulated = function()
{
- WebInspector.HeapSnapshotGridNode.prototype.populateChildren.call(this, this._provider._it2, null, atIndex, afterPopulate);
+ WebInspector.HeapSnapshotGridNode.prototype.populateChildren.call(this, this._provider._it2, null, atIndex, afterPopulate, false);
};
WebInspector.HeapSnapshotGridNode.prototype.populateChildren.call(this, this._provider._it1, null, atIndex, firstProviderPopulated.bind(this), true);
} else
- WebInspector.HeapSnapshotGridNode.prototype.populateChildren.call(this, provider, howMany, atIndex, afterPopulate);
+ WebInspector.HeapSnapshotGridNode.prototype.populateChildren.call(this, provider, howMany, atIndex, afterPopulate, false);
},
_signForDelta: function(delta)
WebInspector.HeapSnapshotDiffNode.prototype.__proto__ = WebInspector.HeapSnapshotLazyGridNode.prototype;
+/**
+ * @constructor
+ * @extends {WebInspector.HeapSnapshotGenericObjectNode}
+ */
WebInspector.HeapSnapshotDominatorObjectNode = function(tree, node)
{
WebInspector.HeapSnapshotGenericObjectNode.call(this, tree, node);
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+/**
+ * @constructor
+ * @extends {WebInspector.DataGrid}
+ * @param {boolean=} deferNodeContentCreation
+ */
WebInspector.HeapSnapshotSortableDataGrid = function(columns, deferNodeContentCreation)
{
WebInspector.DataGrid.call(this, columns);
WebInspector.HeapSnapshotSortableDataGrid.prototype.__proto__ = WebInspector.DataGrid.prototype;
+/**
+ * @constructor
+ * @extends {WebInspector.HeapSnapshotSortableDataGrid}
+ * @param {Object=} columns
+ */
WebInspector.HeapSnapshotContainmentDataGrid = function(columns)
{
columns = columns || {
MixInSnapshotNodeFunctions(WebInspector.HeapSnapshotObjectNode.prototype, WebInspector.HeapSnapshotContainmentDataGrid.prototype);
WebInspector.HeapSnapshotContainmentDataGrid.prototype.__proto__ = WebInspector.HeapSnapshotSortableDataGrid.prototype;
+/**
+ * @constructor
+ * @extends {WebInspector.HeapSnapshotContainmentDataGrid}
+ */
WebInspector.HeapSnapshotRetainmentDataGrid = function()
{
this.showRetainingEdges = true;
WebInspector.HeapSnapshotRetainmentDataGrid.prototype.__proto__ = WebInspector.HeapSnapshotContainmentDataGrid.prototype;
+/**
+ * @constructor
+ * @extends {WebInspector.HeapSnapshotSortableDataGrid}
+ */
WebInspector.HeapSnapshotConstructorsDataGrid = function()
{
var columns = {
WebInspector.HeapSnapshotConstructorsDataGrid.prototype.__proto__ = WebInspector.HeapSnapshotSortableDataGrid.prototype;
+/**
+ * @constructor
+ * @extends {WebInspector.HeapSnapshotSortableDataGrid}
+ */
WebInspector.HeapSnapshotDiffDataGrid = function()
{
var columns = {
WebInspector.HeapSnapshotDiffDataGrid.prototype.__proto__ = WebInspector.HeapSnapshotSortableDataGrid.prototype;
+/**
+ * @constructor
+ * @extends {WebInspector.HeapSnapshotSortableDataGrid}
+ */
WebInspector.HeapSnapshotDominatorsDataGrid = function()
{
var columns = {
MixInSnapshotNodeFunctions(WebInspector.HeapSnapshotDominatorObjectNode.prototype, WebInspector.HeapSnapshotDominatorsDataGrid.prototype);
WebInspector.HeapSnapshotDominatorsDataGrid.prototype.__proto__ = WebInspector.HeapSnapshotSortableDataGrid.prototype;
+/**
+ * @constructor
+ * @extends {WebInspector.View}
+ */
WebInspector.DetailedHeapshotView = function(parent, profile)
{
WebInspector.View.call(this);
this.retainmentView.element.addStyleClass("view");
this.retainmentView.element.addStyleClass("retaining-paths-view");
this.retainmentDataGrid = new WebInspector.HeapSnapshotRetainmentDataGrid();
- this.retainmentDataGrid.element.addEventListener("click", this._mouseClickInRetainmentGrid.bind(this), true);
this.retainmentDataGrid.show(this.retainmentView.element);
this.retainmentDataGrid.addEventListener(WebInspector.DataGrid.Events.SelectedNode, this._inspectedObjectChanged, this);
this.retainmentView.show(this.element);
this._updateFilterOptions();
this.helpButton = new WebInspector.StatusBarButton("", "heapshot-help-status-bar-item status-bar-item");
- this.helpButton.addEventListener("click", this._helpClicked.bind(this), false);
+ this.helpButton.addEventListener("click", this._helpClicked, this);
this._popoverHelper = new WebInspector.ObjectPopoverHelper(this.element, this._getHoverAnchor.bind(this), this._resolveObjectForPopover.bind(this), undefined, true);
return;
this._baseProfileUid = this._profiles()[this.baseSelectElement.selectedIndex].uid;
- this.dataGrid._baseProfileIndexChanged(this._loadProfileByIndex.bind(this), this.baseSelectElement.selectedIndex);
+ var dataGrid = /** @type {WebInspector.HeapSnapshotDiffDataGrid} */ this.dataGrid;
+ dataGrid._baseProfileIndexChanged(this._loadProfileByIndex.bind(this), this.baseSelectElement.selectedIndex);
if (!this.currentQuery || !this._searchFinishedCallback || !this._searchResults)
return;
_setRetainmentDataGridSource: function(nodeItem)
{
if (nodeItem && nodeItem.snapshotNodeIndex)
- this.retainmentDataGrid.setDataSource(this, nodeItem.isDeletedNode ? nodeItem.dataGrid.baseSnapshot : nodeItem.dataGrid.snapshot, nodeItem.snapshotNodeIndex, nodeItem.isDeletedNode ? this.baseSelectElement.childNodes[this.baseSelectElement.selectedIndex].label + " | " : "");
+ this.retainmentDataGrid.setDataSource(this, nodeItem.isDeletedNode ? nodeItem.dataGrid.baseSnapshot : nodeItem.dataGrid.snapshot, nodeItem.snapshotNodeIndex);
else
this.retainmentDataGrid.reset();
},
event.consume(true);
},
- _mouseClickInRetainmentGrid: function(event)
- {
- var cell = event.target.enclosingNodeOrSelfWithNodeName("td");
- if (!cell || (!cell.hasStyleClass("path-column")))
- return;
- var row = event.target.enclosingNodeOrSelfWithNodeName("tr");
- var nodeItem = row._dataGridNode;
- if (!nodeItem || !nodeItem.route)
- return;
- function expandRoute()
- {
- this.dataGrid.expandRoute(nodeItem.route);
- }
- this.changeView("Containment", expandRoute.bind(this));
- },
-
changeView: function(viewTitle, callback)
{
var viewIndex = null;
objsHeader.textContent = WebInspector.UIString("Object types:");
headerRow.appendChild(objsHeader);
contentElement.appendChild(headerRow);
+
+ function appendHelp(help, index, cell)
+ {
+ var div = document.createElement("div");
+ div.className = "source-code event-properties";
+ var name = document.createElement("span");
+ name.textContent = help[index];
+ name.className = help[index + 1];
+ div.appendChild(name);
+ var desc = document.createElement("span");
+ desc.textContent = " " + help[index + 2];
+ div.appendChild(desc);
+ cell.appendChild(div);
+ }
+
var len = Math.max(refTypes.length, objTypes.length);
for (var i = 0; i < len; i += 3) {
var row = document.createElement("tr");
}
this._helpPopoverContentElement = contentElement;
this.helpPopover = new WebInspector.Popover();
-
- function appendHelp(help, index, cell)
- {
- var div = document.createElement("div");
- div.className = "source-code event-properties";
- var name = document.createElement("span");
- name.textContent = help[index];
- name.className = help[index + 1];
- div.appendChild(name);
- var desc = document.createElement("span");
- desc.textContent = " " + help[index + 2];
- div.appendChild(desc);
- cell.appendChild(div);
- }
}
if (this.helpPopover.visible)
this.helpPopover.hide();
WebInspector.settings.showHeapSnapshotObjectsHiddenProperties = WebInspector.settings.createSetting("showHeaSnapshotObjectsHiddenProperties", false);
+/**
+ * @constructor
+ * @extends {WebInspector.ProfileType}
+ */
WebInspector.DetailedHeapshotProfileType = function()
{
WebInspector.ProfileType.call(this, WebInspector.DetailedHeapshotProfileType.TypeId, WebInspector.UIString("Take Heap Snapshot"));
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+/**
+ * @constructor
+ * @param {number=} size
+ */
WebInspector.Uint32Array = function(size)
{
const preallocateSize = 1000;
}
}
+/**
+ * @constructor
+ */
WebInspector.HeapSnapshotLoader = function()
{
this._json = "";
}
};
+/**
+ * @constructor
+ */
WebInspector.HeapSnapshotArraySlice = function(array, start, end)
{
this._array = array;
}
}
+/**
+ * @constructor
+ * @param {number=} edgeIndex
+ */
WebInspector.HeapSnapshotEdge = function(snapshot, edges, edgeIndex)
{
this._snapshot = snapshot;
}
};
+/**
+ * @constructor
+ */
WebInspector.HeapSnapshotEdgeIterator = function(edge)
{
this.edge = edge;
}
};
+/**
+ * @constructor
+ */
WebInspector.HeapSnapshotRetainerEdge = function(snapshot, retainedNodeIndex, retainerIndex)
{
this._snapshot = snapshot;
}
}
+/**
+ * @constructor
+ */
WebInspector.HeapSnapshotRetainerEdgeIterator = function(retainer)
{
this.retainer = retainer;
}
};
+/**
+ * @constructor
+ * @param {number=} nodeIndex
+ */
WebInspector.HeapSnapshotNode = function(snapshot, nodeIndex)
{
this._snapshot = snapshot;
}
};
+/**
+ * @constructor
+ */
WebInspector.HeapSnapshotNodeIterator = function(node)
{
this.node = node;
}
}
+/**
+ * @constructor
+ */
WebInspector.HeapSnapshot = function(profile)
{
this.uid = profile.snapshot.uid;
this._nodes = profile.nodes;
this._onlyNodes = profile.onlyNodes;
this._containmentEdges = profile.containmentEdges;
+ /** @type{HeapSnapshotMetainfo} */
this._metaNode = profile.metaNode;
this._strings = profile.strings;
this._init();
}
+/**
+ * @constructor
+ */
+function HeapSnapshotMetainfo()
+{
+ // New format.
+ this.node_fields = [];
+ this.node_types = [];
+ this.edge_fields = [];
+ this.edge_types = [];
+
+ // Old format.
+ this.fields = [];
+ this.types = [];
+}
+
WebInspector.HeapSnapshot.prototype = {
_init: function()
{
while (srcNodeIndex < onlyNodesLength) {
var firstEdgeIndex = nextNodeFirstEdgeIndex;
var nextNodeIndex = srcNodeIndex + nodeFieldCount;
- var nextNodeFirstEdgeIndex = nextNodeIndex < onlyNodesLength
- ? onlyNodes[nextNodeIndex + firstEdgeIndexOffset]
- : containmentEdges.length;
+ nextNodeFirstEdgeIndex = nextNodeIndex < onlyNodesLength
+ ? onlyNodes[nextNodeIndex + firstEdgeIndexOffset]
+ : containmentEdges.length;
for (var edgeIndex = firstEdgeIndex; edgeIndex < nextNodeFirstEdgeIndex; edgeIndex += edgeFieldsCount) {
var toNodeIndex = containmentEdges[edgeIndex + edgeToNodeOffset];
if (toNodeIndex % nodeFieldCount)
return this._flags[node.nodeIndex];
},
+ /**
+ * @param {String=} filterString
+ */
aggregates: function(sortedIndexes, key, filterString)
{
if (!this._aggregates) {
// Put in the first slot of each dominatedNodes slice the count of entries
// that will be filled.
var firstDominatedNodeIndex = 0;
- for (i = 0; i < this.nodeCount; ++i) {
+ for (var i = 0; i < this.nodeCount; ++i) {
var dominatedCount = dominatedNodes[firstDominatedNodeIndex] = indexArray[i];
indexArray[i] = firstDominatedNodeIndex;
firstDominatedNodeIndex += dominatedCount;
list.push(iter.edge.node.nodeIndex);
}
- var edge = new WebInspector.HeapSnapshotEdge(this);
+ var edge = new WebInspector.HeapSnapshotEdge(this, undefined);
var node = new WebInspector.HeapSnapshotNode(this);
while (list.length) {
var nodeIndex = list.pop();
edge._edges = node.rawEdges;
for (var j = 0; j < edgesCount; ++j) {
edge.edgeIndex = j * this._edgeFieldsCount;
- var nodeIndex = edge.nodeIndex;
+ nodeIndex = edge.nodeIndex;
if (this._flags[nodeIndex] & flag)
continue;
if (edge.isHidden || edge.isInvisible)
}
};
+/**
+ * @constructor
+ * @param {Array.<number>=} unfilteredIterationOrder
+ */
WebInspector.HeapSnapshotFilteredOrderedIterator = function(iterator, filter, unfilteredIterationOrder)
{
this._filter = filter;
return {fieldName1:fieldNames[0], ascending1:fieldNames[1], fieldName2:fieldNames[2], ascending2:fieldNames[3]};
}
+/**
+ * @constructor
+ * @extends {WebInspector.HeapSnapshotFilteredOrderedIterator}
+ */
WebInspector.HeapSnapshotEdgesProvider = function(snapshot, nodeIndex, filter, edgesIter)
{
this.snapshot = snapshot;
WebInspector.HeapSnapshotEdgesProvider.prototype.__proto__ = WebInspector.HeapSnapshotFilteredOrderedIterator.prototype;
+/**
+ * @constructor
+ * @extends {WebInspector.HeapSnapshotFilteredOrderedIterator}
+ * @param {Array.<number>=} nodeIndexes
+ */
WebInspector.HeapSnapshotNodesProvider = function(snapshot, filter, nodeIndexes)
{
this.snapshot = snapshot;
WebInspector.HeapSnapshotNodesProvider.prototype.__proto__ = WebInspector.HeapSnapshotFilteredOrderedIterator.prototype;
+/**
+ * @constructor
+ */
WebInspector.HeapSnapshotsDiff = function(snapshot, className)
{
this._snapshot = snapshot;
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+/**
+ * @constructor
+ * @extends {WebInspector.DataGridNode}
+ */
WebInspector.ProfileDataGridNode = function(profileView, profileNode, owningTree, hasChildren)
{
this.profileView = profileView;
insertChild: function(/*ProfileDataGridNode*/ profileDataGridNode, index)
{
- WebInspector.DataGridNode.prototype.insertChild.call(this, profileDataGridNode, index);
+ var any = /** @type {*} */this;
+ var dataGrid = /** @type {WebInspector.DataGrid} */any;
+ WebInspector.DataGridNode.prototype.insertChild.call(dataGrid, profileDataGridNode, index);
this.childrenByCallUID[profileDataGridNode.callUID] = profileDataGridNode;
},
removeChild: function(/*ProfileDataGridNode*/ profileDataGridNode)
{
- WebInspector.DataGridNode.prototype.removeChild.call(this, profileDataGridNode);
+ var any = /** @type {*} */this;
+ var dataGrid = /** @type {WebInspector.DataGrid} */any;
+ WebInspector.DataGridNode.prototype.removeChild.call(dataGrid, profileDataGridNode);
delete this.childrenByCallUID[profileDataGridNode.callUID];
},
removeChildren: function(/*ProfileDataGridNode*/ profileDataGridNode)
{
- WebInspector.DataGridNode.prototype.removeChildren.call(this);
+ var any = /** @type {*} */this;
+ var dataGrid = /** @type {WebInspector.DataGrid} */any;
+ WebInspector.DataGridNode.prototype.removeChildren.call(dataGrid);
this.childrenByCallUID = {};
},
return this.parent !== this.dataGrid ? this.parent : this.tree;
},
- _populate: function(event)
+ _populate: function()
{
this._sharedPopulate();
WebInspector.ProfileDataGridNode.prototype.__proto__ = WebInspector.DataGridNode.prototype;
+/**
+ * @constructor
+ */
WebInspector.ProfileDataGridTree = function(profileView, profileNode)
{
this.tree = this;
WebInspector.ProfileDataGridTree.propertyComparator = function(/*String*/ property, /*Boolean*/ isAscending)
{
- var comparator = this.propertyComparators[(isAscending ? 1 : 0)][property];
+ var comparator = WebInspector.ProfileDataGridTree.propertyComparators[(isAscending ? 1 : 0)][property];
if (!comparator) {
if (isAscending) {
}
}
- this.propertyComparators[(isAscending ? 1 : 0)][property] = comparator;
+ WebInspector.ProfileDataGridTree.propertyComparators[(isAscending ? 1 : 0)][property] = comparator;
}
return comparator;
// FIXME: Rename the file.
+/**
+ * @constructor
+ * @extends {WebInspector.View}
+ */
WebInspector.CPUProfileView = function(profile)
{
WebInspector.View.call(this);
}
this.dataGrid = new WebInspector.DataGrid(columns);
- this.dataGrid.addEventListener("sorting changed", this._sortData, this);
+ this.dataGrid.addEventListener("sorting changed", this._sortProfile, this);
this.dataGrid.element.addEventListener("mousedown", this._mouseDownInDataGrid.bind(this), true);
this.dataGrid.show(this.element);
this.viewSelectElement.selectedIndex = this._viewType.get() === WebInspector.CPUProfileView._TypeHeavy ? 0 : 1;
this.percentButton = new WebInspector.StatusBarButton("", "percent-time-status-bar-item");
- this.percentButton.addEventListener("click", this._percentClicked.bind(this), false);
+ this.percentButton.addEventListener("click", this._percentClicked, this);
this.focusButton = new WebInspector.StatusBarButton(WebInspector.UIString("Focus selected function."), "focus-profile-node-status-bar-item");
this.focusButton.disabled = true;
- this.focusButton.addEventListener("click", this._focusClicked.bind(this), false);
+ this.focusButton.addEventListener("click", this._focusClicked, this);
this.excludeButton = new WebInspector.StatusBarButton(WebInspector.UIString("Exclude selected function."), "exclude-profile-node-status-bar-item");
this.excludeButton.disabled = true;
- this.excludeButton.addEventListener("click", this._excludeClicked.bind(this), false);
+ this.excludeButton.addEventListener("click", this._excludeClicked, this);
this.resetButton = new WebInspector.StatusBarButton(WebInspector.UIString("Restore all functions."), "reset-profile-status-bar-item");
this.resetButton.visible = false;
- this.resetButton.addEventListener("click", this._resetClicked.bind(this), false);
+ this.resetButton.addEventListener("click", this._resetClicked, this);
this.profile = profile;
this.refresh();
},
- get topDownTree()
- {
- if (!this._topDownTree) {
- this._topDownTree = WebInspector.TopDownTreeFactory.create(this.profile.head);
- this._sortProfile(this._topDownTree);
- }
-
- return this._topDownTree;
- },
-
- get bottomUpTree()
- {
- if (!this._bottomUpTree) {
- this._bottomUpTree = WebInspector.BottomUpTreeFactory.create(this.profile.head);
- this._sortProfile(this._bottomUpTree);
- }
-
- return this._bottomUpTree;
- },
-
willHide: function()
{
this._currentSearchResultIndex = -1;
this.excludeButton.disabled = true;
},
- _sortData: function(event)
- {
- this._sortProfile(this.profile);
- },
-
_sortProfile: function()
{
var sortAscending = this.dataGrid.sortOrder === "ascending";
WebInspector.CPUProfileView.prototype.__proto__ = WebInspector.View.prototype;
+/**
+ * @constructor
+ * @extends {WebInspector.ProfileType}
+ */
WebInspector.CPUProfileType = function()
{
WebInspector.ProfileType.call(this, WebInspector.CPUProfileType.TypeId, WebInspector.UIString("Collect JavaScript CPU Profile"));
const UserInitiatedProfileName = "org.webkit.profiles.user-initiated";
+/**
+ * @constructor
+ */
WebInspector.ProfileType = function(id, name)
{
this._id = id;
return title;
});
+/**
+ * @constructor
+ * @param {string} profileType
+ * @param {string} title
+ * @param {number} uid
+ * @param {boolean} isTemporary
+ */
+WebInspector.ProfileHeader = function(profileType, title, uid, isTemporary)
+{
+ this.typeId = profileType,
+ this.title = title;
+ this.uid = uid;
+ this.isTemporary = isTemporary;
+
+ this.maxJSObjectId = 0;
+}
+
+/**
+ * @constructor
+ * @extends {WebInspector.Panel}
+ */
WebInspector.ProfilesPanel = function()
{
WebInspector.Panel.call(this, "profiles");
this.splitView.mainElement.appendChild(this.profileViews);
this.enableToggleButton = new WebInspector.StatusBarButton("", "enable-toggle-status-bar-item");
- this.enableToggleButton.addEventListener("click", this._toggleProfiling.bind(this), false);
+ this.enableToggleButton.addEventListener("click", this._toggleProfiling, this);
if (!Capabilities.profilerCausesRecompilation)
this.enableToggleButton.element.addStyleClass("hidden");
this.recordButton.addEventListener("click", this.toggleRecordButton, this);
this.clearResultsButton = new WebInspector.StatusBarButton(WebInspector.UIString("Clear all profiles."), "clear-status-bar-item");
- this.clearResultsButton.addEventListener("click", this._clearProfiles.bind(this), false);
+ this.clearResultsButton.addEventListener("click", this._clearProfiles, this);
this.profileViewStatusBarItemsContainer = document.createElement("div");
this.profileViewStatusBarItemsContainer.className = "status-bar-items";
return escape(text) + '/' + escape(profileTypeId);
},
+
+ /**
+ * @param {WebInspector.ProfileHeader} profile
+ */
addProfileHeader: function(profile)
{
if (this.hasTemporaryProfile(profile.typeId))
profile.proxy = snapshotProxy;
profile.sidebarElement.subtitle = Number.bytesToString(snapshotProxy.totalSize);
profile.sidebarElement.wait = false;
- snapshotProxy.worker.startCheckingForLongRunningCalls();
+ var worker = /** @type {WebInspector.HeapSnapshotWorker} */ snapshotProxy.worker;
+ worker.startCheckingForLongRunningCalls();
}
if (proxy.finishLoading(parsed))
profile.sidebarElement.subtitle = WebInspector.UIString("Parsing\u2026");
if (!searchableViews || !searchableViews.length)
return;
- var parentElement = this.viewsContainerElement;
var visibleView = this.visibleView;
- var sortFuction = this.searchResultsSortFunction;
var matchesCountUpdateTimeout = null;
this._totalSearchMatches += searchMatches;
this._searchResults.push(view);
- if (sortFuction)
- this._searchResults.sort(sortFuction);
-
if (this.searchMatchFound)
this.searchMatchFound(view, searchMatches);
{
this.getProfileType(profileType).setRecordingProfile(isProfiling);
if (this.hasTemporaryProfile(profileType) !== isProfiling) {
- if (!this._temporaryRecordingProfile) {
- this._temporaryRecordingProfile = {
- typeId: profileType,
- title: WebInspector.UIString("Recording\u2026"),
- uid: -1,
- isTemporary: true
- };
- }
+ if (!this._temporaryRecordingProfile)
+ this._temporaryRecordingProfile = new WebInspector.ProfileHeader(profileType, WebInspector.UIString("Recording\u2026"), -1, true);
if (isProfiling) {
this.addProfileHeader(this._temporaryRecordingProfile);
if (profileType === WebInspector.CPUProfileType.TypeId)
{
if (!this.hasTemporaryProfile(WebInspector.DetailedHeapshotProfileType.TypeId)) {
if (!this._temporaryRecordingProfile) {
- this._temporaryRecordingProfile = {
- typeId: WebInspector.DetailedHeapshotProfileType.TypeId,
- title: WebInspector.UIString("Snapshotting\u2026"),
- uid: -1,
- isTemporary: true
- };
+ this._temporaryRecordingProfile = new WebInspector.ProfileHeader(
+ WebInspector.DetailedHeapshotProfileType.TypeId,
+ WebInspector.UIString("Snapshotting\u2026"),
+ -1,
+ true);
}
this.addProfileHeader(this._temporaryRecordingProfile);
}
WebInspector.ProfilesPanel.prototype.__proto__ = WebInspector.Panel.prototype;
-
+/**
+ * @constructor
+ * @implements {ProfilerAgent.Dispatcher}
+ */
WebInspector.ProfilerDispatcher = function(profiler)
{
this._profiler = profiler;
this._profiler._reset();
},
+ /**
+ * @param {ProfilerAgent.ProfileHeader} profile
+ */
addProfileHeader: function(profile)
{
- this._profiler.addProfileHeader(profile);
+ this._profiler.addProfileHeader(new WebInspector.ProfileHeader(profile["typeId"], profile["title"], profile["uid"], false));
},
addHeapSnapshotChunk: function(uid, chunk)
}
}
+/**
+ * @constructor
+ * @extends {WebInspector.SidebarTreeElement}
+ */
WebInspector.ProfileSidebarTreeElement = function(profile, titleFormat, className)
{
this.profile = profile;
WebInspector.ProfileSidebarTreeElement.prototype.__proto__ = WebInspector.SidebarTreeElement.prototype;
+/**
+ * @constructor
+ * @extends {WebInspector.SidebarTreeElement}
+ * @param {string} title
+ * @param {string=} subtitle
+ */
WebInspector.ProfileGroupSidebarTreeElement = function(title, subtitle)
{
WebInspector.SidebarTreeElement.call(this, "profile-group-sidebar-tree-item", title, subtitle, null, true);
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+/**
+ * @constructor
+ * @extends {WebInspector.ProfileDataGridNode}
+ */
WebInspector.TopDownProfileDataGridNode = function(/*ProfileView*/ profileView, /*ProfileNode*/ profileNode, /*TopDownProfileDataGridTree*/ owningTree)
{
var hasChildren = (profileNode.children && profileNode.children.length);
WebInspector.TopDownProfileDataGridNode.prototype.__proto__ = WebInspector.ProfileDataGridNode.prototype;
+/**
+ * @constructor
+ * @extends {WebInspector.ProfileDataGridTree}
+ */
WebInspector.TopDownProfileDataGridTree = function(/*ProfileView*/ profileView, /*ProfileNode*/ profileNode)
{
WebInspector.ProfileDataGridTree.call(this, profileView, profileNode);
this._remainingChildren = profileNode.children;
- WebInspector.TopDownProfileDataGridNode.prototype._populate.call(this);
+ var any = /** @type{*} */this;
+ var node = /** @type{WebInspector.ProfileDataGridNode} */
+ WebInspector.TopDownProfileDataGridNode.prototype._populate.call(node);
}
WebInspector.TopDownProfileDataGridTree.prototype = {
var excludedCallUID = profileDataGrideNode.callUID;
- WebInspector.TopDownProfileDataGridNode.prototype._exclude.call(this, excludedCallUID);
+ var any = /** @type{*} */this;
+ var node = /** @type{WebInspector.ProfileDataGridNode} */
+ WebInspector.TopDownProfileDataGridNode.prototype._exclude.call(node, excludedCallUID);
if (this.lastComparator)
this.sort(this.lastComparator, true);
Array.prototype.keySet = function() {}
/** @return {number} */
Array.prototype.upperBound = function(anchor) {}
+/** @return {number} */
+Array.prototype.binaryIndexOf = function(anchor) {}
+Array.prototype.sortRange = function(comparator, leftBound, rightBound, k) {}
DOMApplicationCache.prototype.UNCACHED = 0;
WebInspector.SourceJavaScriptTokenizer = {}
WebInspector.SourceJavaScriptTokenizer.Keywords = {}
+
+/** @constructor */
+WebInspector.CSSSelectorProfileType = function() {}
+/**
+ * @constructor
+ * @extends {WebInspector.Object}
+ */
+WebInspector.HeapSnapshotWorker = function() {}
+WebInspector.HeapSnapshotWorker.prototype.createObject = function(type) {}
+WebInspector.HeapSnapshotWorker.prototype.startCheckingForLongRunningCalls = function() {}
+
border-spacing: 12px 2px;
}
-div.retaining-paths-view td.path-column div:hover {
- text-decoration: underline;
- color: blue;
-}
-
.cycled-ancessor-node {
opacity: 0.6;
}