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 * @unrestricted | 5 * @unrestricted |
6 */ | 6 */ |
7 Network.NetworkLogViewColumns = class { | 7 Network.NetworkLogViewColumns = class { |
8 /** | 8 /** |
9 * @param {!Network.NetworkLogView} networkLogView | 9 * @param {!Network.NetworkLogView} networkLogView |
10 * @param {!Network.NetworkTransferTimeCalculator} timeCalculator | 10 * @param {!Network.NetworkTransferTimeCalculator} timeCalculator |
(...skipping 14 matching lines...) Expand all Loading... |
25 this._eventDividersShown = false; | 25 this._eventDividersShown = false; |
26 | 26 |
27 this._gridMode = true; | 27 this._gridMode = true; |
28 | 28 |
29 /** @type {!Array.<!Network.NetworkLogViewColumns.Descriptor>} */ | 29 /** @type {!Array.<!Network.NetworkLogViewColumns.Descriptor>} */ |
30 this._columns = []; | 30 this._columns = []; |
31 | 31 |
32 this._waterfallRequestsAreStale = false; | 32 this._waterfallRequestsAreStale = false; |
33 this._waterfallScrollerWidthIsStale = true; | 33 this._waterfallScrollerWidthIsStale = true; |
34 | 34 |
35 /** @type {?ProductRegistry.Registry} */ | |
36 this._productRegistryInstance = null; | |
37 | |
38 /** @type {!Components.Linkifier} */ | 35 /** @type {!Components.Linkifier} */ |
39 this._popupLinkifier = new Components.Linkifier(); | 36 this._popupLinkifier = new Components.Linkifier(); |
40 | 37 |
41 /** @type {!Map<string, !Network.NetworkTimeCalculator>} */ | 38 /** @type {!Map<string, !Network.NetworkTimeCalculator>} */ |
42 this._calculatorsMap = new Map(); | 39 this._calculatorsMap = new Map(); |
43 this._calculatorsMap.set(Network.NetworkLogViewColumns._calculatorTypes.Time
, timeCalculator); | 40 this._calculatorsMap.set(Network.NetworkLogViewColumns._calculatorTypes.Time
, timeCalculator); |
44 this._calculatorsMap.set(Network.NetworkLogViewColumns._calculatorTypes.Dura
tion, durationCalculator); | 41 this._calculatorsMap.set(Network.NetworkLogViewColumns._calculatorTypes.Dura
tion, durationCalculator); |
45 | 42 |
46 this._setupDataGrid(); | 43 this._setupDataGrid(); |
47 this._setupWaterfall(); | 44 this._setupWaterfall(); |
(...skipping 24 matching lines...) Expand all Loading... |
72 | 69 |
73 reset() { | 70 reset() { |
74 if (this._popoverHelper) | 71 if (this._popoverHelper) |
75 this._popoverHelper.hidePopover(); | 72 this._popoverHelper.hidePopover(); |
76 this._eventDividers.clear(); | 73 this._eventDividers.clear(); |
77 } | 74 } |
78 | 75 |
79 _setupDataGrid() { | 76 _setupDataGrid() { |
80 var defaultColumns = Network.NetworkLogViewColumns._defaultColumns; | 77 var defaultColumns = Network.NetworkLogViewColumns._defaultColumns; |
81 | 78 |
82 if (Runtime.experiments.isEnabled('networkGroupingRequests')) { | |
83 defaultColumns.splice(1, 0, /** @type {!Network.NetworkLogViewColumns.Desc
riptor} */ ({ | |
84 id: 'product', | |
85 title: Common.UIString('Product'), | |
86 visible: true | |
87 })); | |
88 } | |
89 | |
90 var defaultColumnConfig = Network.NetworkLogViewColumns._defaultColumnConfig
; | 79 var defaultColumnConfig = Network.NetworkLogViewColumns._defaultColumnConfig
; |
91 | 80 |
92 this._columns = /** @type {!Array<!Network.NetworkLogViewColumns.Descriptor>
} */ ([]); | 81 this._columns = /** @type {!Array<!Network.NetworkLogViewColumns.Descriptor>
} */ ([]); |
93 for (var currentConfigColumn of defaultColumns) { | 82 for (var currentConfigColumn of defaultColumns) { |
94 var columnConfig = /** @type {!Network.NetworkLogViewColumns.Descriptor} *
/ ( | 83 var columnConfig = /** @type {!Network.NetworkLogViewColumns.Descriptor} *
/ ( |
95 Object.assign({}, defaultColumnConfig, currentConfigColumn)); | 84 Object.assign({}, defaultColumnConfig, currentConfigColumn)); |
96 columnConfig.id = columnConfig.id; | 85 columnConfig.id = columnConfig.id; |
97 if (columnConfig.subtitle) | 86 if (columnConfig.subtitle) |
98 columnConfig.titleDOMFragment = this._makeHeaderFragment(columnConfig.ti
tle, columnConfig.subtitle); | 87 columnConfig.titleDOMFragment = this._makeHeaderFragment(columnConfig.ti
tle, columnConfig.subtitle); |
99 this._columns.push(columnConfig); | 88 this._columns.push(columnConfig); |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 if (columnId === 'waterfall') { | 270 if (columnId === 'waterfall') { |
282 if (this._dataGrid.sortOrder() === DataGrid.DataGrid.Order.Ascending) | 271 if (this._dataGrid.sortOrder() === DataGrid.DataGrid.Order.Ascending) |
283 this._waterfallColumnSortIcon.setIconType('smallicon-triangle-up'); | 272 this._waterfallColumnSortIcon.setIconType('smallicon-triangle-up'); |
284 else | 273 else |
285 this._waterfallColumnSortIcon.setIconType('smallicon-triangle-down'); | 274 this._waterfallColumnSortIcon.setIconType('smallicon-triangle-down'); |
286 | 275 |
287 var sortFunction = Network.NetworkRequestNode.RequestPropertyComparator.bi
nd(null, this._activeWaterfallSortId); | 276 var sortFunction = Network.NetworkRequestNode.RequestPropertyComparator.bi
nd(null, this._activeWaterfallSortId); |
288 this._dataGrid.sortNodes(sortFunction, !this._dataGrid.isSortOrderAscendin
g()); | 277 this._dataGrid.sortNodes(sortFunction, !this._dataGrid.isSortOrderAscendin
g()); |
289 this._networkLogView.dataGridSorted(); | 278 this._networkLogView.dataGridSorted(); |
290 return; | 279 return; |
291 } else if (columnId === 'product' && !this._productRegistryInstance) { | |
292 ProductRegistry.instance().then(productRegistry => { | |
293 this._productRegistryInstance = productRegistry; | |
294 var columnConfig = this._columns.find(columnConfig => columnConfig.id ==
= columnId); | |
295 if (!columnConfig) | |
296 return; | |
297 columnConfig.sortingFunction = Network.NetworkRequestNode.ProductCompara
tor.bind(null, productRegistry); | |
298 if (this._dataGrid.sortColumnId() === 'product') | |
299 this._sortHandler(); | |
300 }); | |
301 return; | |
302 } | 280 } |
303 this._waterfallColumnSortIcon.setIconType(''); | 281 this._waterfallColumnSortIcon.setIconType(''); |
304 | 282 |
305 var columnConfig = this._columns.find(columnConfig => columnConfig.id === co
lumnId); | 283 var columnConfig = this._columns.find(columnConfig => columnConfig.id === co
lumnId); |
306 if (!columnConfig || !columnConfig.sortingFunction) | 284 if (!columnConfig || !columnConfig.sortingFunction) |
307 return; | 285 return; |
308 | 286 |
309 this._dataGrid.sortNodes(columnConfig.sortingFunction, !this._dataGrid.isSor
tOrderAscending()); | 287 this._dataGrid.sortNodes(columnConfig.sortingFunction, !this._dataGrid.isSor
tOrderAscending()); |
310 this._networkLogView.dataGridSorted(); | 288 this._networkLogView.dataGridSorted(); |
311 } | 289 } |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 * @param {!Event} event | 525 * @param {!Event} event |
548 * @return {?UI.PopoverRequest} | 526 * @return {?UI.PopoverRequest} |
549 */ | 527 */ |
550 _getPopoverRequest(event) { | 528 _getPopoverRequest(event) { |
551 if (!this._gridMode) | 529 if (!this._gridMode) |
552 return null; | 530 return null; |
553 var hoveredNode = this._networkLogView.hoveredNode(); | 531 var hoveredNode = this._networkLogView.hoveredNode(); |
554 if (!hoveredNode) | 532 if (!hoveredNode) |
555 return null; | 533 return null; |
556 | 534 |
557 var anchor = event.target.enclosingNodeOrSelfWithClass('product-column'); | 535 var anchor = event.target.enclosingNodeOrSelfWithClass('network-script-initi
ated'); |
558 if (anchor) { | |
559 return { | |
560 box: anchor.boxInWindow(), | |
561 show: hoveredNode.handleProductPopover.bind(hoveredNode), | |
562 hide: this._popupLinkifier.reset.bind(this._popupLinkifier) | |
563 }; | |
564 } | |
565 | |
566 anchor = event.target.enclosingNodeOrSelfWithClass('network-script-initiated
'); | |
567 if (!anchor) | 536 if (!anchor) |
568 return null; | 537 return null; |
569 var request = hoveredNode.request(); | 538 var request = hoveredNode.request(); |
570 var initiator = request ? request.initiator() : null; | 539 var initiator = request ? request.initiator() : null; |
571 if (!initiator || !initiator.stack) | 540 if (!initiator || !initiator.stack) |
572 return null; | 541 return null; |
573 return { | 542 return { |
574 box: anchor.boxInWindow(), | 543 box: anchor.boxInWindow(), |
575 show: popover => { | 544 show: popover => { |
576 var content = Components.DOMPresentationUtils.buildStackTracePreviewCont
ents( | 545 var content = Components.DOMPresentationUtils.buildStackTracePreviewCont
ents( |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 this._redrawWaterfallColumn(); | 591 this._redrawWaterfallColumn(); |
623 } | 592 } |
624 | 593 |
625 clearFilmStripFrame() { | 594 clearFilmStripFrame() { |
626 this._eventDividers.delete(Network.NetworkLogViewColumns._filmStripDividerCo
lor); | 595 this._eventDividers.delete(Network.NetworkLogViewColumns._filmStripDividerCo
lor); |
627 this._redrawWaterfallColumn(); | 596 this._redrawWaterfallColumn(); |
628 } | 597 } |
629 }; | 598 }; |
630 | 599 |
631 Network.NetworkLogViewColumns._initialSortColumn = 'waterfall'; | 600 Network.NetworkLogViewColumns._initialSortColumn = 'waterfall'; |
632 /** @type {?ProductRegistry.Registry} */ | |
633 Network.NetworkRequestNode._productRegistryInstance = null; | |
634 | 601 |
635 /** | 602 /** |
636 * @typedef {{ | 603 * @typedef {{ |
637 * id: string, | 604 * id: string, |
638 * title: string, | 605 * title: string, |
639 * titleDOMFragment: (!DocumentFragment|undefined), | 606 * titleDOMFragment: (!DocumentFragment|undefined), |
640 * subtitle: (string|null), | 607 * subtitle: (string|null), |
641 * visible: boolean, | 608 * visible: boolean, |
642 * weight: number, | 609 * weight: number, |
643 * hideable: boolean, | 610 * hideable: boolean, |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
836 /** | 803 /** |
837 * @enum {string} | 804 * @enum {string} |
838 */ | 805 */ |
839 Network.NetworkLogViewColumns.WaterfallSortIds = { | 806 Network.NetworkLogViewColumns.WaterfallSortIds = { |
840 StartTime: 'startTime', | 807 StartTime: 'startTime', |
841 ResponseTime: 'responseReceivedTime', | 808 ResponseTime: 'responseReceivedTime', |
842 EndTime: 'endTime', | 809 EndTime: 'endTime', |
843 Duration: 'duration', | 810 Duration: 'duration', |
844 Latency: 'latency' | 811 Latency: 'latency' |
845 }; | 812 }; |
OLD | NEW |