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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 53 WebInspector.VBox.call(this); | 53 WebInspector.VBox.call(this); |
| 54 this.registerRequiredCSS("networkLogView.css"); | 54 this.registerRequiredCSS("networkLogView.css"); |
| 55 this.registerRequiredCSS("filter.css"); | 55 this.registerRequiredCSS("filter.css"); |
| 56 this.registerRequiredCSS("suggestBox.css"); | 56 this.registerRequiredCSS("suggestBox.css"); |
| 57 | 57 |
| 58 this._filterBar = filterBar; | 58 this._filterBar = filterBar; |
| 59 this._coulmnsVisibilitySetting = coulmnsVisibilitySetting; | 59 this._coulmnsVisibilitySetting = coulmnsVisibilitySetting; |
| 60 this._allowRequestSelection = false; | 60 this._allowRequestSelection = false; |
| 61 this._requests = []; | 61 this._requests = []; |
| 62 this._requestsById = {}; | 62 this._requestsById = {}; |
| 63 this._staleRequests = {}; | 63 /** @type {!Object.<string, boolean>} */ |
| 64 this._staleRequestIds = {}; | |
|
vsevik
2014/07/02 13:06:00
StringSet
| |
| 64 this._requestGridNodes = {}; | 65 this._requestGridNodes = {}; |
| 65 this._lastRequestGridNodeId = 0; | 66 this._lastRequestGridNodeId = 0; |
| 66 this._mainRequestLoadTime = -1; | 67 this._mainRequestLoadTime = -1; |
| 67 this._mainRequestDOMContentLoadedTime = -1; | 68 this._mainRequestDOMContentLoadedTime = -1; |
| 68 this._matchedRequests = []; | 69 this._matchedRequests = []; |
| 69 this._highlightedSubstringChanges = []; | 70 this._highlightedSubstringChanges = []; |
| 70 this._filteredOutRequests = new Map(); | 71 this._filteredOutRequests = new Map(); |
| 71 | 72 |
| 72 /** @type {!Array.<!WebInspector.NetworkLogView.Filter>} */ | 73 /** @type {!Array.<!WebInspector.NetworkLogView.Filter>} */ |
| 73 this._filters = []; | 74 this._filters = []; |
| (...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 655 _refreshIfNeeded: function() | 656 _refreshIfNeeded: function() |
| 656 { | 657 { |
| 657 if (this._needsRefresh) | 658 if (this._needsRefresh) |
| 658 this.refresh(); | 659 this.refresh(); |
| 659 }, | 660 }, |
| 660 | 661 |
| 661 _invalidateAllItems: function() | 662 _invalidateAllItems: function() |
| 662 { | 663 { |
| 663 for (var i = 0; i < this._requests.length; ++i) { | 664 for (var i = 0; i < this._requests.length; ++i) { |
| 664 var request = this._requests[i]; | 665 var request = this._requests[i]; |
| 665 this._staleRequests[request.requestId] = request; | 666 this._staleRequestIds[request.requestId] = true; |
| 666 } | 667 } |
| 667 }, | 668 }, |
| 668 | 669 |
| 669 get calculator() | 670 get calculator() |
| 670 { | 671 { |
| 671 return this._calculator; | 672 return this._calculator; |
| 672 }, | 673 }, |
| 673 | 674 |
| 674 set calculator(x) | 675 set calculator(x) |
| 675 { | 676 { |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 760 } | 761 } |
| 761 | 762 |
| 762 this._removeAllNodeHighlights(); | 763 this._removeAllNodeHighlights(); |
| 763 var wasScrolledToLastRow = this._dataGrid.isScrolledToLastRow(); | 764 var wasScrolledToLastRow = this._dataGrid.isScrolledToLastRow(); |
| 764 var boundariesChanged = false; | 765 var boundariesChanged = false; |
| 765 if (this.calculator.updateBoundariesForEventTime) { | 766 if (this.calculator.updateBoundariesForEventTime) { |
| 766 boundariesChanged = this.calculator.updateBoundariesForEventTime(thi s._mainRequestLoadTime) || boundariesChanged; | 767 boundariesChanged = this.calculator.updateBoundariesForEventTime(thi s._mainRequestLoadTime) || boundariesChanged; |
| 767 boundariesChanged = this.calculator.updateBoundariesForEventTime(thi s._mainRequestDOMContentLoadedTime) || boundariesChanged; | 768 boundariesChanged = this.calculator.updateBoundariesForEventTime(thi s._mainRequestDOMContentLoadedTime) || boundariesChanged; |
| 768 } | 769 } |
| 769 | 770 |
| 770 for (var requestId in this._staleRequests) { | 771 for (var requestId in this._staleRequestIds) { |
| 771 var request = this._staleRequests[requestId]; | 772 var request = this._requestsById[requestId]; |
| 772 var node = this._requestGridNode(request); | 773 var node = this._requestGridNode(request); |
| 773 if (!node) { | 774 if (!node) { |
| 774 // Create the timeline tree element and graph. | 775 // Create the timeline tree element and graph. |
| 775 node = this._createRequestGridNode(request); | 776 node = this._createRequestGridNode(request); |
| 776 this._dataGrid.rootNode().appendChild(node); | 777 this._dataGrid.rootNode().appendChild(node); |
| 777 } | 778 } |
| 778 node.refresh(); | 779 node.refresh(); |
| 779 this._applyFilter(node); | 780 this._applyFilter(node); |
| 780 | 781 |
| 781 if (this.calculator.updateBoundaries(request)) | 782 if (this.calculator.updateBoundaries(request)) |
| 782 boundariesChanged = true; | 783 boundariesChanged = true; |
| 783 | 784 |
| 784 if (!node.isFilteredOut()) | 785 if (!node.isFilteredOut()) |
| 785 this._updateHighlightIfMatched(request); | 786 this._updateHighlightIfMatched(request); |
| 786 } | 787 } |
| 787 | 788 |
| 788 if (boundariesChanged) { | 789 if (boundariesChanged) { |
| 789 // The boundaries changed, so all item graphs are stale. | 790 // The boundaries changed, so all item graphs are stale. |
| 790 this._invalidateAllItems(); | 791 this._invalidateAllItems(); |
| 791 } | 792 } |
| 792 | 793 |
| 793 for (var requestId in this._staleRequests) | 794 for (var requestId in this._staleRequestIds) |
| 794 this._requestGridNode(this._staleRequests[requestId]).refreshGraph(t his.calculator); | 795 this._requestGridNode(this._requestsById[requestId]).refreshGraph(th is.calculator); |
| 795 | 796 |
| 796 this._staleRequests = {}; | 797 this._staleRequestIds = {}; |
| 797 this._sortItems(); | 798 this._sortItems(); |
| 798 this._updateSummaryBar(); | 799 this._updateSummaryBar(); |
| 799 this._dataGrid.updateWidths(); | 800 this._dataGrid.updateWidths(); |
| 800 // FIXME: evaluate performance impact of moving this before a call to so rtItems() | 801 // FIXME: evaluate performance impact of moving this before a call to so rtItems() |
| 801 if (wasScrolledToLastRow) | 802 if (wasScrolledToLastRow) |
| 802 this._dataGrid.scrollToLastRow(); | 803 this._dataGrid.scrollToLastRow(); |
| 803 }, | 804 }, |
| 804 | 805 |
| 805 _onRecordButtonClicked: function() | 806 _onRecordButtonClicked: function() |
| 806 { | 807 { |
| 807 if (!this._recordButton.toggled) | 808 if (!this._recordButton.toggled) |
| 808 this._reset(); | 809 this._reset(); |
| 809 this._recordButton.toggled = !this._recordButton.toggled; | 810 this._recordButton.toggled = !this._recordButton.toggled; |
| 810 }, | 811 }, |
| 811 | 812 |
| 812 _reset: function() | 813 _reset: function() |
| 813 { | 814 { |
| 814 this.dispatchEventToListeners(WebInspector.NetworkLogView.EventTypes.Vie wCleared); | 815 this.dispatchEventToListeners(WebInspector.NetworkLogView.EventTypes.Vie wCleared); |
| 815 | 816 |
| 816 this._clearSearchMatchedList(); | 817 this._clearSearchMatchedList(); |
| 817 if (this._popoverHelper) | 818 if (this._popoverHelper) |
| 818 this._popoverHelper.hidePopover(); | 819 this._popoverHelper.hidePopover(); |
| 819 | 820 |
| 820 if (this._calculator) | 821 if (this._calculator) |
| 821 this._calculator.reset(); | 822 this._calculator.reset(); |
| 822 | 823 |
| 823 this._requests = []; | 824 this._requests = []; |
| 824 this._requestsById = {}; | 825 this._requestsById = {}; |
| 825 this._staleRequests = {}; | 826 this._staleRequestIds = {}; |
| 826 this._requestGridNodes = {}; | 827 this._requestGridNodes = {}; |
| 827 this._resetSuggestionBuilder(); | 828 this._resetSuggestionBuilder(); |
| 828 | 829 |
| 829 if (this._dataGrid) { | 830 if (this._dataGrid) { |
| 830 this._dataGrid.rootNode().removeChildren(); | 831 this._dataGrid.rootNode().removeChildren(); |
| 831 this._updateDividersIfNeeded(); | 832 this._updateDividersIfNeeded(); |
| 832 this._updateSummaryBar(); | 833 this._updateSummaryBar(); |
| 833 } | 834 } |
| 834 | 835 |
| 835 this._mainRequestLoadTime = -1; | 836 this._mainRequestLoadTime = -1; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 899 for (var i = 0, l = responseHeaders.length; i < l; ++i) | 900 for (var i = 0, l = responseHeaders.length; i < l; ++i) |
| 900 this._suggestionBuilder.addItem(WebInspector.NetworkPanel.FilterType .HasResponseHeader, responseHeaders[i].name); | 901 this._suggestionBuilder.addItem(WebInspector.NetworkPanel.FilterType .HasResponseHeader, responseHeaders[i].name); |
| 901 var cookies = request.responseCookies; | 902 var cookies = request.responseCookies; |
| 902 for (var i = 0, l = cookies ? cookies.length : 0; i < l; ++i) { | 903 for (var i = 0, l = cookies ? cookies.length : 0; i < l; ++i) { |
| 903 var cookie = cookies[i]; | 904 var cookie = cookies[i]; |
| 904 this._suggestionBuilder.addItem(WebInspector.NetworkPanel.FilterType .SetCookieDomain, cookie.domain()); | 905 this._suggestionBuilder.addItem(WebInspector.NetworkPanel.FilterType .SetCookieDomain, cookie.domain()); |
| 905 this._suggestionBuilder.addItem(WebInspector.NetworkPanel.FilterType .SetCookieName, cookie.name()); | 906 this._suggestionBuilder.addItem(WebInspector.NetworkPanel.FilterType .SetCookieName, cookie.name()); |
| 906 this._suggestionBuilder.addItem(WebInspector.NetworkPanel.FilterType .SetCookieValue, cookie.value()); | 907 this._suggestionBuilder.addItem(WebInspector.NetworkPanel.FilterType .SetCookieValue, cookie.value()); |
| 907 } | 908 } |
| 908 | 909 |
| 909 this._staleRequests[request.requestId] = request; | 910 this._staleRequestIds[request.requestId] = true; |
| 910 this._scheduleRefresh(); | 911 this._scheduleRefresh(); |
| 911 }, | 912 }, |
| 912 | 913 |
| 913 /** | 914 /** |
| 914 * @param {!WebInspector.Event} event | 915 * @param {!WebInspector.Event} event |
| 915 */ | 916 */ |
| 916 _willReloadPage: function(event) | 917 _willReloadPage: function(event) |
| 917 { | 918 { |
| 918 this._recordButton.toggled = true; | 919 this._recordButton.toggled = true; |
| 919 if (!this._preserveLogCheckbox.checked()) | 920 if (!this._preserveLogCheckbox.checked()) |
| (...skipping 2146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3066 WebInspector.NetworkDataGridNode.RequestPropertyComparator = function(propertyNa me, revert, a, b) | 3067 WebInspector.NetworkDataGridNode.RequestPropertyComparator = function(propertyNa me, revert, a, b) |
| 3067 { | 3068 { |
| 3068 var aValue = a._request[propertyName]; | 3069 var aValue = a._request[propertyName]; |
| 3069 var bValue = b._request[propertyName]; | 3070 var bValue = b._request[propertyName]; |
| 3070 if (aValue > bValue) | 3071 if (aValue > bValue) |
| 3071 return revert ? -1 : 1; | 3072 return revert ? -1 : 1; |
| 3072 if (bValue > aValue) | 3073 if (bValue > aValue) |
| 3073 return revert ? 1 : -1; | 3074 return revert ? 1 : -1; |
| 3074 return a._request.indentityCompare(b._request); | 3075 return a._request.indentityCompare(b._request); |
| 3075 } | 3076 } |
| OLD | NEW |