Changeset 64037 in webkit
- Timestamp:
- Jul 26, 2010 2:37:38 AM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r64034 r64037 1 2010-07-26 Alexander Pavlov <apavlov@chromium.org> 2 3 Reviewed by Joseph Pecoraro. 4 5 Inspector should remember resources sorting set by the user 6 https://bugs.webkit.org/show_bug.cgi?id=19208 7 8 Sorting options both for time and size graphs are memorized in a single property, 9 which makes them possible to retrieve in a single message (e.g. useful for remote debugging). 10 11 * inspector/front-end/ResourcesPanel.js: 12 (WebInspector.ResourcesPanel.prototype.populateSidebar): 13 (WebInspector.ResourcesPanel.prototype._settingsLoaded): 14 (WebInspector.ResourcesPanel.prototype._loadSortOptions): 15 (WebInspector.ResourcesPanel.prototype._loadSortOptionForGraph): 16 (WebInspector.ResourcesPanel.prototype._graphSelected): 17 (WebInspector.ResourcesPanel.prototype._changeSortingFunction): 18 (WebInspector.ResourcesPanel.prototype._selectedOptionNameForGraph): 19 (WebInspector.ResourcesPanel.prototype._doChangeSortingFunction): 20 * inspector/front-end/Settings.js: 21 (WebInspector.populateApplicationSettings): 22 1 23 2010-07-25 Ryosuke Niwa <rniwa@webkit.org> 2 24 -
trunk/WebCore/inspector/front-end/ResourcesPanel.js
r63741 r64037 83 83 populateSidebar: function() 84 84 { 85 vartimeGraphItem = new WebInspector.SidebarTreeElement("resources-time-graph-sidebar-item", WebInspector.UIString("Time"));86 t imeGraphItem.onselect = this._graphSelected.bind(this);85 this.timeGraphItem = new WebInspector.SidebarTreeElement("resources-time-graph-sidebar-item", WebInspector.UIString("Time")); 86 this.timeGraphItem.onselect = this._graphSelected.bind(this); 87 87 88 88 var transferTimeCalculator = new WebInspector.ResourceTransferTimeCalculator(); 89 89 var transferDurationCalculator = new WebInspector.ResourceTransferDurationCalculator(); 90 90 91 t imeGraphItem.sortingOptions = [92 { name: WebInspector.UIString("Sort by Start Time"), sortingFunction: WebInspector.ResourceSidebarTreeElement.CompareByAscendingStartTime, calculator: transferTimeCalculator },93 { name: WebInspector.UIString("Sort by Response Time"), sortingFunction: WebInspector.ResourceSidebarTreeElement.CompareByAscendingResponseReceivedTime, calculator: transferTimeCalculator },94 { name: WebInspector.UIString("Sort by End Time"), sortingFunction: WebInspector.ResourceSidebarTreeElement.CompareByAscendingEndTime, calculator: transferTimeCalculator },95 { name: WebInspector.UIString("Sort by Duration"), sortingFunction: WebInspector.ResourceSidebarTreeElement.CompareByDescendingDuration, calculator: transferDurationCalculator },96 { name: WebInspector.UIString("Sort by Latency"), sortingFunction: WebInspector.ResourceSidebarTreeElement.CompareByDescendingLatency, calculator: transferDurationCalculator },91 this.timeGraphItem.sortingOptions = [ 92 { name: WebInspector.UIString("Sort by Start Time"), sortingFunction: WebInspector.ResourceSidebarTreeElement.CompareByAscendingStartTime, calculator: transferTimeCalculator, optionName: "startTime" }, 93 { name: WebInspector.UIString("Sort by Response Time"), sortingFunction: WebInspector.ResourceSidebarTreeElement.CompareByAscendingResponseReceivedTime, calculator: transferTimeCalculator, optionName: "responseTime" }, 94 { name: WebInspector.UIString("Sort by End Time"), sortingFunction: WebInspector.ResourceSidebarTreeElement.CompareByAscendingEndTime, calculator: transferTimeCalculator, optionName: "endTime" }, 95 { name: WebInspector.UIString("Sort by Duration"), sortingFunction: WebInspector.ResourceSidebarTreeElement.CompareByDescendingDuration, calculator: transferDurationCalculator, optionName: "duration" }, 96 { name: WebInspector.UIString("Sort by Latency"), sortingFunction: WebInspector.ResourceSidebarTreeElement.CompareByDescendingLatency, calculator: transferDurationCalculator, optionName: "latency" }, 97 97 ]; 98 98 99 t imeGraphItem.isBarOpaqueAtLeft = false;100 t imeGraphItem.selectedSortingOptionIndex = 1;99 this.timeGraphItem.isBarOpaqueAtLeft = false; 100 this.timeGraphItem.selectedSortingOptionIndex = 1; 101 101 102 102 this.sizeGraphItem = new WebInspector.SidebarTreeElement("resources-size-graph-sidebar-item", WebInspector.UIString("Size")); … … 105 105 var transferSizeCalculator = new WebInspector.ResourceTransferSizeCalculator(); 106 106 this.sizeGraphItem.sortingOptions = [ 107 { name: WebInspector.UIString("Sort by Transfer Size"), sortingFunction: WebInspector.ResourceSidebarTreeElement.CompareByDescendingTransferSize, calculator: transferSizeCalculator },108 { name: WebInspector.UIString("Sort by Size"), sortingFunction: WebInspector.ResourceSidebarTreeElement.CompareByDescendingSize, calculator: transferSizeCalculator },107 { name: WebInspector.UIString("Sort by Transfer Size"), sortingFunction: WebInspector.ResourceSidebarTreeElement.CompareByDescendingTransferSize, calculator: transferSizeCalculator, optionName: "transferSize" }, 108 { name: WebInspector.UIString("Sort by Size"), sortingFunction: WebInspector.ResourceSidebarTreeElement.CompareByDescendingSize, calculator: transferSizeCalculator, optionName: "size" }, 109 109 ]; 110 110 … … 115 115 this.sidebarTree.appendChild(this.graphsTreeElement); 116 116 117 this.graphsTreeElement.appendChild(t imeGraphItem);117 this.graphsTreeElement.appendChild(this.timeGraphItem); 118 118 this.graphsTreeElement.appendChild(this.sizeGraphItem); 119 119 this.graphsTreeElement.expand(); … … 161 161 if (!WebInspector.applicationSettings.resourcesLargeRows) 162 162 this._setLargerResources(WebInspector.applicationSettings.resourcesLargeRows); 163 this._loadSortOptions(); 164 }, 165 166 _loadSortOptions: function() 167 { 168 var newOptions = WebInspector.applicationSettings.resourcesSortOptions; 169 if (!newOptions) 170 return; 171 172 this._loadSortOptionForGraph(this.timeGraphItem, newOptions.timeOption || "responseTime"); 173 this._loadSortOptionForGraph(this.sizeGraphItem, newOptions.sizeOption || "transferSize"); 174 }, 175 176 _loadSortOptionForGraph: function(graphItem, newOptionName) 177 { 178 var sortingOptions = graphItem.sortingOptions; 179 for (var i = 0; i < sortingOptions.length; ++i) { 180 if (sortingOptions[i].optionName === newOptionName) { 181 graphItem.selectedSortingOptionIndex = i; 182 // Propagate the option change down to the currently selected option. 183 if (this._lastSelectedGraphTreeElement === graphItem) { 184 this._lastSelectedGraphTreeElement = null; 185 this._graphSelected(graphItem); 186 } 187 } 188 } 163 189 }, 164 190 … … 619 645 option.sortingFunction = sortingOption.sortingFunction; 620 646 option.calculator = sortingOption.calculator; 647 option.optionName = sortingOption.optionName; 621 648 this.sortingSelectElement.appendChild(option); 622 649 } 623 650 624 651 this.sortingSelectElement.selectedIndex = treeElement.selectedSortingOptionIndex; 625 this._ changeSortingFunction();652 this._doChangeSortingFunction(); 626 653 627 654 this.closeVisibleResource(); … … 659 686 _changeSortingFunction: function() 660 687 { 661 var selectedOption = this.sortingSelectElement[this.sortingSelectElement.selectedIndex]; 688 this._doChangeSortingFunction(); 689 WebInspector.applicationSettings.resourcesSortOptions = {timeOption: this._selectedOptionNameForGraph(this.timeGraphItem), sizeOption: this._selectedOptionNameForGraph(this.sizeGraphItem)}; 690 }, 691 692 _selectedOptionNameForGraph: function(graphItem) 693 { 694 return graphItem.sortingOptions[graphItem.selectedSortingOptionIndex].optionName; 695 }, 696 697 _doChangeSortingFunction: function() 698 { 699 var selectedIndex = this.sortingSelectElement.selectedIndex; 700 if (this._lastSelectedGraphTreeElement) 701 this._lastSelectedGraphTreeElement.selectedSortingOptionIndex = selectedIndex; 702 var selectedOption = this.sortingSelectElement[selectedIndex]; 662 703 this.sortingFunction = selectedOption.sortingFunction; 663 704 this.calculator = this.summaryBar.calculator = selectedOption.calculator; -
trunk/WebCore/inspector/front-end/Settings.js
r63889 r64037 59 59 WebInspector.applicationSettings.installSetting("resourceViewTab", "resource-view-tab", "content"); 60 60 WebInspector.applicationSettings.installSetting("consoleHistory", "console-history", []); 61 WebInspector.applicationSettings.installSetting("resourcesSortOptions", "resources-sort-options", {timeOption: "responseTime", sizeOption: "transferSize"}); 61 62 62 63 WebInspector.applicationSettings.dispatchEventToListeners("loaded");
Note: See TracChangeset
for help on using the changeset viewer.