Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 64 /** @type {number} */ | 64 /** @type {number} */ |
| 65 this._rowHeight = !!this._networkLogLargeRowsSetting.get() ? 41 : 21; | 65 this._rowHeight = !!this._networkLogLargeRowsSetting.get() ? 41 : 21; |
| 66 } | 66 } |
| 67 updateRowHeight.call(this); | 67 updateRowHeight.call(this); |
| 68 | 68 |
| 69 this._columns = new Network.NetworkLogViewColumns( | 69 this._columns = new Network.NetworkLogViewColumns( |
| 70 this, this._timeCalculator, this._durationCalculator, networkLogLargeRow sSetting); | 70 this, this._timeCalculator, this._durationCalculator, networkLogLargeRow sSetting); |
| 71 | 71 |
| 72 /** @type {!Map.<string, !Network.NetworkRequestNode>} */ | 72 /** @type {!Map.<string, !Network.NetworkRequestNode>} */ |
| 73 this._nodesByRequestId = new Map(); | 73 this._nodesByRequestId = new Map(); |
| 74 /** @type {!Map<*, !Network.NetworkGroupNode>} */ | |
| 75 this._nodeGroups = new Map(); | |
| 76 /** @type {!Object.<string, boolean>} */ | 74 /** @type {!Object.<string, boolean>} */ |
| 77 this._staleRequestIds = {}; | 75 this._staleRequestIds = {}; |
| 78 /** @type {number} */ | 76 /** @type {number} */ |
| 79 this._mainRequestLoadTime = -1; | 77 this._mainRequestLoadTime = -1; |
| 80 /** @type {number} */ | 78 /** @type {number} */ |
| 81 this._mainRequestDOMContentLoadedTime = -1; | 79 this._mainRequestDOMContentLoadedTime = -1; |
| 82 this._matchedRequestCount = 0; | 80 this._matchedRequestCount = 0; |
| 83 this._highlightedSubstringChanges = []; | 81 this._highlightedSubstringChanges = []; |
| 84 | 82 |
| 85 /** @type {!Array.<!Network.NetworkLogView.Filter>} */ | 83 /** @type {!Array.<!Network.NetworkLogView.Filter>} */ |
| 86 this._filters = []; | 84 this._filters = []; |
| 87 /** @type {?Network.NetworkLogView.Filter} */ | 85 /** @type {?Network.NetworkLogView.Filter} */ |
| 88 this._timeFilter = null; | 86 this._timeFilter = null; |
| 89 /** @type {?Network.NetworkNode} */ | 87 /** @type {?Network.NetworkNode} */ |
| 90 this._hoveredNode = null; | 88 this._hoveredNode = null; |
| 91 | 89 |
| 92 this._currentMatchedRequestNode = null; | 90 this._currentMatchedRequestNode = null; |
| 93 this._currentMatchedRequestIndex = -1; | 91 this._currentMatchedRequestIndex = -1; |
| 94 | 92 |
| 95 /** @type {!Components.Linkifier} */ | 93 /** @type {!Components.Linkifier} */ |
| 96 this.linkifier = new Components.Linkifier(); | 94 this.linkifier = new Components.Linkifier(); |
| 97 | 95 |
| 98 this._recording = false; | 96 this._recording = false; |
| 99 this._preserveLog = false; | 97 this._preserveLog = false; |
| 100 | 98 |
| 101 this._headerHeight = 0; | 99 this._headerHeight = 0; |
| 102 | 100 |
| 103 /** @type {!Map<string, !Network.GroupLookupInterface>} */ | 101 /** @type {!Map<string, !Network.GroupLookupInterface>} */ |
| 104 this._groupLookups = new Map(); | 102 this._groupLookups = new Map(); |
| 105 this._groupLookups.set('Product', new Network.ProductGrouper()); | 103 this._groupLookups.set('Frame', new Network.FrameGrouper(this)); |
| 106 this._groupLookups.set('Frame', new Network.FrameGrouper()); | |
| 107 | 104 |
| 108 /** @type {?Network.GroupLookupInterface} */ | 105 /** @type {?Network.GroupLookupInterface} */ |
| 109 this._activeGroupLookup = null; | 106 this._activeGroupLookup = null; |
| 110 | 107 |
| 111 this._addFilters(); | 108 this._addFilters(); |
| 112 this._resetSuggestionBuilder(); | 109 this._resetSuggestionBuilder(); |
| 113 this._initializeView(); | 110 this._initializeView(); |
| 114 | 111 |
| 115 Common.moduleSetting('networkColorCodeResourceTypes') | 112 Common.moduleSetting('networkColorCodeResourceTypes') |
| 116 .addChangeListener(this._invalidateAllItems.bind(this, false), this); | 113 .addChangeListener(this._invalidateAllItems.bind(this, false), this); |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 360 return this._groupLookups; | 357 return this._groupLookups; |
| 361 } | 358 } |
| 362 | 359 |
| 363 /** | 360 /** |
| 364 * @param {string} groupKey | 361 * @param {string} groupKey |
| 365 */ | 362 */ |
| 366 setGrouping(groupKey) { | 363 setGrouping(groupKey) { |
| 367 var groupLookup = this._groupLookups.get(groupKey) || null; | 364 var groupLookup = this._groupLookups.get(groupKey) || null; |
| 368 this._activeGroupLookup = groupLookup; | 365 this._activeGroupLookup = groupLookup; |
| 369 if (!groupLookup) { | 366 if (!groupLookup) { |
| 370 this._nodeGroups.clear(); | |
| 371 this._invalidateAllItems(); | 367 this._invalidateAllItems(); |
| 372 return; | 368 return; |
| 373 } | 369 } |
| 374 groupLookup.initialize().then(() => { | 370 groupLookup.initialize().then(() => { |
| 375 if (this._activeGroupLookup !== groupLookup) | 371 if (this._activeGroupLookup !== groupLookup) |
| 376 return; | 372 return; |
| 377 this._nodeGroups.clear(); | 373 this._activeGroupLookup.reset(); |
|
pfeldman
2017/05/04 22:54:08
Do you clean your map when I clear network panel?
allada
2017/05/05 00:43:13
Yes, the button calls NetworkPanel._reset() which
| |
| 378 this._invalidateAllItems(); | 374 this._invalidateAllItems(); |
| 379 }); | 375 }); |
| 380 } | 376 } |
| 381 | 377 |
| 382 /** | 378 /** |
| 383 * @param {!SDK.NetworkRequest} request | 379 * @param {!SDK.NetworkRequest} request |
| 384 * @return {?Network.NetworkRequestNode} | 380 * @return {?Network.NetworkRequestNode} |
| 385 */ | 381 */ |
| 386 nodeForRequest(request) { | 382 nodeForRequest(request) { |
| 387 return this._nodesByRequestId.get(request.requestId()); | 383 return this._nodesByRequestId.get(request.requestId()); |
| (...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 892 } | 888 } |
| 893 | 889 |
| 894 /** | 890 /** |
| 895 * @param {!Network.NetworkRequestNode} node | 891 * @param {!Network.NetworkRequestNode} node |
| 896 * @return {?Network.NetworkNode} | 892 * @return {?Network.NetworkNode} |
| 897 */ | 893 */ |
| 898 _parentNodeForInsert(node) { | 894 _parentNodeForInsert(node) { |
| 899 if (!this._activeGroupLookup) | 895 if (!this._activeGroupLookup) |
| 900 return this._dataGrid.rootNode(); | 896 return this._dataGrid.rootNode(); |
| 901 | 897 |
| 902 var groupKey = this._activeGroupLookup.groupForRequest(node.request()); | 898 var groupNode = this._activeGroupLookup.groupNodeForRequest(node.request()); |
| 903 if (!groupKey) | 899 if (!groupNode) |
| 904 return this._dataGrid.rootNode(); | 900 return this._dataGrid.rootNode(); |
| 905 | 901 return groupNode; |
| 906 var group = this._nodeGroups.get(groupKey); | |
| 907 if (group) | |
| 908 return group; | |
| 909 group = new Network.NetworkGroupNode(this, this._activeGroupLookup.groupName (groupKey)); | |
| 910 this._nodeGroups.set(groupKey, group); | |
| 911 return group; | |
| 912 } | 902 } |
| 913 | 903 |
| 914 reset() { | 904 reset() { |
| 915 this._requestWithHighlightedInitiators = null; | 905 this._requestWithHighlightedInitiators = null; |
| 916 this.dispatchEventToListeners(Network.NetworkLogView.Events.RequestSelected, null); | 906 this.dispatchEventToListeners(Network.NetworkLogView.Events.RequestSelected, null); |
| 917 | 907 |
| 918 this._clearSearchMatchedList(); | 908 this._clearSearchMatchedList(); |
| 919 | 909 |
| 920 this._setHoveredNode(null); | 910 this._setHoveredNode(null); |
| 921 this._columns.reset(); | 911 this._columns.reset(); |
| 922 | 912 |
| 923 this._timeFilter = null; | 913 this._timeFilter = null; |
| 924 this._calculator.reset(); | 914 this._calculator.reset(); |
| 925 | 915 |
| 926 this._timeCalculator.setWindow(null); | 916 this._timeCalculator.setWindow(null); |
| 927 | 917 |
| 928 var nodes = this._nodesByRequestId.valuesArray(); | 918 var nodes = this._nodesByRequestId.valuesArray(); |
| 929 for (var i = 0; i < nodes.length; ++i) | 919 for (var i = 0; i < nodes.length; ++i) |
| 930 nodes[i].dispose(); | 920 nodes[i].dispose(); |
| 931 | 921 |
| 932 this._nodeGroups.clear(); | 922 if (this._activeGroupLookup) |
| 923 this._activeGroupLookup.reset(); | |
| 933 this._nodesByRequestId.clear(); | 924 this._nodesByRequestId.clear(); |
| 934 this._staleRequestIds = {}; | 925 this._staleRequestIds = {}; |
| 935 this._resetSuggestionBuilder(); | 926 this._resetSuggestionBuilder(); |
| 936 | 927 |
| 937 this._mainRequestLoadTime = -1; | 928 this._mainRequestLoadTime = -1; |
| 938 this._mainRequestDOMContentLoadedTime = -1; | 929 this._mainRequestDOMContentLoadedTime = -1; |
| 939 | 930 |
| 940 if (this._dataGrid) { | 931 if (this._dataGrid) { |
| 941 this._dataGrid.rootNode().removeChildren(); | 932 this._dataGrid.rootNode().removeChildren(); |
| 942 this._updateSummaryBar(); | 933 this._updateSummaryBar(); |
| (...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1827 Network.GroupLookupInterface = function() {}; | 1818 Network.GroupLookupInterface = function() {}; |
| 1828 | 1819 |
| 1829 Network.GroupLookupInterface.prototype = { | 1820 Network.GroupLookupInterface.prototype = { |
| 1830 /** | 1821 /** |
| 1831 * @return {!Promise} | 1822 * @return {!Promise} |
| 1832 */ | 1823 */ |
| 1833 initialize: function() {}, | 1824 initialize: function() {}, |
| 1834 | 1825 |
| 1835 /** | 1826 /** |
| 1836 * @param {!SDK.NetworkRequest} request | 1827 * @param {!SDK.NetworkRequest} request |
| 1837 * @return {?*} | 1828 * @return {?Network.NetworkGroupNode} |
| 1838 */ | 1829 */ |
| 1839 groupForRequest: function(request) {}, | 1830 groupNodeForRequest: function(request) {}, |
| 1840 | 1831 |
| 1841 /** | 1832 reset: function() {} |
| 1842 * @param {!*} key | |
| 1843 * @return {string} | |
| 1844 */ | |
| 1845 groupName: function(key) {} | |
| 1846 }; | 1833 }; |
| OLD | NEW |