Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(46)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/network/NetworkLogViewColumns.js

Issue 2876983002: DevTools: group by frame, not product in the network panel. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 this._persistantSettings.set(saveableSettings); 344 this._persistantSettings.set(saveableSettings);
367 } 345 }
368 346
369 _loadCustomColumnsAndSettings() { 347 _loadCustomColumnsAndSettings() {
370 var savedSettings = this._persistantSettings.get(); 348 var savedSettings = this._persistantSettings.get();
371 var columnIds = Object.keys(savedSettings); 349 var columnIds = Object.keys(savedSettings);
372 for (var columnId of columnIds) { 350 for (var columnId of columnIds) {
373 var setting = savedSettings[columnId]; 351 var setting = savedSettings[columnId];
374 var columnConfig = this._columns.find(columnConfig => columnConfig.id === columnId); 352 var columnConfig = this._columns.find(columnConfig => columnConfig.id === columnId);
375 if (!columnConfig) 353 if (!columnConfig)
376 columnConfig = this._addCustomHeader(setting.title, columnId); 354 continue;
allada 2017/05/11 23:58:36 This should still be needed.
pfeldman 2017/05/12 23:16:20 What does it do? I noticed that it only breaks thi
377 if (columnConfig.hideable && typeof setting.visible === 'boolean') 355 if (columnConfig.hideable && typeof setting.visible === 'boolean')
378 columnConfig.visible = !!setting.visible; 356 columnConfig.visible = !!setting.visible;
379 if (typeof setting.title === 'string') 357 if (typeof setting.title === 'string')
380 columnConfig.title = setting.title; 358 columnConfig.title = setting.title;
381 } 359 }
382 } 360 }
383 361
384 /** 362 /**
385 * @param {string} title 363 * @param {string} title
386 * @param {string} subtitle 364 * @param {string} subtitle
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 if (hoveredNode instanceof Network.FrameGroupNode) {
allada 2017/05/11 23:58:36 Lets only have the popover for the name column.
allada 2017/05/11 23:58:36 Also, can we add a TODO to not use instanceof and
pfeldman 2017/05/12 23:16:20 I'll have a new patch for the rest...
558 if (anchor) { 536 var frameNode = /** @type {!Network.FrameGroupNode} */ (hoveredNode);
559 return { 537 return {box: event.target.boxInWindow(), show: frameNode.handleProductPopo ver.bind(frameNode)};
560 box: anchor.boxInWindow(),
561 show: hoveredNode.handleProductPopover.bind(hoveredNode),
562 hide: this._popupLinkifier.reset.bind(this._popupLinkifier)
563 };
564 } 538 }
565 539
566 anchor = event.target.enclosingNodeOrSelfWithClass('network-script-initiated '); 540 var anchor = event.target.enclosingNodeOrSelfWithClass('network-script-initi ated');
567 if (!anchor) 541 if (!anchor)
568 return null; 542 return null;
569 var request = hoveredNode.request(); 543 var request = hoveredNode.request();
570 var initiator = request ? request.initiator() : null; 544 var initiator = request ? request.initiator() : null;
571 if (!initiator || !initiator.stack) 545 if (!initiator || !initiator.stack)
572 return null; 546 return null;
573 return { 547 return {
574 box: anchor.boxInWindow(), 548 box: anchor.boxInWindow(),
575 show: popover => { 549 show: popover => {
576 var content = Components.DOMPresentationUtils.buildStackTracePreviewCont ents( 550 var content = Components.DOMPresentationUtils.buildStackTracePreviewCont ents(
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 this._redrawWaterfallColumn(); 596 this._redrawWaterfallColumn();
623 } 597 }
624 598
625 clearFilmStripFrame() { 599 clearFilmStripFrame() {
626 this._eventDividers.delete(Network.NetworkLogViewColumns._filmStripDividerCo lor); 600 this._eventDividers.delete(Network.NetworkLogViewColumns._filmStripDividerCo lor);
627 this._redrawWaterfallColumn(); 601 this._redrawWaterfallColumn();
628 } 602 }
629 }; 603 };
630 604
631 Network.NetworkLogViewColumns._initialSortColumn = 'waterfall'; 605 Network.NetworkLogViewColumns._initialSortColumn = 'waterfall';
632 /** @type {?ProductRegistry.Registry} */
633 Network.NetworkRequestNode._productRegistryInstance = null;
634 606
635 /** 607 /**
636 * @typedef {{ 608 * @typedef {{
637 * id: string, 609 * id: string,
638 * title: string, 610 * title: string,
639 * titleDOMFragment: (!DocumentFragment|undefined), 611 * titleDOMFragment: (!DocumentFragment|undefined),
640 * subtitle: (string|null), 612 * subtitle: (string|null),
641 * visible: boolean, 613 * visible: boolean,
642 * weight: number, 614 * weight: number,
643 * hideable: boolean, 615 * hideable: boolean,
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
836 /** 808 /**
837 * @enum {string} 809 * @enum {string}
838 */ 810 */
839 Network.NetworkLogViewColumns.WaterfallSortIds = { 811 Network.NetworkLogViewColumns.WaterfallSortIds = {
840 StartTime: 'startTime', 812 StartTime: 'startTime',
841 ResponseTime: 'responseReceivedTime', 813 ResponseTime: 'responseReceivedTime',
842 EndTime: 'endTime', 814 EndTime: 'endTime',
843 Duration: 'duration', 815 Duration: 'duration',
844 Latency: 'latency' 816 Latency: 'latency'
845 }; 817 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698