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

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

Issue 2698743003: [Devtools] Prepared network panel for Group Lookup Interface (Closed)
Patch Set: [Devtools] Prepared network panel for Group Lookup Interface Created 3 years, 10 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 /* 1 /*
2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2008, 2009 Anthony Ricaud <rik@webkit.org> 3 * Copyright (C) 2008, 2009 Anthony Ricaud <rik@webkit.org>
4 * Copyright (C) 2011 Google Inc. All rights reserved. 4 * Copyright (C) 2011 Google Inc. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 9 *
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 this._progressBarContainer = progressBarContainer; 50 this._progressBarContainer = progressBarContainer;
51 this._networkLogLargeRowsSetting = networkLogLargeRowsSetting; 51 this._networkLogLargeRowsSetting = networkLogLargeRowsSetting;
52 this._networkLogLargeRowsSetting.addChangeListener(updateRowHeight.bind(this ), this); 52 this._networkLogLargeRowsSetting.addChangeListener(updateRowHeight.bind(this ), this);
53 53
54 /** @type {!Network.NetworkTransferTimeCalculator} */ 54 /** @type {!Network.NetworkTransferTimeCalculator} */
55 this._timeCalculator = new Network.NetworkTransferTimeCalculator(); 55 this._timeCalculator = new Network.NetworkTransferTimeCalculator();
56 /** @type {!Network.NetworkTransferDurationCalculator} */ 56 /** @type {!Network.NetworkTransferDurationCalculator} */
57 this._durationCalculator = new Network.NetworkTransferDurationCalculator(); 57 this._durationCalculator = new Network.NetworkTransferDurationCalculator();
58 this._calculator = this._timeCalculator; 58 this._calculator = this._timeCalculator;
59 59
60 /** @type {?Network.NetworkGroupLookupInterface} */
61 this._activeGroupLookup = null;
62
60 /** 63 /**
61 * @this {Network.NetworkLogView} 64 * @this {Network.NetworkLogView}
62 */ 65 */
63 function updateRowHeight() { 66 function updateRowHeight() {
64 /** @type {number} */ 67 /** @type {number} */
65 this._rowHeight = !!this._networkLogLargeRowsSetting.get() ? 41 : 21; 68 this._rowHeight = !!this._networkLogLargeRowsSetting.get() ? 41 : 21;
66 } 69 }
67 updateRowHeight.call(this); 70 updateRowHeight.call(this);
68 71
69 this._columns = new Network.NetworkLogViewColumns( 72 this._columns = new Network.NetworkLogViewColumns(
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 */ 341 */
339 static _requestTimeFilter(windowStart, windowEnd, request) { 342 static _requestTimeFilter(windowStart, windowEnd, request) {
340 if (request.issueTime() > windowEnd) 343 if (request.issueTime() > windowEnd)
341 return false; 344 return false;
342 if (request.endTime !== -1 && request.endTime < windowStart) 345 if (request.endTime !== -1 && request.endTime < windowStart)
343 return false; 346 return false;
344 return true; 347 return true;
345 } 348 }
346 349
347 /** 350 /**
351 * @param {?Network.NetworkGroupLookupInterface} grouping
352 */
353 setGrouping(grouping) {
354 this._activeGroupLookup = grouping;
355 this._invalidateAllItems();
356 }
357
358 /**
348 * @param {!SDK.NetworkRequest} request 359 * @param {!SDK.NetworkRequest} request
349 * @return {?Network.NetworkRequestNode} 360 * @return {?Network.NetworkRequestNode}
350 */ 361 */
351 nodeForRequest(request) { 362 nodeForRequest(request) {
352 return this._nodesByRequestId.get(request.requestId()); 363 return this._nodesByRequestId.get(request.requestId());
353 } 364 }
354 365
355 /** 366 /**
356 * @return {number} 367 * @return {number}
357 */ 368 */
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
839 850
840 this._staleRequestIds = {}; 851 this._staleRequestIds = {};
841 this._updateSummaryBar(); 852 this._updateSummaryBar();
842 853
843 if (nodesToInsert.size) 854 if (nodesToInsert.size)
844 this._columns.sortByCurrentColumn(); 855 this._columns.sortByCurrentColumn();
845 } 856 }
846 857
847 /** 858 /**
848 * @param {!Network.NetworkRequestNode} node 859 * @param {!Network.NetworkRequestNode} node
849 * @return {!Network.NetworkNode} 860 * @return {?Network.NetworkNode}
850 */ 861 */
851 _parentNodeForInsert(node) { 862 _parentNodeForInsert(node) {
852 if (!Runtime.experiments.isEnabled('networkGroupingRequests')) 863 if (!this._activeGroupLookup)
853 return /** @type {!Network.NetworkNode} */ (this._dataGrid.rootNode()); 864 return this._dataGrid.rootNode();
854 865
855 var request = node.request(); 866 var groupName = this._activeGroupLookup.lookup(node.request());
856 // TODO(allada) Make this dynamic and allow multiple grouping types. 867 if (!groupName)
857 var groupKey = request.connectionId; 868 return this._dataGrid.rootNode();
858 var group = this._nodeGroups.get(groupKey); 869
870 var group = this._nodeGroups.get(groupName);
859 if (group) 871 if (group)
860 return group; 872 return group;
861 873 group = new Network.NetworkGroupNode(this, groupName);
862 var parsedURL = request.url().asParsedURL(); 874 this._nodeGroups.set(groupName, group);
863 var host = '';
864 if (parsedURL)
865 host = parsedURL.host;
866 group = new Network.NetworkGroupNode(this, host + ' - ' + groupKey);
867 this._nodeGroups.set(groupKey, group);
868 return group; 875 return group;
869 } 876 }
870 877
871 reset() { 878 reset() {
872 this._requestWithHighlightedInitiators = null; 879 this._requestWithHighlightedInitiators = null;
873 this.dispatchEventToListeners(Network.NetworkLogView.Events.RequestSelected, null); 880 this.dispatchEventToListeners(Network.NetworkLogView.Events.RequestSelected, null);
874 881
875 this._clearSearchMatchedList(); 882 this._clearSearchMatchedList();
876 883
877 this._setHoveredNode(null); 884 this._setHoveredNode(null);
(...skipping 894 matching lines...) Expand 10 before | Expand all | Expand 10 after
1772 Running: 'running', 1779 Running: 'running',
1773 FromCache: 'from-cache' 1780 FromCache: 'from-cache'
1774 }; 1781 };
1775 1782
1776 /** @type {!Array<string>} */ 1783 /** @type {!Array<string>} */
1777 Network.NetworkLogView._searchKeys = 1784 Network.NetworkLogView._searchKeys =
1778 Object.keys(Network.NetworkLogView.FilterType).map(key => Network.NetworkLog View.FilterType[key]); 1785 Object.keys(Network.NetworkLogView.FilterType).map(key => Network.NetworkLog View.FilterType[key]);
1779 1786
1780 /** @typedef {function(!SDK.NetworkRequest): boolean} */ 1787 /** @typedef {function(!SDK.NetworkRequest): boolean} */
1781 Network.NetworkLogView.Filter; 1788 Network.NetworkLogView.Filter;
1789
1790 /**
1791 * @interface
1792 */
1793 Network.NetworkGroupLookupInterface = function() {};
1794
1795 Network.NetworkGroupLookupInterface.prototype = {
1796 /**
1797 * @param {!SDK.NetworkRequest} request
1798 * @return {?string}
1799 */
1800 lookup(request) {}
1801 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698