| 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 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 775 delete this._refreshRequestId; | 775 delete this._refreshRequestId; |
| 776 } | 776 } |
| 777 | 777 |
| 778 this.removeAllNodeHighlights(); | 778 this.removeAllNodeHighlights(); |
| 779 | 779 |
| 780 this._timeCalculator.updateBoundariesForEventTime(this._mainRequestLoadTime)
; | 780 this._timeCalculator.updateBoundariesForEventTime(this._mainRequestLoadTime)
; |
| 781 this._durationCalculator.updateBoundariesForEventTime(this._mainRequestLoadT
ime); | 781 this._durationCalculator.updateBoundariesForEventTime(this._mainRequestLoadT
ime); |
| 782 this._timeCalculator.updateBoundariesForEventTime(this._mainRequestDOMConten
tLoadedTime); | 782 this._timeCalculator.updateBoundariesForEventTime(this._mainRequestDOMConten
tLoadedTime); |
| 783 this._durationCalculator.updateBoundariesForEventTime(this._mainRequestDOMCo
ntentLoadedTime); | 783 this._durationCalculator.updateBoundariesForEventTime(this._mainRequestDOMCo
ntentLoadedTime); |
| 784 | 784 |
| 785 /** @type {!Array<!Network.NetworkRequestNode> } */ | 785 /** @type {!Map<!Network.NetworkNode, !Network.NetworkNode>} */ |
| 786 var nodesToInsert = []; | 786 var nodesToInsert = new Map(); |
| 787 /** @type {!Array<!Network.NetworkRequestNode> } */ | 787 /** @type {!Array<!Network.NetworkNode>} */ |
| 788 var nodesToRefresh = []; | 788 var nodesToRefresh = []; |
| 789 for (var requestId in this._staleRequestIds) { | 789 for (var requestId in this._staleRequestIds) { |
| 790 var node = this._nodesByRequestId.get(requestId); | 790 var node = this._nodesByRequestId.get(requestId); |
| 791 if (!node) | 791 if (!node) |
| 792 continue; | 792 continue; |
| 793 var isFilteredOut = !this._applyFilter(node); | 793 var isFilteredOut = !this._applyFilter(node); |
| 794 if (isFilteredOut && node === this._hoveredNode) | 794 if (isFilteredOut && node === this._hoveredNode) |
| 795 this._setHoveredNode(null); | 795 this._setHoveredNode(null); |
| 796 if (node[Network.NetworkLogView._isFilteredOutSymbol] !== isFilteredOut) { | |
| 797 if (!node[Network.NetworkLogView._isFilteredOutSymbol]) | |
| 798 node.parent.removeChild(node); | |
| 799 | 796 |
| 800 node[Network.NetworkLogView._isFilteredOutSymbol] = isFilteredOut; | |
| 801 | |
| 802 if (!node[Network.NetworkLogView._isFilteredOutSymbol]) | |
| 803 nodesToInsert.push(node); | |
| 804 } | |
| 805 if (!isFilteredOut) | 797 if (!isFilteredOut) |
| 806 nodesToRefresh.push(node); | 798 nodesToRefresh.push(node); |
| 807 var request = node.request(); | 799 var request = node.request(); |
| 808 this._timeCalculator.updateBoundaries(request); | 800 this._timeCalculator.updateBoundaries(request); |
| 809 this._durationCalculator.updateBoundaries(request); | 801 this._durationCalculator.updateBoundaries(request); |
| 802 |
| 803 if (node[Network.NetworkLogView._isFilteredOutSymbol] === isFilteredOut) |
| 804 continue; |
| 805 |
| 806 node[Network.NetworkLogView._isFilteredOutSymbol] = isFilteredOut; |
| 807 var newParent = this._parentNodeForInsert(node); |
| 808 var removeFromParent = node.parent && (isFilteredOut || node.parent !== ne
wParent); |
| 809 if (removeFromParent) { |
| 810 var parent = node.parent; |
| 811 parent.removeChild(node); |
| 812 while (parent && !parent.hasChildren() && parent.dataGrid && parent.data
Grid.rootNode() !== parent) { |
| 813 var grandparent = parent.parent; |
| 814 grandparent.removeChild(parent); |
| 815 parent = grandparent; |
| 816 } |
| 817 } |
| 818 |
| 819 if (isFilteredOut) |
| 820 continue; |
| 821 |
| 822 if (!newParent.dataGrid && !nodesToInsert.has(newParent)) { |
| 823 nodesToInsert.set(newParent, this._dataGrid.rootNode()); |
| 824 nodesToRefresh.push(newParent); |
| 825 } |
| 826 nodesToInsert.set(node, newParent); |
| 810 } | 827 } |
| 811 | 828 |
| 812 for (var i = 0; i < nodesToInsert.length; ++i) { | 829 for (var node of nodesToInsert.keys()) { |
| 813 var node = nodesToInsert[i]; | 830 var parent = nodesToInsert.get(node); |
| 814 var request = node.request(); | 831 var request = node.request(); |
| 815 node[Network.NetworkLogView._isMatchingSearchQuerySymbol] = this._matchReq
uest(request); | 832 if (request) |
| 816 var parent = this._parentNodeForInsert(node); | 833 node[Network.NetworkLogView._isMatchingSearchQuerySymbol] = this._matchR
equest(request); |
| 817 parent.appendChild(node); | 834 parent.appendChild(node); |
| 818 } | 835 } |
| 819 | 836 |
| 820 for (var node of nodesToRefresh) | 837 for (var node of nodesToRefresh) |
| 821 node.refresh(); | 838 node.refresh(); |
| 822 | 839 |
| 823 this._highlightNthMatchedRequestForSearch( | 840 this._highlightNthMatchedRequestForSearch( |
| 824 this._updateMatchCountAndFindMatchIndex(this._currentMatchedRequestNode)
, false); | 841 this._updateMatchCountAndFindMatchIndex(this._currentMatchedRequestNode)
, false); |
| 825 | 842 |
| 826 this._staleRequestIds = {}; | 843 this._staleRequestIds = {}; |
| 827 this._updateSummaryBar(); | 844 this._updateSummaryBar(); |
| 828 | 845 |
| 829 this._columns.dataChanged(); | 846 this._columns.dataChanged(); |
| 830 } | 847 } |
| 831 | 848 |
| 832 /** | 849 /** |
| 833 * @param {!Network.NetworkRequestNode} node | 850 * @param {!Network.NetworkRequestNode} node |
| 834 * @return {!Network.NetworkNode} | 851 * @return {!Network.NetworkNode} |
| 835 */ | 852 */ |
| 836 _parentNodeForInsert(node) { | 853 _parentNodeForInsert(node) { |
| 837 if (!Runtime.experiments.isEnabled('networkGroupingRequests')) | 854 if (!Runtime.experiments.isEnabled('networkGroupingRequests')) |
| 838 return /** @type {!Network.NetworkNode} */ (this._dataGrid.rootNode()); | 855 return /** @type {!Network.NetworkNode} */ (this._dataGrid.rootNode()); |
| 839 | 856 |
| 840 var request = node.request(); | 857 var request = node.request(); |
| 841 // TODO(allada) Make this dynamic and allow multiple grouping types. | 858 // TODO(allada) Make this dynamic and allow multiple grouping types. |
| 842 var groupKey = request.domain; | 859 var groupKey = request.connectionId; |
| 843 var group = this._nodeGroups.get(groupKey); | 860 var group = this._nodeGroups.get(groupKey); |
| 844 if (group) | 861 if (group) |
| 845 return group; | 862 return group; |
| 846 group = new Network.NetworkGroupNode(this, groupKey); | 863 |
| 864 var parsedURL = request.url().asParsedURL(); |
| 865 var host = ''; |
| 866 if (parsedURL) |
| 867 host = parsedURL.host; |
| 868 group = new Network.NetworkGroupNode(this, host + ' - ' + groupKey); |
| 847 this._nodeGroups.set(groupKey, group); | 869 this._nodeGroups.set(groupKey, group); |
| 848 this._dataGrid.rootNode().appendChild(group); | |
| 849 return group; | 870 return group; |
| 850 } | 871 } |
| 851 | 872 |
| 852 reset() { | 873 reset() { |
| 853 this._requestWithHighlightedInitiators = null; | 874 this._requestWithHighlightedInitiators = null; |
| 854 this.dispatchEventToListeners(Network.NetworkLogView.Events.RequestSelected,
null); | 875 this.dispatchEventToListeners(Network.NetworkLogView.Events.RequestSelected,
null); |
| 855 | 876 |
| 856 this._clearSearchMatchedList(); | 877 this._clearSearchMatchedList(); |
| 857 | 878 |
| 858 this._setHoveredNode(null); | 879 this._setHoveredNode(null); |
| (...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1727 Running: 'running', | 1748 Running: 'running', |
| 1728 FromCache: 'from-cache' | 1749 FromCache: 'from-cache' |
| 1729 }; | 1750 }; |
| 1730 | 1751 |
| 1731 /** @type {!Array<string>} */ | 1752 /** @type {!Array<string>} */ |
| 1732 Network.NetworkLogView._searchKeys = | 1753 Network.NetworkLogView._searchKeys = |
| 1733 Object.keys(Network.NetworkLogView.FilterType).map(key => Network.NetworkLog
View.FilterType[key]); | 1754 Object.keys(Network.NetworkLogView.FilterType).map(key => Network.NetworkLog
View.FilterType[key]); |
| 1734 | 1755 |
| 1735 /** @typedef {function(!SDK.NetworkRequest): boolean} */ | 1756 /** @typedef {function(!SDK.NetworkRequest): boolean} */ |
| 1736 Network.NetworkLogView.Filter; | 1757 Network.NetworkLogView.Filter; |
| OLD | NEW |