Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 * @unrestricted | 5 * @unrestricted |
| 6 */ | 6 */ |
| 7 Timeline.TimelineTreeView = class extends UI.VBox { | 7 Timeline.TimelineTreeView = class extends UI.VBox { |
| 8 constructor() { | 8 constructor() { |
| 9 super(); | 9 super(); |
| 10 this.element.classList.add('timeline-tree-view'); | 10 this.element.classList.add('timeline-tree-view'); |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 34 | 34 |
| 35 var columns = /** @type {!Array<!UI.DataGrid.ColumnDescriptor>} */ ([]); | 35 var columns = /** @type {!Array<!UI.DataGrid.ColumnDescriptor>} */ ([]); |
| 36 this._populateColumns(columns); | 36 this._populateColumns(columns); |
| 37 | 37 |
| 38 var mainView = new UI.VBox(); | 38 var mainView = new UI.VBox(); |
| 39 this._populateToolbar(mainView.element); | 39 this._populateToolbar(mainView.element); |
| 40 this._dataGrid = new UI.SortableDataGrid(columns); | 40 this._dataGrid = new UI.SortableDataGrid(columns); |
| 41 this._dataGrid.addEventListener(UI.DataGrid.Events.SortingChanged, this._sor tingChanged, this); | 41 this._dataGrid.addEventListener(UI.DataGrid.Events.SortingChanged, this._sor tingChanged, this); |
| 42 this._dataGrid.element.addEventListener('mousemove', this._onMouseMove.bind( this), true); | 42 this._dataGrid.element.addEventListener('mousemove', this._onMouseMove.bind( this), true); |
| 43 this._dataGrid.setResizeMethod(UI.DataGrid.ResizeMethod.Last); | 43 this._dataGrid.setResizeMethod(UI.DataGrid.ResizeMethod.Last); |
| 44 this._dataGrid.setRowContextMenuCallback(this._onContextMenu.bind(this)); | |
| 44 this._dataGrid.asWidget().show(mainView.element); | 45 this._dataGrid.asWidget().show(mainView.element); |
| 45 | 46 |
| 46 this._splitWidget = new UI.SplitWidget(true, true, 'timelineTreeViewDetailsS plitWidget'); | 47 this._splitWidget = new UI.SplitWidget(true, true, 'timelineTreeViewDetailsS plitWidget'); |
| 47 this._splitWidget.show(this.element); | 48 this._splitWidget.show(this.element); |
| 48 this._splitWidget.setMainWidget(mainView); | 49 this._splitWidget.setMainWidget(mainView); |
| 49 | 50 |
| 50 this._detailsView = new UI.VBox(); | 51 this._detailsView = new UI.VBox(); |
| 51 this._detailsView.element.classList.add('timeline-details-view', 'timeline-d etails-view-body'); | 52 this._detailsView.element.classList.add('timeline-details-view', 'timeline-d etails-view-body'); |
| 52 this._splitWidget.setSidebarWidget(this._detailsView); | 53 this._splitWidget.setSidebarWidget(this._detailsView); |
| 53 this._dataGrid.addEventListener(UI.DataGrid.Events.SelectedNode, this._updat eDetailsForSelection, this); | 54 this._dataGrid.addEventListener(UI.DataGrid.Events.SelectedNode, this._updat eDetailsForSelection, this); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 86 _populateToolbar(parent) { | 87 _populateToolbar(parent) { |
| 87 } | 88 } |
| 88 | 89 |
| 89 /** | 90 /** |
| 90 * @param {?TimelineModel.TimelineProfileTree.Node} node | 91 * @param {?TimelineModel.TimelineProfileTree.Node} node |
| 91 */ | 92 */ |
| 92 _onHover(node) { | 93 _onHover(node) { |
| 93 } | 94 } |
| 94 | 95 |
| 95 /** | 96 /** |
| 97 * @param {!UI.ContextMenu} contextMenu | |
| 98 * @param {!TimelineModel.TimelineProfileTree.Node} node | |
| 99 */ | |
| 100 _appendContextMenuItems(contextMenu, node) { | |
|
alph
2016/11/16 02:29:21
We do not start protected functions with _. don't
| |
| 101 } | |
| 102 | |
| 103 /** | |
| 96 * @param {!SDK.TracingModel.Event} event | 104 * @param {!SDK.TracingModel.Event} event |
| 97 * @return {?Element} | 105 * @return {?Element} |
| 98 */ | 106 */ |
| 99 _linkifyLocation(event) { | 107 _linkifyLocation(event) { |
| 100 var target = this._model.targetByEvent(event); | 108 var target = this._model.targetByEvent(event); |
| 101 if (!target) | 109 if (!target) |
| 102 return null; | 110 return null; |
| 103 var frame = TimelineModel.TimelineProfileTree.eventStackFrame(event); | 111 var frame = TimelineModel.TimelineProfileTree.eventStackFrame(event); |
| 104 if (!frame) | 112 if (!frame) |
| 105 return null; | 113 return null; |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 265 this._dataGrid.dataGridNodeFromNode(/** @type {!Node} */ (event.targ et))) : | 273 this._dataGrid.dataGridNodeFromNode(/** @type {!Node} */ (event.targ et))) : |
| 266 null; | 274 null; |
| 267 var profileNode = gridNode && gridNode._profileNode; | 275 var profileNode = gridNode && gridNode._profileNode; |
| 268 if (profileNode === this._lastHoveredProfileNode) | 276 if (profileNode === this._lastHoveredProfileNode) |
| 269 return; | 277 return; |
| 270 this._lastHoveredProfileNode = profileNode; | 278 this._lastHoveredProfileNode = profileNode; |
| 271 this._onHover(profileNode); | 279 this._onHover(profileNode); |
| 272 } | 280 } |
| 273 | 281 |
| 274 /** | 282 /** |
| 283 * @param {!UI.ContextMenu} contextMenu | |
| 284 * @param {!UI.DataGridNode} gridNode | |
| 285 */ | |
| 286 _onContextMenu(contextMenu, gridNode) { | |
| 287 var profileNode = gridNode._profileNode; | |
| 288 if (!profileNode) | |
| 289 return; | |
| 290 this._appendContextMenuItems(contextMenu, profileNode); | |
| 291 } | |
| 292 | |
| 293 /** | |
| 275 * @param {!TimelineModel.TimelineProfileTree.Node} treeNode | 294 * @param {!TimelineModel.TimelineProfileTree.Node} treeNode |
| 276 * @return {?Timeline.TimelineTreeView.GridNode} | 295 * @return {?Timeline.TimelineTreeView.GridNode} |
| 277 */ | 296 */ |
| 278 _dataGridNodeForTreeNode(treeNode) { | 297 _dataGridNodeForTreeNode(treeNode) { |
| 279 return treeNode[Timeline.TimelineTreeView.TreeGridNode._gridNodeSymbol] || n ull; | 298 return treeNode[Timeline.TimelineTreeView.TreeGridNode._gridNodeSymbol] || n ull; |
| 280 } | 299 } |
| 281 }; | 300 }; |
| 282 | 301 |
| 283 | 302 |
| 284 /** | 303 /** |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 643 return groupByDomain.bind(null, true); | 662 return groupByDomain.bind(null, true); |
| 644 case Timeline.AggregatedTimelineTreeView.GroupBy.URL: | 663 case Timeline.AggregatedTimelineTreeView.GroupBy.URL: |
| 645 return groupByURL; | 664 return groupByURL; |
| 646 case Timeline.AggregatedTimelineTreeView.GroupBy.Frame: | 665 case Timeline.AggregatedTimelineTreeView.GroupBy.Frame: |
| 647 return event => TimelineModel.TimelineData.forEvent(event).frameId; | 666 return event => TimelineModel.TimelineData.forEvent(event).frameId; |
| 648 default: | 667 default: |
| 649 console.assert(false, `Unexpected aggregation setting: ${groupBy}`); | 668 console.assert(false, `Unexpected aggregation setting: ${groupBy}`); |
| 650 return () => Symbol('uniqueGroupId'); | 669 return () => Symbol('uniqueGroupId'); |
| 651 } | 670 } |
| 652 } | 671 } |
| 672 /** | |
| 673 * @override | |
| 674 * @param {!UI.ContextMenu} contextMenu | |
| 675 * @param {!TimelineModel.TimelineProfileTree.Node} node | |
| 676 */ | |
| 677 _appendContextMenuItems(contextMenu, node) { | |
| 678 if (this._groupBySetting.get() !== Timeline.AggregatedTimelineTreeView.Group By.Frame) | |
| 679 return; | |
| 680 if (!node.isGroupNode()) | |
| 681 return; | |
| 682 var frame = this._model.pageFrameById(node.id); | |
| 683 if (!frame || !frame.ownerNode) | |
| 684 return; | |
| 685 contextMenu.appendApplicableItems(frame.ownerNode); | |
| 686 } | |
| 653 | 687 |
| 654 /** | 688 /** |
| 655 * @param {string} url | 689 * @param {string} url |
| 656 * @return {boolean} | 690 * @return {boolean} |
| 657 */ | 691 */ |
| 658 static _isExtensionInternalURL(url) { | 692 static _isExtensionInternalURL(url) { |
| 659 return url.startsWith(Timeline.AggregatedTimelineTreeView._extensionInternal Prefix); | 693 return url.startsWith(Timeline.AggregatedTimelineTreeView._extensionInternal Prefix); |
| 660 } | 694 } |
| 661 }; | 695 }; |
| 662 | 696 |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 904 | 938 |
| 905 _onSelectionChanged() { | 939 _onSelectionChanged() { |
| 906 this.dispatchEventToListeners(Timeline.TimelineStackView.Events.SelectionCha nged); | 940 this.dispatchEventToListeners(Timeline.TimelineStackView.Events.SelectionCha nged); |
| 907 } | 941 } |
| 908 }; | 942 }; |
| 909 | 943 |
| 910 /** @enum {symbol} */ | 944 /** @enum {symbol} */ |
| 911 Timeline.TimelineStackView.Events = { | 945 Timeline.TimelineStackView.Events = { |
| 912 SelectionChanged: Symbol('SelectionChanged') | 946 SelectionChanged: Symbol('SelectionChanged') |
| 913 }; | 947 }; |
| OLD | NEW |