Chromium Code Reviews| Index: Source/devtools/front_end/network/ResourceWebSocketFrameView.js |
| diff --git a/Source/devtools/front_end/network/ResourceWebSocketFrameView.js b/Source/devtools/front_end/network/ResourceWebSocketFrameView.js |
| index 2f854a3d3f5fa4318c0e301949b1d84502029c11..41a490c2cf651af20b6a942b207205f1cd98aa1e 100644 |
| --- a/Source/devtools/front_end/network/ResourceWebSocketFrameView.js |
| +++ b/Source/devtools/front_end/network/ResourceWebSocketFrameView.js |
| @@ -31,15 +31,17 @@ WebInspector.ResourceWebSocketFrameView = function(request) |
| var columns = [ |
| {id: "data", title: WebInspector.UIString("Data"), sortable: false, weight: 88, longText: true}, |
| {id: "length", title: WebInspector.UIString("Length"), sortable: false, align: WebInspector.DataGrid.Align.Right, weight: 5}, |
| - {id: "time", title: WebInspector.UIString("Time"), weight: 7} |
| + {id: "time", title: WebInspector.UIString("Time"), sortable: true, weight: 7} |
| ] |
| this._dataGrid = new WebInspector.SortableDataGrid(columns, undefined, undefined, undefined, this._onContextMenu.bind(this)); |
| + this._dataGrid.setStickToBottom(true); |
| this._dataGrid.setCellClass("websocket-frame-view-td"); |
| - var comparator = /** @type {!WebInspector.SortableDataGrid.NodeComparator} */ (WebInspector.ResourceWebSocketFrameNodeTimeComparator); |
| - this._dataGrid.sortNodes(comparator, true); |
| + this._timeComparator = /** @type {!WebInspector.SortableDataGrid.NodeComparator} */ (WebInspector.ResourceWebSocketFrameNodeTimeComparator); |
| + this._dataGrid.sortNodes(this._timeComparator, false); |
| + this._dataGrid.markColumnAsSortedBy("time", WebInspector.DataGrid.Order.Ascending); |
| + this._dataGrid.addEventListener(WebInspector.DataGrid.Events.SortingChanged, this._sortItems, this); |
| - this.refresh(); |
| this._dataGrid.setName("ResourceWebSocketFrameView"); |
| this._dataGrid.show(this.element); |
| } |
| @@ -81,20 +83,34 @@ WebInspector.ResourceWebSocketFrameView.opCodeDescription = function(opCode, mas |
| } |
| WebInspector.ResourceWebSocketFrameView.prototype = { |
| + wasShown: function() |
| + { |
| + this.refresh(); |
| + this._request.addEventListener(WebInspector.NetworkRequest.Events.WebsocketFrameAdded, this._frameAdded, this); |
| + }, |
| + |
| + willHide: function() |
| + { |
| + this._request.removeEventListener(WebInspector.NetworkRequest.Events.WebsocketFrameAdded, this._frameAdded, this); |
| + }, |
| + |
| + /** |
| + * @param {!WebInspector.Event} event |
| + */ |
| + _frameAdded: function(event) |
| + { |
| + var frame = /** @type {!WebInspector.NetworkRequest.WebSocketFrame} */ (event.data); |
| + this._dataGrid.insertChild(new WebInspector.ResourceWebSocketFrameNode(frame)); |
| + }, |
| + |
| refresh: function() |
| { |
| this._dataGrid.rootNode().removeChildren(); |
| var frames = this._request.frames(); |
| - for (var i = frames.length - 1; i >= 0; --i) |
| + for (var i = 0; i < frames.length; ++i) |
| this._dataGrid.insertChild(new WebInspector.ResourceWebSocketFrameNode(frames[i])); |
| }, |
| - show: function(parentElement, insertBefore) |
| - { |
| - this.refresh(); |
| - WebInspector.View.prototype.show.call(this, parentElement, insertBefore); |
| - }, |
| - |
| /** |
| * @param {!WebInspector.ContextMenu} contextMenu |
| * @param {!WebInspector.DataGridNode} node |
| @@ -112,6 +128,11 @@ WebInspector.ResourceWebSocketFrameView.prototype = { |
| InspectorFrontendHost.copyText(row.data); |
| }, |
| + _sortItems: function() |
| + { |
| + this._dataGrid.sortNodes(this._timeComparator, !this._dataGrid.isSortOrderAscending()); |
| + }, |
| + |
| __proto__: WebInspector.VBox.prototype |
| } |
| @@ -145,6 +166,14 @@ WebInspector.ResourceWebSocketFrameNode.prototype = { |
| WebInspector.SortableDataGridNode.prototype.createCells.call(this); |
| }, |
| + /** |
| + * @override |
| + * @return {number} |
| + */ |
| + nodeSelfHeight: function() { |
|
vsevik
2014/10/16 08:03:32
{ on the next line
eustas
2014/10/16 08:32:05
Done.
|
| + return 17; |
| + }, |
| + |
| __proto__: WebInspector.SortableDataGridNode.prototype |
| } |