Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 /** | 5 /** |
| 6 * @constructor | 6 * @constructor |
| 7 * @param {!WebInspector.NetworkLogView} networkLogView | 7 * @param {!WebInspector.NetworkLogView} networkLogView |
| 8 * @param {!WebInspector.Setting} networkLogLargeRowsSetting | 8 * @param {!WebInspector.Setting} networkLogLargeRowsSetting |
| 9 */ | 9 */ |
| 10 WebInspector.NetworkLogViewColumns = function(networkLogView, networkLogLargeRow sSetting) | 10 WebInspector.NetworkLogViewColumns = function(networkLogView, networkLogLargeRow sSetting) |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 328 }, | 328 }, |
| 329 { | 329 { |
| 330 id: "latency", | 330 id: "latency", |
| 331 title: WebInspector.UIString("Timeline \u2013 Latency"), | 331 title: WebInspector.UIString("Timeline \u2013 Latency"), |
| 332 sort: WebInspector.DataGrid.Order.Descending, | 332 sort: WebInspector.DataGrid.Order.Descending, |
| 333 sortingFunction: WebInspector.NetworkDataGridNode.RequestPro pertyComparator.bind(null, "latency"), | 333 sortingFunction: WebInspector.NetworkDataGridNode.RequestPro pertyComparator.bind(null, "latency"), |
| 334 calculator: WebInspector.NetworkLogViewColumns._calculatorTy pes.Duration | 334 calculator: WebInspector.NetworkLogViewColumns._calculatorTy pes.Duration |
| 335 } | 335 } |
| 336 ] | 336 ] |
| 337 } | 337 } |
| 338 }, | 338 } |
| 339 ]; | 339 ]; |
| 340 | 340 |
| 341 (function() | |
|
dgozman
2016/10/07 21:39:57
Place this in constructor.
allada
2016/10/08 00:13:32
Done.
| |
| 342 { | |
| 343 if (Runtime.experiments.isEnabled("networkCanvasTimeline")) { | |
| 344 var timelineColumn = WebInspector.NetworkLogViewColumns._defaultColumns. find(columnConfig => columnConfig.id === "timeline"); | |
| 345 timelineColumn.visible = false; | |
| 346 timelineColumn.hideable = true; | |
| 347 timelineColumn.sortConfig = { | |
| 348 sortingFunction: WebInspector.NetworkDataGridNode.RequestPropertyCom parator.bind(null, "startTime") | |
| 349 }; | |
| 350 delete timelineColumn.sortConfig.entries; | |
|
dgozman
2016/10/07 21:39:57
This is not needed - you've just assigned to sortC
allada
2016/10/08 00:13:32
Done.
| |
| 351 } | |
| 352 })(); | |
| 353 | |
| 341 /** | 354 /** |
| 342 * @param {!WebInspector.NetworkLogViewColumns.Descriptor} columnConfig | 355 * @param {!WebInspector.NetworkLogViewColumns.Descriptor} columnConfig |
| 343 * @return {!WebInspector.DataGrid.ColumnDescriptor} | 356 * @return {!WebInspector.DataGrid.ColumnDescriptor} |
| 344 */ | 357 */ |
| 345 WebInspector.NetworkLogViewColumns._convertToDataGridDescriptor = function(colum nConfig) | 358 WebInspector.NetworkLogViewColumns._convertToDataGridDescriptor = function(colum nConfig) |
| 346 { | 359 { |
| 347 return /** @type {!WebInspector.DataGrid.ColumnDescriptor} */ ({ | 360 return /** @type {!WebInspector.DataGrid.ColumnDescriptor} */ ({ |
| 348 id: columnConfig.id, | 361 id: columnConfig.id, |
| 349 title: columnConfig.title, | 362 title: columnConfig.title, |
| 350 sortable: columnConfig.sortable, | 363 sortable: columnConfig.sortable, |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 398 this._dataGrid = new WebInspector.SortableDataGrid(this._columns.map(Web Inspector.NetworkLogViewColumns._convertToDataGridDescriptor)); | 411 this._dataGrid = new WebInspector.SortableDataGrid(this._columns.map(Web Inspector.NetworkLogViewColumns._convertToDataGridDescriptor)); |
| 399 | 412 |
| 400 this._dataGrid.asWidget().show(this._networkLogView.element); | 413 this._dataGrid.asWidget().show(this._networkLogView.element); |
| 401 | 414 |
| 402 this._updateColumns(); | 415 this._updateColumns(); |
| 403 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.SortingChan ged, this._sortHandler, this); | 416 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.SortingChan ged, this._sortHandler, this); |
| 404 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.ColumnsResi zed, this.updateDividersIfNeeded, this); | 417 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.ColumnsResi zed, this.updateDividersIfNeeded, this); |
| 405 | 418 |
| 406 this._timelineGrid = new WebInspector.TimelineGrid(); | 419 this._timelineGrid = new WebInspector.TimelineGrid(); |
| 407 this._timelineGrid.element.classList.add("network-timeline-grid"); | 420 this._timelineGrid.element.classList.add("network-timeline-grid"); |
| 408 this._dataGrid.element.appendChild(this._timelineGrid.element); | 421 if (!Runtime.experiments.isEnabled("networkCanvasTimeline")) |
| 422 this._dataGrid.element.appendChild(this._timelineGrid.element); | |
| 423 | |
| 409 this._setupDropdownColumns(); | 424 this._setupDropdownColumns(); |
| 410 | 425 |
| 411 this._dataGrid.markColumnAsSortedBy(WebInspector.NetworkLogViewColumns._ initialSortColumn, WebInspector.DataGrid.Order.Ascending); | 426 this._dataGrid.markColumnAsSortedBy(WebInspector.NetworkLogViewColumns._ initialSortColumn, WebInspector.DataGrid.Order.Ascending); |
| 412 | 427 |
| 413 this._updateRowsSize(); | 428 this._updateRowsSize(); |
| 414 | 429 |
| 415 return this._dataGrid; | 430 return this._dataGrid; |
| 416 }, | 431 }, |
| 417 | 432 |
| 418 _setupDropdownColumns: function() | 433 _setupDropdownColumns: function() |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 684 if (!oldColumnConfig || (currentColumnConfig && oldHeaderId !== newHeade rId)) | 699 if (!oldColumnConfig || (currentColumnConfig && oldHeaderId !== newHeade rId)) |
| 685 return false; | 700 return false; |
| 686 | 701 |
| 687 this._removeCustomHeader(oldHeaderId); | 702 this._removeCustomHeader(oldHeaderId); |
| 688 this._addCustomHeader(newHeaderTitle, newHeaderId, oldIndex); | 703 this._addCustomHeader(newHeaderTitle, newHeaderId, oldIndex); |
| 689 return true; | 704 return true; |
| 690 }, | 705 }, |
| 691 | 706 |
| 692 updateDividersIfNeeded: function() | 707 updateDividersIfNeeded: function() |
| 693 { | 708 { |
| 709 if (Runtime.experiments.isEnabled("networkCanvasTimeline")) | |
| 710 return; | |
| 694 if (!this._networkLogView.isShowing()) { | 711 if (!this._networkLogView.isShowing()) { |
| 695 this._networkLogView.scheduleRefresh(); | 712 this._networkLogView.scheduleRefresh(); |
| 696 return; | 713 return; |
| 697 } | 714 } |
| 698 | 715 |
| 699 var timelineOffset = this._dataGrid.columnOffset("timeline"); | 716 var timelineOffset = this._dataGrid.columnOffset("timeline"); |
| 700 // Position timline grid location. | 717 // Position timline grid location. |
| 701 if (timelineOffset) | 718 if (timelineOffset) |
| 702 this._timelineGrid.element.style.left = timelineOffset + "px"; | 719 this._timelineGrid.element.style.left = timelineOffset + "px"; |
| 703 | 720 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 758 { | 775 { |
| 759 this._popupLinkifier.reset(); | 776 this._popupLinkifier.reset(); |
| 760 }, | 777 }, |
| 761 | 778 |
| 762 /** | 779 /** |
| 763 * @param {!Array<number>} times | 780 * @param {!Array<number>} times |
| 764 * @param {string} className | 781 * @param {string} className |
| 765 */ | 782 */ |
| 766 addEventDividers: function(times, className) | 783 addEventDividers: function(times, className) |
| 767 { | 784 { |
| 785 if (Runtime.experiments.isEnabled("networkCanvasTimeline")) | |
| 786 return; | |
| 768 for (var i = 0; i < times.length; ++i) { | 787 for (var i = 0; i < times.length; ++i) { |
| 769 var element = createElementWithClass("div", "network-event-divider " + className); | 788 var element = createElementWithClass("div", "network-event-divider " + className); |
| 770 this._timelineGrid.addEventDivider(element); | 789 this._timelineGrid.addEventDivider(element); |
| 771 this._eventDividers.push({time: times[i], element: element}); | 790 this._eventDividers.push({time: times[i], element: element}); |
| 772 } | 791 } |
| 773 // Update event dividers immediately | 792 // Update event dividers immediately |
| 774 this._updateEventDividers(); | 793 this._updateEventDividers(); |
| 775 // Schedule refresh in case dividers change the calculator span. | 794 // Schedule refresh in case dividers change the calculator span. |
| 776 this._networkLogView.scheduleRefresh(); | 795 this._networkLogView.scheduleRefresh(); |
| 777 }, | 796 }, |
| 778 | 797 |
| 779 _updateEventDividers: function() | 798 _updateEventDividers: function() |
| 780 { | 799 { |
| 800 if (Runtime.experiments.isEnabled("networkCanvasTimeline")) | |
| 801 return; | |
| 781 var calculator = this._calculatorsMap.get(WebInspector.NetworkLogViewCol umns._calculatorTypes.Time); | 802 var calculator = this._calculatorsMap.get(WebInspector.NetworkLogViewCol umns._calculatorTypes.Time); |
| 782 for (var divider of this._eventDividers) { | 803 for (var divider of this._eventDividers) { |
| 783 var timePercent = calculator.computePercentageFromEventTime(divider. time); | 804 var timePercent = calculator.computePercentageFromEventTime(divider. time); |
| 784 divider.element.classList.toggle("invisible", timePercent < 0); | 805 divider.element.classList.toggle("invisible", timePercent < 0); |
| 785 divider.element.style.left = timePercent + "%"; | 806 divider.element.style.left = timePercent + "%"; |
| 786 } | 807 } |
| 787 }, | 808 }, |
| 788 | 809 |
| 789 hideEventDividers: function() | 810 hideEventDividers: function() |
| 790 { | 811 { |
| 812 if (Runtime.experiments.isEnabled("networkCanvasTimeline")) | |
| 813 return; | |
| 791 this._timelineGrid.hideEventDividers(); | 814 this._timelineGrid.hideEventDividers(); |
| 792 }, | 815 }, |
| 793 | 816 |
| 794 showEventDividers: function() | 817 showEventDividers: function() |
| 795 { | 818 { |
| 819 if (Runtime.experiments.isEnabled("networkCanvasTimeline")) | |
| 820 return; | |
| 796 this._timelineGrid.showEventDividers(); | 821 this._timelineGrid.showEventDividers(); |
| 797 }, | 822 }, |
| 798 | 823 |
| 799 _updateRowsSize: function() | 824 _updateRowsSize: function() |
| 800 { | 825 { |
| 826 if (Runtime.experiments.isEnabled("networkCanvasTimeline")) | |
| 827 return; | |
| 801 this._timelineGrid.element.classList.toggle("small", !this._networkLogLa rgeRowsSetting.get()); | 828 this._timelineGrid.element.classList.toggle("small", !this._networkLogLa rgeRowsSetting.get()); |
| 802 } | 829 } |
| 803 } | 830 } |
| OLD | NEW |