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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 66 /** @type {number} */ | 66 /** @type {number} */ |
| 67 this._rowHeight = !!this._networkLogLargeRowsSetting.get() ? 41 : 21; | 67 this._rowHeight = !!this._networkLogLargeRowsSetting.get() ? 41 : 21; |
| 68 } | 68 } |
| 69 updateRowHeight.call(this); | 69 updateRowHeight.call(this); |
| 70 | 70 |
| 71 this._columns = new Network.NetworkLogViewColumns( | 71 this._columns = new Network.NetworkLogViewColumns( |
| 72 this, this._timeCalculator, this._durationCalculator, networkLogLargeRow sSetting); | 72 this, this._timeCalculator, this._durationCalculator, networkLogLargeRow sSetting); |
| 73 | 73 |
| 74 /** @type {!Map.<string, !Network.NetworkDataGridNode>} */ | 74 /** @type {!Map.<string, !Network.NetworkDataGridNode>} */ |
| 75 this._nodesByRequestId = new Map(); | 75 this._nodesByRequestId = new Map(); |
| 76 /** @type {!Map.<string, !Network.NetworkDataGridParentNode>} */ | |
|
dgozman
2016/12/15 03:04:41
NetworkDataGridGroupNode
allada
2016/12/19 22:44:28
Done.
| |
| 77 this._nodeGroups = new Map(); | |
| 76 /** @type {!Object.<string, boolean>} */ | 78 /** @type {!Object.<string, boolean>} */ |
| 77 this._staleRequestIds = {}; | 79 this._staleRequestIds = {}; |
| 78 /** @type {number} */ | 80 /** @type {number} */ |
| 79 this._mainRequestLoadTime = -1; | 81 this._mainRequestLoadTime = -1; |
| 80 /** @type {number} */ | 82 /** @type {number} */ |
| 81 this._mainRequestDOMContentLoadedTime = -1; | 83 this._mainRequestDOMContentLoadedTime = -1; |
| 82 this._matchedRequestCount = 0; | 84 this._matchedRequestCount = 0; |
| 83 this._highlightedSubstringChanges = []; | 85 this._highlightedSubstringChanges = []; |
| 84 | 86 |
| 85 /** @type {!Array.<!Network.NetworkLogView.Filter>} */ | 87 /** @type {!Array.<!Network.NetworkLogView.Filter>} */ |
| (...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 775 } | 777 } |
| 776 | 778 |
| 777 /** | 779 /** |
| 778 * @override | 780 * @override |
| 779 */ | 781 */ |
| 780 willHide() { | 782 willHide() { |
| 781 this._columns.willHide(); | 783 this._columns.willHide(); |
| 782 } | 784 } |
| 783 | 785 |
| 784 /** | 786 /** |
| 785 * @return {!Array<!Network.NetworkDataGridNode>} | 787 * @return {!Array<!Network.NetworkDataGridNodeInterface>} |
| 786 */ | 788 */ |
| 787 flatNodesList() { | 789 flatNodesList() { |
| 788 return this._dataGrid.rootNode().flatChildren(); | 790 return this._dataGrid.rootNode().flatChildren(); |
| 789 } | 791 } |
| 790 | 792 |
| 791 _refresh() { | 793 _refresh() { |
| 792 this._needsRefresh = false; | 794 this._needsRefresh = false; |
| 793 | 795 |
| 794 if (this._refreshRequestId) { | 796 if (this._refreshRequestId) { |
| 795 this.element.window().cancelAnimationFrame(this._refreshRequestId); | 797 this.element.window().cancelAnimationFrame(this._refreshRequestId); |
| 796 delete this._refreshRequestId; | 798 delete this._refreshRequestId; |
| 797 } | 799 } |
| 798 | 800 |
| 799 this.removeAllNodeHighlights(); | 801 this.removeAllNodeHighlights(); |
| 800 | 802 |
| 801 var oldBoundary = this.calculator().boundary(); | 803 var oldBoundary = this.calculator().boundary(); |
| 802 this._timeCalculator.updateBoundariesForEventTime(this._mainRequestLoadTime) ; | 804 this._timeCalculator.updateBoundariesForEventTime(this._mainRequestLoadTime) ; |
| 803 this._durationCalculator.updateBoundariesForEventTime(this._mainRequestLoadT ime); | 805 this._durationCalculator.updateBoundariesForEventTime(this._mainRequestLoadT ime); |
| 804 this._timeCalculator.updateBoundariesForEventTime(this._mainRequestDOMConten tLoadedTime); | 806 this._timeCalculator.updateBoundariesForEventTime(this._mainRequestDOMConten tLoadedTime); |
| 805 this._durationCalculator.updateBoundariesForEventTime(this._mainRequestDOMCo ntentLoadedTime); | 807 this._durationCalculator.updateBoundariesForEventTime(this._mainRequestDOMCo ntentLoadedTime); |
| 806 | 808 |
| 809 var groupRequests = Runtime.experiments.isEnabled('networkGroupingRequests') ; | |
|
dgozman
2016/12/15 03:04:41
Unused.
allada
2016/12/19 22:44:29
Done.
| |
| 810 | |
| 807 var dataGrid = this._dataGrid; | 811 var dataGrid = this._dataGrid; |
| 808 var rootNode = dataGrid.rootNode(); | 812 var rootNode = dataGrid.rootNode(); |
| 809 /** @type {!Array<!Network.NetworkDataGridNode> } */ | 813 /** @type {!Array<!Network.NetworkDataGridNode> } */ |
| 810 var nodesToInsert = []; | 814 var nodesToInsert = []; |
| 811 /** @type {!Array<!Network.NetworkDataGridNode> } */ | 815 /** @type {!Array<!Network.NetworkDataGridNode> } */ |
| 812 var nodesToRefresh = []; | 816 var nodesToRefresh = []; |
| 813 for (var requestId in this._staleRequestIds) { | 817 for (var requestId in this._staleRequestIds) { |
| 814 var node = this._nodesByRequestId.get(requestId); | 818 var node = this._nodesByRequestId.get(requestId); |
| 815 if (!node) | 819 if (!node) |
| 816 continue; | 820 continue; |
| 817 var isFilteredOut = !this._applyFilter(node); | 821 var isFilteredOut = !this._applyFilter(node); |
| 818 if (isFilteredOut && node === this._hoveredNode) | 822 if (isFilteredOut && node === this._hoveredNode) |
| 819 this._setHoveredNode(null); | 823 this._setHoveredNode(null); |
| 820 if (node[Network.NetworkLogView._isFilteredOutSymbol] !== isFilteredOut) { | 824 if (node[Network.NetworkLogView._isFilteredOutSymbol] !== isFilteredOut) { |
| 821 if (!node[Network.NetworkLogView._isFilteredOutSymbol]) | 825 if (!node[Network.NetworkLogView._isFilteredOutSymbol]) |
| 822 rootNode.removeChild(node); | 826 node.parent.removeChild(node); |
| 823 | 827 |
| 824 node[Network.NetworkLogView._isFilteredOutSymbol] = isFilteredOut; | 828 node[Network.NetworkLogView._isFilteredOutSymbol] = isFilteredOut; |
| 825 | 829 |
| 826 if (!node[Network.NetworkLogView._isFilteredOutSymbol]) | 830 if (!node[Network.NetworkLogView._isFilteredOutSymbol]) |
| 827 nodesToInsert.push(node); | 831 nodesToInsert.push(node); |
| 828 } | 832 } |
| 829 if (!isFilteredOut) | 833 if (!isFilteredOut) |
| 830 nodesToRefresh.push(node); | 834 nodesToRefresh.push(node); |
| 831 var request = node.request(); | 835 var request = node.request(); |
| 832 this._timeCalculator.updateBoundaries(request); | 836 this._timeCalculator.updateBoundaries(request); |
| 833 this._durationCalculator.updateBoundaries(request); | 837 this._durationCalculator.updateBoundaries(request); |
| 834 } | 838 } |
| 835 | 839 |
| 836 for (var i = 0; i < nodesToInsert.length; ++i) { | 840 for (var i = 0; i < nodesToInsert.length; ++i) { |
| 837 var node = nodesToInsert[i]; | 841 var node = nodesToInsert[i]; |
| 838 var request = node.request(); | 842 var request = node.request(); |
| 839 dataGrid.insertChild(node); | |
| 840 node[Network.NetworkLogView._isMatchingSearchQuerySymbol] = this._matchReq uest(request); | 843 node[Network.NetworkLogView._isMatchingSearchQuerySymbol] = this._matchReq uest(request); |
| 844 var parent = this._parentNodeForInsert(node); | |
| 845 parent.appendChild(node); | |
| 841 } | 846 } |
| 842 | 847 |
| 843 for (var node of nodesToRefresh) | 848 for (var node of nodesToRefresh) |
| 844 node.refresh(); | 849 node.refresh(); |
| 845 | 850 |
| 846 this._highlightNthMatchedRequestForSearch( | 851 this._highlightNthMatchedRequestForSearch( |
| 847 this._updateMatchCountAndFindMatchIndex(this._currentMatchedRequestNode) , false); | 852 this._updateMatchCountAndFindMatchIndex(this._currentMatchedRequestNode) , false); |
| 848 | 853 |
| 849 this._staleRequestIds = {}; | 854 this._staleRequestIds = {}; |
| 850 this._updateSummaryBar(); | 855 this._updateSummaryBar(); |
| 851 | 856 |
| 852 this._columns.dataChanged(); | 857 this._columns.dataChanged(); |
| 853 } | 858 } |
| 854 | 859 |
| 860 _parentNodeForInsert(node) { | |
|
dgozman
2016/12/15 03:04:41
JSDoc
allada
2016/12/19 22:44:28
Done.
| |
| 861 if (!Runtime.experiments.isEnabled('networkGroupingRequests')) | |
| 862 return this._dataGrid.rootNode(); | |
| 863 | |
| 864 var request = node.request(); | |
| 865 // TODO(allada) Make this dynamic and allow multiple grouping types. | |
| 866 var groupKey = request.domain; | |
| 867 var group = this._nodeGroups.get(groupKey); | |
| 868 if (group) | |
| 869 return group; | |
| 870 group = new Network.NetworkDataGridParentNode(this, groupKey); | |
| 871 this._nodeGroups.set(groupKey, group); | |
| 872 this._dataGrid.rootNode().appendChild(group); | |
| 873 return group; | |
| 874 } | |
| 875 | |
| 855 reset() { | 876 reset() { |
| 856 this._requestWithHighlightedInitiators = null; | 877 this._requestWithHighlightedInitiators = null; |
| 857 this.dispatchEventToListeners(Network.NetworkLogView.Events.RequestSelected, null); | 878 this.dispatchEventToListeners(Network.NetworkLogView.Events.RequestSelected, null); |
| 858 | 879 |
| 859 this._clearSearchMatchedList(); | 880 this._clearSearchMatchedList(); |
| 860 | 881 |
| 861 this._setHoveredNode(null); | 882 this._setHoveredNode(null); |
| 862 this._columns.reset(); | 883 this._columns.reset(); |
| 863 | 884 |
| 864 this._timeFilter = null; | 885 this._timeFilter = null; |
| 865 this._calculator.reset(); | 886 this._calculator.reset(); |
| 866 | 887 |
| 867 this._timeCalculator.setWindow(null); | 888 this._timeCalculator.setWindow(null); |
| 868 | 889 |
| 869 var nodes = this._nodesByRequestId.valuesArray(); | 890 var nodes = this._nodesByRequestId.valuesArray(); |
| 870 for (var i = 0; i < nodes.length; ++i) | 891 for (var i = 0; i < nodes.length; ++i) |
| 871 nodes[i].dispose(); | 892 nodes[i].dispose(); |
| 872 | 893 |
| 894 this._nodeGroups.clear(); | |
| 873 this._nodesByRequestId.clear(); | 895 this._nodesByRequestId.clear(); |
| 874 this._staleRequestIds = {}; | 896 this._staleRequestIds = {}; |
| 875 this._resetSuggestionBuilder(); | 897 this._resetSuggestionBuilder(); |
| 876 | 898 |
| 877 this._mainRequestLoadTime = -1; | 899 this._mainRequestLoadTime = -1; |
| 878 this._mainRequestDOMContentLoadedTime = -1; | 900 this._mainRequestDOMContentLoadedTime = -1; |
| 879 | 901 |
| 880 if (this._dataGrid) { | 902 if (this._dataGrid) { |
| 881 this._dataGrid.rootNode().removeChildren(); | 903 this._dataGrid.rootNode().removeChildren(); |
| 882 this._updateSummaryBar(); | 904 this._updateSummaryBar(); |
| (...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1715 Running: 'running', | 1737 Running: 'running', |
| 1716 FromCache: 'from-cache' | 1738 FromCache: 'from-cache' |
| 1717 }; | 1739 }; |
| 1718 | 1740 |
| 1719 /** @type {!Array<string>} */ | 1741 /** @type {!Array<string>} */ |
| 1720 Network.NetworkLogView._searchKeys = | 1742 Network.NetworkLogView._searchKeys = |
| 1721 Object.keys(Network.NetworkLogView.FilterType).map(key => Network.NetworkLog View.FilterType[key]); | 1743 Object.keys(Network.NetworkLogView.FilterType).map(key => Network.NetworkLog View.FilterType[key]); |
| 1722 | 1744 |
| 1723 /** @typedef {function(!SDK.NetworkRequest): boolean} */ | 1745 /** @typedef {function(!SDK.NetworkRequest): boolean} */ |
| 1724 Network.NetworkLogView.Filter; | 1746 Network.NetworkLogView.Filter; |
| OLD | NEW |