| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 */ | 62 */ |
| 63 function updateRowHeight() { | 63 function updateRowHeight() { |
| 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.NetworkDataGridNode>} */ | 72 /** @type {!Map.<string, !Network.NetworkRequestNode>} */ |
| 73 this._nodesByRequestId = new Map(); | 73 this._nodesByRequestId = new Map(); |
| 74 /** @type {!Map.<string, !Network.NetworkGroupNode>} */ |
| 75 this._nodeGroups = new Map(); |
| 74 /** @type {!Object.<string, boolean>} */ | 76 /** @type {!Object.<string, boolean>} */ |
| 75 this._staleRequestIds = {}; | 77 this._staleRequestIds = {}; |
| 76 /** @type {number} */ | 78 /** @type {number} */ |
| 77 this._mainRequestLoadTime = -1; | 79 this._mainRequestLoadTime = -1; |
| 78 /** @type {number} */ | 80 /** @type {number} */ |
| 79 this._mainRequestDOMContentLoadedTime = -1; | 81 this._mainRequestDOMContentLoadedTime = -1; |
| 80 this._matchedRequestCount = 0; | 82 this._matchedRequestCount = 0; |
| 81 this._highlightedSubstringChanges = []; | 83 this._highlightedSubstringChanges = []; |
| 82 | 84 |
| 83 /** @type {!Array.<!Network.NetworkLogView.Filter>} */ | 85 /** @type {!Array.<!Network.NetworkLogView.Filter>} */ |
| 84 this._filters = []; | 86 this._filters = []; |
| 85 /** @type {?Network.NetworkLogView.Filter} */ | 87 /** @type {?Network.NetworkLogView.Filter} */ |
| 86 this._timeFilter = null; | 88 this._timeFilter = null; |
| 89 /** @type {?Network.NetworkNode} */ |
| 87 this._hoveredNode = null; | 90 this._hoveredNode = null; |
| 88 | 91 |
| 89 this._currentMatchedRequestNode = null; | 92 this._currentMatchedRequestNode = null; |
| 90 this._currentMatchedRequestIndex = -1; | 93 this._currentMatchedRequestIndex = -1; |
| 91 | 94 |
| 92 /** @type {!Components.Linkifier} */ | 95 /** @type {!Components.Linkifier} */ |
| 93 this.linkifier = new Components.Linkifier(); | 96 this.linkifier = new Components.Linkifier(); |
| 94 | 97 |
| 95 this._recording = false; | 98 this._recording = false; |
| 96 this._preserveLog = false; | 99 this._preserveLog = false; |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 this._dataGrid.element.classList.add('network-log-grid'); | 515 this._dataGrid.element.classList.add('network-log-grid'); |
| 513 this._dataGrid.element.addEventListener('mousedown', this._dataGridMouseDown
.bind(this), true); | 516 this._dataGrid.element.addEventListener('mousedown', this._dataGridMouseDown
.bind(this), true); |
| 514 this._dataGrid.element.addEventListener('mousemove', this._dataGridMouseMove
.bind(this), true); | 517 this._dataGrid.element.addEventListener('mousemove', this._dataGridMouseMove
.bind(this), true); |
| 515 this._dataGrid.element.addEventListener('mouseleave', this._dataGridMouseLea
ve.bind(this), true); | 518 this._dataGrid.element.addEventListener('mouseleave', this._dataGridMouseLea
ve.bind(this), true); |
| 516 } | 519 } |
| 517 | 520 |
| 518 /** | 521 /** |
| 519 * @param {!Event} event | 522 * @param {!Event} event |
| 520 */ | 523 */ |
| 521 _dataGridMouseMove(event) { | 524 _dataGridMouseMove(event) { |
| 522 var node = /** @type {?Network.NetworkDataGridNode} */ ( | 525 var node = |
| 523 this._dataGrid.dataGridNodeFromNode(/** @type {!Node} */ (event.target))
); | 526 /** @type {?Network.NetworkNode} */ (this._dataGrid.dataGridNodeFromNode
(/** @type {!Node} */ (event.target))); |
| 524 var highlightInitiatorChain = event.shiftKey; | 527 var highlightInitiatorChain = event.shiftKey; |
| 525 this._setHoveredNode(node, highlightInitiatorChain); | 528 this._setHoveredNode(node, highlightInitiatorChain); |
| 526 this._highlightInitiatorChain((highlightInitiatorChain && node) ? node.reque
st() : null); | 529 this._highlightInitiatorChain((highlightInitiatorChain && node) ? node.reque
st() : null); |
| 527 } | 530 } |
| 528 | 531 |
| 529 _dataGridMouseLeave() { | 532 _dataGridMouseLeave() { |
| 530 this._setHoveredNode(null); | 533 this._setHoveredNode(null); |
| 531 this._highlightInitiatorChain(null); | 534 this._highlightInitiatorChain(null); |
| 532 } | 535 } |
| 533 | 536 |
| 534 /** | 537 /** |
| 535 * @param {?Network.NetworkDataGridNode} node | 538 * @param {?Network.NetworkNode} node |
| 536 * @param {boolean} highlightInitiatorChain | 539 * @param {boolean} highlightInitiatorChain |
| 537 */ | 540 */ |
| 538 setHoveredNode(node, highlightInitiatorChain) { | 541 setHoveredNode(node, highlightInitiatorChain) { |
| 539 this._setHoveredNode(node, highlightInitiatorChain); | 542 this._setHoveredNode(node, highlightInitiatorChain); |
| 540 this._highlightInitiatorChain((node && highlightInitiatorChain) ? node.reque
st() : null); | 543 this._highlightInitiatorChain((node && highlightInitiatorChain) ? node.reque
st() : null); |
| 541 } | 544 } |
| 542 | 545 |
| 543 /** | 546 /** |
| 544 * @param {?Network.NetworkDataGridNode} node | 547 * @param {?Network.NetworkNode} node |
| 545 * @param {boolean=} highlightInitiatorChain | 548 * @param {boolean=} highlightInitiatorChain |
| 546 */ | 549 */ |
| 547 _setHoveredNode(node, highlightInitiatorChain) { | 550 _setHoveredNode(node, highlightInitiatorChain) { |
| 548 if (this._hoveredNode) | 551 if (this._hoveredNode) |
| 549 this._hoveredNode.element().classList.remove('hover'); | 552 this._hoveredNode.element().classList.remove('hover'); |
| 550 this._hoveredNode = node; | 553 this._hoveredNode = node; |
| 551 if (this._hoveredNode) | 554 if (this._hoveredNode) |
| 552 this._hoveredNode.element().classList.add('hover'); | 555 this._hoveredNode.element().classList.add('hover'); |
| 553 this._columns.setHoveredNode(this._hoveredNode, !!highlightInitiatorChain); | 556 this._columns.setHoveredNode(this._hoveredNode, !!highlightInitiatorChain); |
| 554 } | 557 } |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 773 } | 776 } |
| 774 | 777 |
| 775 /** | 778 /** |
| 776 * @override | 779 * @override |
| 777 */ | 780 */ |
| 778 willHide() { | 781 willHide() { |
| 779 this._columns.willHide(); | 782 this._columns.willHide(); |
| 780 } | 783 } |
| 781 | 784 |
| 782 /** | 785 /** |
| 783 * @return {!Array<!Network.NetworkDataGridNode>} | 786 * @return {!Array<!Network.NetworkNode>} |
| 784 */ | 787 */ |
| 785 flatNodesList() { | 788 flatNodesList() { |
| 786 return this._dataGrid.rootNode().flatChildren(); | 789 return this._dataGrid.rootNode().flatChildren(); |
| 787 } | 790 } |
| 788 | 791 |
| 789 _refresh() { | 792 _refresh() { |
| 790 this._needsRefresh = false; | 793 this._needsRefresh = false; |
| 791 | 794 |
| 792 if (this._refreshRequestId) { | 795 if (this._refreshRequestId) { |
| 793 this.element.window().cancelAnimationFrame(this._refreshRequestId); | 796 this.element.window().cancelAnimationFrame(this._refreshRequestId); |
| 794 delete this._refreshRequestId; | 797 delete this._refreshRequestId; |
| 795 } | 798 } |
| 796 | 799 |
| 797 this.removeAllNodeHighlights(); | 800 this.removeAllNodeHighlights(); |
| 798 | 801 |
| 799 this._timeCalculator.updateBoundariesForEventTime(this._mainRequestLoadTime)
; | 802 this._timeCalculator.updateBoundariesForEventTime(this._mainRequestLoadTime)
; |
| 800 this._durationCalculator.updateBoundariesForEventTime(this._mainRequestLoadT
ime); | 803 this._durationCalculator.updateBoundariesForEventTime(this._mainRequestLoadT
ime); |
| 801 this._timeCalculator.updateBoundariesForEventTime(this._mainRequestDOMConten
tLoadedTime); | 804 this._timeCalculator.updateBoundariesForEventTime(this._mainRequestDOMConten
tLoadedTime); |
| 802 this._durationCalculator.updateBoundariesForEventTime(this._mainRequestDOMCo
ntentLoadedTime); | 805 this._durationCalculator.updateBoundariesForEventTime(this._mainRequestDOMCo
ntentLoadedTime); |
| 803 | 806 |
| 804 var dataGrid = this._dataGrid; | 807 /** @type {!Array<!Network.NetworkRequestNode> } */ |
| 805 var rootNode = dataGrid.rootNode(); | |
| 806 /** @type {!Array<!Network.NetworkDataGridNode> } */ | |
| 807 var nodesToInsert = []; | 808 var nodesToInsert = []; |
| 808 /** @type {!Array<!Network.NetworkDataGridNode> } */ | 809 /** @type {!Array<!Network.NetworkRequestNode> } */ |
| 809 var nodesToRefresh = []; | 810 var nodesToRefresh = []; |
| 810 for (var requestId in this._staleRequestIds) { | 811 for (var requestId in this._staleRequestIds) { |
| 811 var node = this._nodesByRequestId.get(requestId); | 812 var node = this._nodesByRequestId.get(requestId); |
| 812 if (!node) | 813 if (!node) |
| 813 continue; | 814 continue; |
| 814 var isFilteredOut = !this._applyFilter(node); | 815 var isFilteredOut = !this._applyFilter(node); |
| 815 if (isFilteredOut && node === this._hoveredNode) | 816 if (isFilteredOut && node === this._hoveredNode) |
| 816 this._setHoveredNode(null); | 817 this._setHoveredNode(null); |
| 817 if (node[Network.NetworkLogView._isFilteredOutSymbol] !== isFilteredOut) { | 818 if (node[Network.NetworkLogView._isFilteredOutSymbol] !== isFilteredOut) { |
| 818 if (!node[Network.NetworkLogView._isFilteredOutSymbol]) | 819 if (!node[Network.NetworkLogView._isFilteredOutSymbol]) |
| 819 rootNode.removeChild(node); | 820 node.parent.removeChild(node); |
| 820 | 821 |
| 821 node[Network.NetworkLogView._isFilteredOutSymbol] = isFilteredOut; | 822 node[Network.NetworkLogView._isFilteredOutSymbol] = isFilteredOut; |
| 822 | 823 |
| 823 if (!node[Network.NetworkLogView._isFilteredOutSymbol]) | 824 if (!node[Network.NetworkLogView._isFilteredOutSymbol]) |
| 824 nodesToInsert.push(node); | 825 nodesToInsert.push(node); |
| 825 } | 826 } |
| 826 if (!isFilteredOut) | 827 if (!isFilteredOut) |
| 827 nodesToRefresh.push(node); | 828 nodesToRefresh.push(node); |
| 828 var request = node.request(); | 829 var request = node.request(); |
| 829 this._timeCalculator.updateBoundaries(request); | 830 this._timeCalculator.updateBoundaries(request); |
| 830 this._durationCalculator.updateBoundaries(request); | 831 this._durationCalculator.updateBoundaries(request); |
| 831 } | 832 } |
| 832 | 833 |
| 833 for (var i = 0; i < nodesToInsert.length; ++i) { | 834 for (var i = 0; i < nodesToInsert.length; ++i) { |
| 834 var node = nodesToInsert[i]; | 835 var node = nodesToInsert[i]; |
| 835 var request = node.request(); | 836 var request = node.request(); |
| 836 dataGrid.insertChild(node); | |
| 837 node[Network.NetworkLogView._isMatchingSearchQuerySymbol] = this._matchReq
uest(request); | 837 node[Network.NetworkLogView._isMatchingSearchQuerySymbol] = this._matchReq
uest(request); |
| 838 var parent = this._parentNodeForInsert(node); |
| 839 parent.appendChild(node); |
| 838 } | 840 } |
| 839 | 841 |
| 840 for (var node of nodesToRefresh) | 842 for (var node of nodesToRefresh) |
| 841 node.refresh(); | 843 node.refresh(); |
| 842 | 844 |
| 843 this._highlightNthMatchedRequestForSearch( | 845 this._highlightNthMatchedRequestForSearch( |
| 844 this._updateMatchCountAndFindMatchIndex(this._currentMatchedRequestNode)
, false); | 846 this._updateMatchCountAndFindMatchIndex(this._currentMatchedRequestNode)
, false); |
| 845 | 847 |
| 846 this._staleRequestIds = {}; | 848 this._staleRequestIds = {}; |
| 847 this._updateSummaryBar(); | 849 this._updateSummaryBar(); |
| 848 | 850 |
| 849 this._columns.dataChanged(); | 851 this._columns.dataChanged(); |
| 850 } | 852 } |
| 851 | 853 |
| 854 /** |
| 855 * @param {!Network.NetworkRequestNode} node |
| 856 * @return {!Network.NetworkNode} |
| 857 */ |
| 858 _parentNodeForInsert(node) { |
| 859 if (!Runtime.experiments.isEnabled('networkGroupingRequests')) |
| 860 return /** @type {!Network.NetworkNode} */ (this._dataGrid.rootNode()); |
| 861 |
| 862 var request = node.request(); |
| 863 // TODO(allada) Make this dynamic and allow multiple grouping types. |
| 864 var groupKey = request.domain; |
| 865 var group = this._nodeGroups.get(groupKey); |
| 866 if (group) |
| 867 return group; |
| 868 group = new Network.NetworkGroupNode(this, groupKey); |
| 869 this._nodeGroups.set(groupKey, group); |
| 870 this._dataGrid.rootNode().appendChild(group); |
| 871 return group; |
| 872 } |
| 873 |
| 852 reset() { | 874 reset() { |
| 853 this._requestWithHighlightedInitiators = null; | 875 this._requestWithHighlightedInitiators = null; |
| 854 this.dispatchEventToListeners(Network.NetworkLogView.Events.RequestSelected,
null); | 876 this.dispatchEventToListeners(Network.NetworkLogView.Events.RequestSelected,
null); |
| 855 | 877 |
| 856 this._clearSearchMatchedList(); | 878 this._clearSearchMatchedList(); |
| 857 | 879 |
| 858 this._setHoveredNode(null); | 880 this._setHoveredNode(null); |
| 859 this._columns.reset(); | 881 this._columns.reset(); |
| 860 | 882 |
| 861 this._timeFilter = null; | 883 this._timeFilter = null; |
| 862 this._calculator.reset(); | 884 this._calculator.reset(); |
| 863 | 885 |
| 864 this._timeCalculator.setWindow(null); | 886 this._timeCalculator.setWindow(null); |
| 865 | 887 |
| 866 var nodes = this._nodesByRequestId.valuesArray(); | 888 var nodes = this._nodesByRequestId.valuesArray(); |
| 867 for (var i = 0; i < nodes.length; ++i) | 889 for (var i = 0; i < nodes.length; ++i) |
| 868 nodes[i].dispose(); | 890 nodes[i].dispose(); |
| 869 | 891 |
| 892 this._nodeGroups.clear(); |
| 870 this._nodesByRequestId.clear(); | 893 this._nodesByRequestId.clear(); |
| 871 this._staleRequestIds = {}; | 894 this._staleRequestIds = {}; |
| 872 this._resetSuggestionBuilder(); | 895 this._resetSuggestionBuilder(); |
| 873 | 896 |
| 874 this._mainRequestLoadTime = -1; | 897 this._mainRequestLoadTime = -1; |
| 875 this._mainRequestDOMContentLoadedTime = -1; | 898 this._mainRequestDOMContentLoadedTime = -1; |
| 876 | 899 |
| 877 if (this._dataGrid) { | 900 if (this._dataGrid) { |
| 878 this._dataGrid.rootNode().removeChildren(); | 901 this._dataGrid.rootNode().removeChildren(); |
| 879 this._updateSummaryBar(); | 902 this._updateSummaryBar(); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 897 if (!this._recording) | 920 if (!this._recording) |
| 898 return; | 921 return; |
| 899 var request = /** @type {!SDK.NetworkRequest} */ (event.data); | 922 var request = /** @type {!SDK.NetworkRequest} */ (event.data); |
| 900 this._appendRequest(request); | 923 this._appendRequest(request); |
| 901 } | 924 } |
| 902 | 925 |
| 903 /** | 926 /** |
| 904 * @param {!SDK.NetworkRequest} request | 927 * @param {!SDK.NetworkRequest} request |
| 905 */ | 928 */ |
| 906 _appendRequest(request) { | 929 _appendRequest(request) { |
| 907 var node = new Network.NetworkDataGridNode(this, request); | 930 var node = new Network.NetworkRequestNode(this, request); |
| 908 node[Network.NetworkLogView._isFilteredOutSymbol] = true; | 931 node[Network.NetworkLogView._isFilteredOutSymbol] = true; |
| 909 node[Network.NetworkLogView._isMatchingSearchQuerySymbol] = false; | 932 node[Network.NetworkLogView._isMatchingSearchQuerySymbol] = false; |
| 910 | 933 |
| 911 // In case of redirect request id is reassigned to a redirected | 934 // In case of redirect request id is reassigned to a redirected |
| 912 // request and we need to update _nodesByRequestId and search results. | 935 // request and we need to update _nodesByRequestId and search results. |
| 913 var originalRequestNode = this._nodesByRequestId.get(request.requestId); | 936 var originalRequestNode = this._nodesByRequestId.get(request.requestId); |
| 914 if (originalRequestNode) | 937 if (originalRequestNode) |
| 915 this._nodesByRequestId.set(originalRequestNode.request().requestId, origin
alRequestNode); | 938 this._nodesByRequestId.set(originalRequestNode.request().requestId, origin
alRequestNode); |
| 916 this._nodesByRequestId.set(request.requestId, node); | 939 this._nodesByRequestId.set(request.requestId, node); |
| 917 | 940 |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1227 this._updateMatchCountAndFindMatchIndex(this._currentMatchedRequestNode)
, false); | 1250 this._updateMatchCountAndFindMatchIndex(this._currentMatchedRequestNode)
, false); |
| 1228 } | 1251 } |
| 1229 | 1252 |
| 1230 /** | 1253 /** |
| 1231 * @param {number} n | 1254 * @param {number} n |
| 1232 * @param {boolean} reveal | 1255 * @param {boolean} reveal |
| 1233 */ | 1256 */ |
| 1234 _highlightNthMatchedRequestForSearch(n, reveal) { | 1257 _highlightNthMatchedRequestForSearch(n, reveal) { |
| 1235 this._removeAllHighlights(); | 1258 this._removeAllHighlights(); |
| 1236 | 1259 |
| 1237 /** @type {!Array.<!Network.NetworkDataGridNode>} */ | 1260 /** @type {!Array.<!Network.NetworkRequestNode>} */ |
| 1238 var nodes = this._dataGrid.rootNode().children; | 1261 var nodes = this._dataGrid.rootNode().children; |
| 1239 var matchCount = 0; | 1262 var matchCount = 0; |
| 1240 var node = null; | 1263 var node = null; |
| 1241 for (var i = 0; i < nodes.length; ++i) { | 1264 for (var i = 0; i < nodes.length; ++i) { |
| 1242 if (nodes[i][Network.NetworkLogView._isMatchingSearchQuerySymbol]) { | 1265 if (nodes[i][Network.NetworkLogView._isMatchingSearchQuerySymbol]) { |
| 1243 if (matchCount === n) { | 1266 if (matchCount === n) { |
| 1244 node = nodes[i]; | 1267 node = nodes[i]; |
| 1245 break; | 1268 break; |
| 1246 } | 1269 } |
| 1247 matchCount++; | 1270 matchCount++; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1268 * @param {!UI.SearchableView.SearchConfig} searchConfig | 1291 * @param {!UI.SearchableView.SearchConfig} searchConfig |
| 1269 * @param {boolean} shouldJump | 1292 * @param {boolean} shouldJump |
| 1270 * @param {boolean=} jumpBackwards | 1293 * @param {boolean=} jumpBackwards |
| 1271 */ | 1294 */ |
| 1272 performSearch(searchConfig, shouldJump, jumpBackwards) { | 1295 performSearch(searchConfig, shouldJump, jumpBackwards) { |
| 1273 var query = searchConfig.query; | 1296 var query = searchConfig.query; |
| 1274 var currentMatchedRequestNode = this._currentMatchedRequestNode; | 1297 var currentMatchedRequestNode = this._currentMatchedRequestNode; |
| 1275 this._clearSearchMatchedList(); | 1298 this._clearSearchMatchedList(); |
| 1276 this._searchRegex = createPlainTextSearchRegex(query, 'i'); | 1299 this._searchRegex = createPlainTextSearchRegex(query, 'i'); |
| 1277 | 1300 |
| 1278 /** @type {!Array.<!Network.NetworkDataGridNode>} */ | 1301 /** @type {!Array.<!Network.NetworkRequestNode>} */ |
| 1279 var nodes = this._dataGrid.rootNode().children; | 1302 var nodes = this._dataGrid.rootNode().children; |
| 1280 for (var i = 0; i < nodes.length; ++i) | 1303 for (var i = 0; i < nodes.length; ++i) |
| 1281 nodes[i][Network.NetworkLogView._isMatchingSearchQuerySymbol] = this._matc
hRequest(nodes[i].request()); | 1304 nodes[i][Network.NetworkLogView._isMatchingSearchQuerySymbol] = this._matc
hRequest(nodes[i].request()); |
| 1282 var newMatchedRequestIndex = this._updateMatchCountAndFindMatchIndex(current
MatchedRequestNode); | 1305 var newMatchedRequestIndex = this._updateMatchCountAndFindMatchIndex(current
MatchedRequestNode); |
| 1283 if (!newMatchedRequestIndex && jumpBackwards) | 1306 if (!newMatchedRequestIndex && jumpBackwards) |
| 1284 newMatchedRequestIndex = this._matchedRequestCount - 1; | 1307 newMatchedRequestIndex = this._matchedRequestCount - 1; |
| 1285 this._highlightNthMatchedRequestForSearch(newMatchedRequestIndex, shouldJump
); | 1308 this._highlightNthMatchedRequestForSearch(newMatchedRequestIndex, shouldJump
); |
| 1286 } | 1309 } |
| 1287 | 1310 |
| 1288 /** | 1311 /** |
| 1289 * @override | 1312 * @override |
| 1290 * @return {boolean} | 1313 * @return {boolean} |
| 1291 */ | 1314 */ |
| 1292 supportsCaseSensitiveSearch() { | 1315 supportsCaseSensitiveSearch() { |
| 1293 return false; | 1316 return false; |
| 1294 } | 1317 } |
| 1295 | 1318 |
| 1296 /** | 1319 /** |
| 1297 * @override | 1320 * @override |
| 1298 * @return {boolean} | 1321 * @return {boolean} |
| 1299 */ | 1322 */ |
| 1300 supportsRegexSearch() { | 1323 supportsRegexSearch() { |
| 1301 return true; | 1324 return true; |
| 1302 } | 1325 } |
| 1303 | 1326 |
| 1304 /** | 1327 /** |
| 1305 * @param {?Network.NetworkDataGridNode} node | 1328 * @param {?Network.NetworkRequestNode} node |
| 1306 * @return {number} | 1329 * @return {number} |
| 1307 */ | 1330 */ |
| 1308 _updateMatchCountAndFindMatchIndex(node) { | 1331 _updateMatchCountAndFindMatchIndex(node) { |
| 1309 /** @type {!Array.<!Network.NetworkDataGridNode>} */ | 1332 /** @type {!Array.<!Network.NetworkRequestNode>} */ |
| 1310 var nodes = this._dataGrid.rootNode().children; | 1333 var nodes = this._dataGrid.rootNode().children; |
| 1311 var matchCount = 0; | 1334 var matchCount = 0; |
| 1312 var matchIndex = 0; | 1335 var matchIndex = 0; |
| 1313 for (var i = 0; i < nodes.length; ++i) { | 1336 for (var i = 0; i < nodes.length; ++i) { |
| 1314 if (!nodes[i][Network.NetworkLogView._isMatchingSearchQuerySymbol]) | 1337 if (!nodes[i][Network.NetworkLogView._isMatchingSearchQuerySymbol]) |
| 1315 continue; | 1338 continue; |
| 1316 if (node === nodes[i]) | 1339 if (node === nodes[i]) |
| 1317 matchIndex = matchCount; | 1340 matchIndex = matchCount; |
| 1318 matchCount++; | 1341 matchCount++; |
| 1319 } | 1342 } |
| 1320 if (this._matchedRequestCount !== matchCount) { | 1343 if (this._matchedRequestCount !== matchCount) { |
| 1321 this._matchedRequestCount = matchCount; | 1344 this._matchedRequestCount = matchCount; |
| 1322 this.dispatchEventToListeners(Network.NetworkLogView.Events.SearchCountUpd
ated, matchCount); | 1345 this.dispatchEventToListeners(Network.NetworkLogView.Events.SearchCountUpd
ated, matchCount); |
| 1323 } | 1346 } |
| 1324 return matchIndex; | 1347 return matchIndex; |
| 1325 } | 1348 } |
| 1326 | 1349 |
| 1327 /** | 1350 /** |
| 1328 * @param {number} index | 1351 * @param {number} index |
| 1329 * @return {number} | 1352 * @return {number} |
| 1330 */ | 1353 */ |
| 1331 _normalizeSearchResultIndex(index) { | 1354 _normalizeSearchResultIndex(index) { |
| 1332 return (index + this._matchedRequestCount) % this._matchedRequestCount; | 1355 return (index + this._matchedRequestCount) % this._matchedRequestCount; |
| 1333 } | 1356 } |
| 1334 | 1357 |
| 1335 /** | 1358 /** |
| 1336 * @param {!Network.NetworkDataGridNode} node | 1359 * @param {!Network.NetworkRequestNode} node |
| 1337 * @return {boolean} | 1360 * @return {boolean} |
| 1338 */ | 1361 */ |
| 1339 _applyFilter(node) { | 1362 _applyFilter(node) { |
| 1340 var request = node.request(); | 1363 var request = node.request(); |
| 1341 if (this._timeFilter && !this._timeFilter(request)) | 1364 if (this._timeFilter && !this._timeFilter(request)) |
| 1342 return false; | 1365 return false; |
| 1343 var categoryName = request.resourceType().category().title; | 1366 var categoryName = request.resourceType().category().title; |
| 1344 if (!this._resourceCategoryFilterUI.accept(categoryName)) | 1367 if (!this._resourceCategoryFilterUI.accept(categoryName)) |
| 1345 return false; | 1368 return false; |
| 1346 if (this._dataURLFilterUI.checked() && request.parsedURL.isDataURL()) | 1369 if (this._dataURLFilterUI.checked() && request.parsedURL.isDataURL()) |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1529 } | 1552 } |
| 1530 | 1553 |
| 1531 removeAllNodeHighlights() { | 1554 removeAllNodeHighlights() { |
| 1532 if (this._highlightedNode) { | 1555 if (this._highlightedNode) { |
| 1533 this._highlightedNode.element().classList.remove('highlighted-row'); | 1556 this._highlightedNode.element().classList.remove('highlighted-row'); |
| 1534 delete this._highlightedNode; | 1557 delete this._highlightedNode; |
| 1535 } | 1558 } |
| 1536 } | 1559 } |
| 1537 | 1560 |
| 1538 /** | 1561 /** |
| 1539 * @param {!Network.NetworkDataGridNode} node | 1562 * @param {!Network.NetworkRequestNode} node |
| 1540 */ | 1563 */ |
| 1541 _highlightNode(node) { | 1564 _highlightNode(node) { |
| 1542 UI.runCSSAnimationOnce(node.element(), 'highlighted-row'); | 1565 UI.runCSSAnimationOnce(node.element(), 'highlighted-row'); |
| 1543 this._highlightedNode = node; | 1566 this._highlightedNode = node; |
| 1544 } | 1567 } |
| 1545 | 1568 |
| 1546 /** | 1569 /** |
| 1547 * @param {!SDK.NetworkRequest} request | 1570 * @param {!SDK.NetworkRequest} request |
| 1548 * @param {string} platform | 1571 * @param {string} platform |
| 1549 * @return {string} | 1572 * @return {string} |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1709 Running: 'running', | 1732 Running: 'running', |
| 1710 FromCache: 'from-cache' | 1733 FromCache: 'from-cache' |
| 1711 }; | 1734 }; |
| 1712 | 1735 |
| 1713 /** @type {!Array<string>} */ | 1736 /** @type {!Array<string>} */ |
| 1714 Network.NetworkLogView._searchKeys = | 1737 Network.NetworkLogView._searchKeys = |
| 1715 Object.keys(Network.NetworkLogView.FilterType).map(key => Network.NetworkLog
View.FilterType[key]); | 1738 Object.keys(Network.NetworkLogView.FilterType).map(key => Network.NetworkLog
View.FilterType[key]); |
| 1716 | 1739 |
| 1717 /** @typedef {function(!SDK.NetworkRequest): boolean} */ | 1740 /** @typedef {function(!SDK.NetworkRequest): boolean} */ |
| 1718 Network.NetworkLogView.Filter; | 1741 Network.NetworkLogView.Filter; |
| OLD | NEW |