| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 | 74 |
| 75 /** @type {!WebInspector.Linkifier} */ | 75 /** @type {!WebInspector.Linkifier} */ |
| 76 this.linkifier = new WebInspector.Linkifier(); | 76 this.linkifier = new WebInspector.Linkifier(); |
| 77 | 77 |
| 78 this._recording = false; | 78 this._recording = false; |
| 79 this._preserveLog = false; | 79 this._preserveLog = false; |
| 80 | 80 |
| 81 /** @type {number} */ | 81 /** @type {number} */ |
| 82 this._rowHeight = 0; | 82 this._rowHeight = 0; |
| 83 | 83 |
| 84 this._headerHeight = 0; |
| 85 this._timelineHeaderElement = null; |
| 86 |
| 84 this._addFilters(); | 87 this._addFilters(); |
| 85 this._resetSuggestionBuilder(); | 88 this._resetSuggestionBuilder(); |
| 86 this._initializeView(); | 89 this._initializeView(); |
| 87 | 90 |
| 88 WebInspector.moduleSetting("networkColorCodeResourceTypes").addChangeListene
r(this._invalidateAllItems, this); | 91 WebInspector.moduleSetting("networkColorCodeResourceTypes").addChangeListene
r(this._invalidateAllItems, this); |
| 89 this._networkLogLargeRowsSetting.addChangeListener(this._updateRowsSize, thi
s); | 92 this._networkLogLargeRowsSetting.addChangeListener(this._updateRowsSize, thi
s); |
| 90 | 93 |
| 91 WebInspector.targetManager.observeTargets(this); | 94 WebInspector.targetManager.observeTargets(this); |
| 92 WebInspector.targetManager.addModelListener(WebInspector.NetworkManager, Web
Inspector.NetworkManager.Events.RequestStarted, this._onRequestStarted, this); | 95 WebInspector.targetManager.addModelListener(WebInspector.NetworkManager, Web
Inspector.NetworkManager.Events.RequestStarted, this._onRequestStarted, this); |
| 93 WebInspector.targetManager.addModelListener(WebInspector.NetworkManager, Web
Inspector.NetworkManager.Events.RequestUpdated, this._onRequestUpdated, this); | 96 WebInspector.targetManager.addModelListener(WebInspector.NetworkManager, Web
Inspector.NetworkManager.Events.RequestUpdated, this._onRequestUpdated, this); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 /** @enum {string} */ | 140 /** @enum {string} */ |
| 138 WebInspector.NetworkLogView.IsFilterType = { | 141 WebInspector.NetworkLogView.IsFilterType = { |
| 139 Running: "running" | 142 Running: "running" |
| 140 }; | 143 }; |
| 141 | 144 |
| 142 /** @type {!Array<string>} */ | 145 /** @type {!Array<string>} */ |
| 143 WebInspector.NetworkLogView._searchKeys = Object.keys(WebInspector.NetworkLogVie
w.FilterType).map(key => WebInspector.NetworkLogView.FilterType[key]); | 146 WebInspector.NetworkLogView._searchKeys = Object.keys(WebInspector.NetworkLogVie
w.FilterType).map(key => WebInspector.NetworkLogView.FilterType[key]); |
| 144 | 147 |
| 145 WebInspector.NetworkLogView.prototype = { | 148 WebInspector.NetworkLogView.prototype = { |
| 146 /** | 149 /** |
| 150 * @return {number} |
| 151 */ |
| 152 headerHeight: function() |
| 153 { |
| 154 return this._headerHeight; |
| 155 }, |
| 156 |
| 157 /** |
| 147 * @param {boolean} recording | 158 * @param {boolean} recording |
| 148 */ | 159 */ |
| 149 setRecording: function(recording) | 160 setRecording: function(recording) |
| 150 { | 161 { |
| 151 this._recording = recording; | 162 this._recording = recording; |
| 152 this._updateSummaryBar(); | 163 this._updateSummaryBar(); |
| 153 }, | 164 }, |
| 154 | 165 |
| 155 /** | 166 /** |
| 156 * @param {boolean} preserveLog | 167 * @param {boolean} preserveLog |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 _initializeView: function() | 273 _initializeView: function() |
| 263 { | 274 { |
| 264 this.element.id = "network-container"; | 275 this.element.id = "network-container"; |
| 265 | 276 |
| 266 /** @type {!WebInspector.NetworkTransferTimeCalculator} */ | 277 /** @type {!WebInspector.NetworkTransferTimeCalculator} */ |
| 267 this._timeCalculator = new WebInspector.NetworkTransferTimeCalculator(); | 278 this._timeCalculator = new WebInspector.NetworkTransferTimeCalculator(); |
| 268 /** @type {!WebInspector.NetworkTransferDurationCalculator} */ | 279 /** @type {!WebInspector.NetworkTransferDurationCalculator} */ |
| 269 this._durationCalculator = new WebInspector.NetworkTransferDurationCalcu
lator(); | 280 this._durationCalculator = new WebInspector.NetworkTransferDurationCalcu
lator(); |
| 270 this._calculator = this._timeCalculator; | 281 this._calculator = this._timeCalculator; |
| 271 | 282 |
| 272 this._createTable(); | 283 if (Runtime.experiments.isEnabled("canvasNetworkTimeline")) { |
| 273 this._summaryBarElement = this.element.createChild("div", "network-summa
ry-bar"); | 284 this._splitWidget = new WebInspector.SplitWidget(true, false, "netwo
rkPanelSplitViewTimeline"); |
| 285 this._splitWidget.show(this.element); |
| 286 this._createTable(); |
| 287 this._splitWidget.setSidebarWidget(this._dataGrid.asWidget()); |
| 274 | 288 |
| 289 this._summaryBarElement = this.element.createChild("div", "network-s
ummary-bar"); |
| 290 |
| 291 this._timelineWidget = new WebInspector.VBox(); |
| 292 this._createTimelineHeader(); |
| 293 this._timelineWidget.element.classList.add("network-timeline-view"); |
| 294 this._splitWidget.setMainWidget(this._timelineWidget); |
| 295 |
| 296 var networkTimelineView = new WebInspector.NetworkTimelineColumn(thi
s, this._dataGrid); |
| 297 networkTimelineView.show(this._timelineWidget.element); |
| 298 this.switchViewMode(false); |
| 299 } else { |
| 300 this._createTable(); |
| 301 this._dataGrid.asWidget().show(this.element); |
| 302 this._summaryBarElement = this.element.createChild("div", "network-s
ummary-bar"); |
| 303 } |
| 304 |
| 305 this._columns.sortByCurrentColumn(); |
| 275 this._updateRowsSize(); | 306 this._updateRowsSize(); |
| 276 }, | 307 }, |
| 277 | 308 |
| 278 _showRecordingHint: function() | 309 _showRecordingHint: function() |
| 279 { | 310 { |
| 280 this._hideRecordingHint(); | 311 this._hideRecordingHint(); |
| 281 this._recordingHint = this.element.createChild("div", "network-status-pa
ne fill"); | 312 this._recordingHint = this.element.createChild("div", "network-status-pa
ne fill"); |
| 282 var hintText = this._recordingHint.createChild("div", "recording-hint"); | 313 var hintText = this._recordingHint.createChild("div", "recording-hint"); |
| 283 var reloadShortcutNode = this._recordingHint.createChild("b"); | 314 var reloadShortcutNode = this._recordingHint.createChild("b"); |
| 284 reloadShortcutNode.textContent = WebInspector.shortcutRegistry.shortcutD
escriptorsForAction("main.reload")[0].name; | 315 reloadShortcutNode.textContent = WebInspector.shortcutRegistry.shortcutD
escriptorsForAction("main.reload")[0].name; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 { | 348 { |
| 318 this._dataGrid = this._columns.createGrid(this._timeCalculator, this._du
rationCalculator); | 349 this._dataGrid = this._columns.createGrid(this._timeCalculator, this._du
rationCalculator); |
| 319 this._dataGrid.setStickToBottom(true); | 350 this._dataGrid.setStickToBottom(true); |
| 320 this._dataGrid.setName("networkLog"); | 351 this._dataGrid.setName("networkLog"); |
| 321 this._dataGrid.setResizeMethod(WebInspector.DataGrid.ResizeMethod.Last); | 352 this._dataGrid.setResizeMethod(WebInspector.DataGrid.ResizeMethod.Last); |
| 322 this._dataGrid.element.classList.add("network-log-grid"); | 353 this._dataGrid.element.classList.add("network-log-grid"); |
| 323 this._dataGrid.element.addEventListener("contextmenu", this._contextMenu
.bind(this), true); | 354 this._dataGrid.element.addEventListener("contextmenu", this._contextMenu
.bind(this), true); |
| 324 this._dataGrid.element.addEventListener("mousedown", this._dataGridMouse
Down.bind(this), true); | 355 this._dataGrid.element.addEventListener("mousedown", this._dataGridMouse
Down.bind(this), true); |
| 325 this._dataGrid.element.addEventListener("mousemove", this._dataGridMouse
Move.bind(this), true); | 356 this._dataGrid.element.addEventListener("mousemove", this._dataGridMouse
Move.bind(this), true); |
| 326 this._dataGrid.element.addEventListener("mouseleave", this._highlightIni
tiatorChain.bind(this, null), true); | 357 this._dataGrid.element.addEventListener("mouseleave", this._highlightIni
tiatorChain.bind(this, null), true); |
| 327 this._columns.sortByCurrentColumn(); | |
| 328 }, | 358 }, |
| 329 | 359 |
| 330 /** | 360 /** |
| 331 * @param {!Event} event | 361 * @param {!Event} event |
| 332 */ | 362 */ |
| 333 _dataGridMouseDown: function(event) | 363 _dataGridMouseDown: function(event) |
| 334 { | 364 { |
| 335 if ((!this._dataGrid.selectedNode && event.button) || event.target.enclo
singNodeOrSelfWithNodeName("a")) | 365 if ((!this._dataGrid.selectedNode && event.button) || event.target.enclo
singNodeOrSelfWithNodeName("a")) |
| 336 event.consume(); | 366 event.consume(); |
| 337 }, | 367 }, |
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 803 for (var i = 0; i < requestsToPick.length; ++i) { | 833 for (var i = 0; i < requestsToPick.length; ++i) { |
| 804 var request = requestsToPick[i]; | 834 var request = requestsToPick[i]; |
| 805 var node = this._nodesByRequestId.get(request.requestId); | 835 var node = this._nodesByRequestId.get(request.requestId); |
| 806 if (node) { | 836 if (node) { |
| 807 node.markAsNavigationRequest(); | 837 node.markAsNavigationRequest(); |
| 808 break; | 838 break; |
| 809 } | 839 } |
| 810 } | 840 } |
| 811 }, | 841 }, |
| 812 | 842 |
| 843 _createTimelineHeader: function() |
| 844 { |
| 845 this._timelineHeaderElement = this._timelineWidget.element.createChild("
div", "network-timeline-header"); |
| 846 this._timelineHeaderElement.addEventListener("click", timelineHeaderClic
ked.bind(this)); |
| 847 this._timelineHeaderElement.addEventListener("contextmenu", this._contex
tMenu.bind(this)); |
| 848 var innerElement = this._timelineHeaderElement.createChild("div"); |
| 849 innerElement.textContent = WebInspector.UIString("Timeline"); |
| 850 this._timelineColumnSortIcon = this._timelineHeaderElement.createChild("
div", "sort-order-icon-container").createChild("div", "sort-order-icon"); |
| 851 |
| 852 /** |
| 853 * @this {WebInspector.NetworkLogView} |
| 854 */ |
| 855 function timelineHeaderClicked() |
| 856 { |
| 857 var sortOrders = WebInspector.DataGrid.Order; |
| 858 var sortOrder = this._dataGrid.sortOrder() === sortOrders.Ascending
? sortOrders.Descending : sortOrders.Ascending; |
| 859 this._dataGrid.markColumnAsSortedBy("timeline", sortOrder); |
| 860 this._columns.sortByCurrentColumn(); |
| 861 } |
| 862 }, |
| 863 |
| 813 /** | 864 /** |
| 814 * @param {boolean} gridMode | 865 * @param {boolean} gridMode |
| 815 */ | 866 */ |
| 816 switchViewMode: function(gridMode) | 867 switchViewMode: function(gridMode) |
| 817 { | 868 { |
| 818 this._columns.switchViewMode(gridMode); | 869 this._columns.switchViewMode(gridMode); |
| 870 if (!Runtime.experiments.isEnabled("canvasNetworkTimeline")) |
| 871 return; |
| 872 |
| 873 if (gridMode && this._nodesByRequestId.size) |
| 874 this._splitWidget.showBoth(); |
| 875 else |
| 876 this._splitWidget.hideMain(); |
| 819 }, | 877 }, |
| 820 | 878 |
| 821 /** | 879 /** |
| 822 * @return {number} | 880 * @return {number} |
| 823 */ | 881 */ |
| 824 rowHeight: function() | 882 rowHeight: function() |
| 825 { | 883 { |
| 826 return this._rowHeight; | 884 return this._rowHeight; |
| 827 }, | 885 }, |
| 828 | 886 |
| 829 _updateRowsSize: function() | 887 _updateRowsSize: function() |
| 830 { | 888 { |
| 831 var largeRows = !!this._networkLogLargeRowsSetting.get(); | 889 var largeRows = !!this._networkLogLargeRowsSetting.get(); |
| 890 // TODO(allada) Make these non-magic numbers. |
| 832 this._rowHeight = largeRows ? 41 : 21; | 891 this._rowHeight = largeRows ? 41 : 21; |
| 892 this._headerHeight = largeRows ? 31 : 27; |
| 833 this._dataGrid.element.classList.toggle("small", !largeRows); | 893 this._dataGrid.element.classList.toggle("small", !largeRows); |
| 894 if (Runtime.experiments.isEnabled("canvasNetworkTimeline")) |
| 895 this._timelineHeaderElement.classList.toggle("small", !largeRows); |
| 834 this._dataGrid.scheduleUpdate(); | 896 this._dataGrid.scheduleUpdate(); |
| 835 }, | 897 }, |
| 836 | 898 |
| 837 /** | 899 /** |
| 838 * @param {!Event} event | 900 * @param {!Event} event |
| 839 */ | 901 */ |
| 840 _contextMenu: function(event) | 902 _contextMenu: function(event) |
| 841 { | 903 { |
| 842 // TODO(allada) Fix datagrid's contextmenu so NetworkLogViewColumns can
attach it's own contextmenu event | 904 // TODO(allada) Fix datagrid's contextmenu so NetworkLogViewColumns can
attach it's own contextmenu event |
| 843 if (this._columns.contextMenu(event)) | 905 if (this._columns.contextMenu(event)) |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1051 { | 1113 { |
| 1052 this.removeAllNodeHighlights(); | 1114 this.removeAllNodeHighlights(); |
| 1053 for (var i = 0; i < this._highlightedSubstringChanges.length; ++i) | 1115 for (var i = 0; i < this._highlightedSubstringChanges.length; ++i) |
| 1054 WebInspector.revertDomChanges(this._highlightedSubstringChanges[i]); | 1116 WebInspector.revertDomChanges(this._highlightedSubstringChanges[i]); |
| 1055 this._highlightedSubstringChanges = []; | 1117 this._highlightedSubstringChanges = []; |
| 1056 }, | 1118 }, |
| 1057 | 1119 |
| 1058 dataGridSorted: function() | 1120 dataGridSorted: function() |
| 1059 { | 1121 { |
| 1060 this._highlightNthMatchedRequestForSearch(this._updateMatchCountAndFindM
atchIndex(this._currentMatchedRequestNode), false); | 1122 this._highlightNthMatchedRequestForSearch(this._updateMatchCountAndFindM
atchIndex(this._currentMatchedRequestNode), false); |
| 1123 |
| 1124 if (!Runtime.experiments.isEnabled("canvasNetworkTimeline")) |
| 1125 return; |
| 1126 |
| 1127 this._timelineColumnSortIcon.classList.remove("sort-ascending", "sort-de
scending"); |
| 1128 if (this._dataGrid.sortColumnIdentifier() !== "timeline") |
| 1129 return; |
| 1130 |
| 1131 if (this._dataGrid.sortOrder() === WebInspector.DataGrid.Order.Ascending
) |
| 1132 this._timelineColumnSortIcon.classList.add("sort-ascending"); |
| 1133 else |
| 1134 this._timelineColumnSortIcon.classList.add("sort-descending"); |
| 1061 }, | 1135 }, |
| 1062 | 1136 |
| 1063 /** | 1137 /** |
| 1064 * @param {number} n | 1138 * @param {number} n |
| 1065 * @param {boolean} reveal | 1139 * @param {boolean} reveal |
| 1066 */ | 1140 */ |
| 1067 _highlightNthMatchedRequestForSearch: function(n, reveal) | 1141 _highlightNthMatchedRequestForSearch: function(n, reveal) |
| 1068 { | 1142 { |
| 1069 this._removeAllHighlights(); | 1143 this._removeAllHighlights(); |
| 1070 | 1144 |
| (...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1739 * @return {boolean} | 1813 * @return {boolean} |
| 1740 */ | 1814 */ |
| 1741 WebInspector.NetworkLogView._requestTimeFilter = function(windowStart, windowEnd
, request) | 1815 WebInspector.NetworkLogView._requestTimeFilter = function(windowStart, windowEnd
, request) |
| 1742 { | 1816 { |
| 1743 if (request.issueTime() > windowEnd) | 1817 if (request.issueTime() > windowEnd) |
| 1744 return false; | 1818 return false; |
| 1745 if (request.endTime !== -1 && request.endTime < windowStart) | 1819 if (request.endTime !== -1 && request.endTime < windowStart) |
| 1746 return false; | 1820 return false; |
| 1747 return true; | 1821 return true; |
| 1748 } | 1822 } |
| OLD | NEW |