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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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; | 84 this._headerHeight = 0; |
85 this._timelineHeaderElement = null; | 85 this._timelineHeaderElement = null; |
86 this._timelineRequestsAreStale = false; | |
86 | 87 |
87 this._addFilters(); | 88 this._addFilters(); |
88 this._resetSuggestionBuilder(); | 89 this._resetSuggestionBuilder(); |
89 this._initializeView(); | 90 this._initializeView(); |
90 | 91 |
91 WebInspector.moduleSetting("networkColorCodeResourceTypes").addChangeListene r(this._invalidateAllItems, this); | 92 WebInspector.moduleSetting("networkColorCodeResourceTypes").addChangeListene r(this._invalidateAllItems, this); |
92 this._networkLogLargeRowsSetting.addChangeListener(this._updateRowsSize, thi s); | 93 this._networkLogLargeRowsSetting.addChangeListener(this._updateRowsSize, thi s); |
93 | 94 |
94 WebInspector.targetManager.observeTargets(this); | 95 WebInspector.targetManager.observeTargets(this); |
95 WebInspector.targetManager.addModelListener(WebInspector.NetworkManager, Web Inspector.NetworkManager.Events.RequestStarted, this._onRequestStarted, this); | 96 WebInspector.targetManager.addModelListener(WebInspector.NetworkManager, Web Inspector.NetworkManager.Events.RequestStarted, this._onRequestStarted, this); |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
286 this._createTable(); | 287 this._createTable(); |
287 this._splitWidget.setSidebarWidget(this._dataGrid.asWidget()); | 288 this._splitWidget.setSidebarWidget(this._dataGrid.asWidget()); |
288 | 289 |
289 this._summaryBarElement = this.element.createChild("div", "network-s ummary-bar"); | 290 this._summaryBarElement = this.element.createChild("div", "network-s ummary-bar"); |
290 | 291 |
291 this._timelineWidget = new WebInspector.VBox(); | 292 this._timelineWidget = new WebInspector.VBox(); |
292 this._createTimelineHeader(); | 293 this._createTimelineHeader(); |
293 this._timelineWidget.element.classList.add("network-timeline-view"); | 294 this._timelineWidget.element.classList.add("network-timeline-view"); |
294 this._splitWidget.setMainWidget(this._timelineWidget); | 295 this._splitWidget.setMainWidget(this._timelineWidget); |
295 | 296 |
296 this._timelineColumn = new WebInspector.NetworkTimelineColumn(this, this._dataGrid); | 297 this._timelineColumn = new WebInspector.NetworkTimelineColumn(this._ rowHeight, this._headerHeight, this._calculator, this._dataGrid.scrollContainer) ; |
298 | |
299 var dataGridScroller = this._dataGrid.scrollContainer; | |
300 this._dataGrid.setScrollContainer(this._timelineColumn.getScrollCont ainer()); | |
301 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.Padding Changed, () => { | |
302 this._timelineColumn.setScrollHeight(dataGridScroller.scrollHeig ht) | |
303 }); | |
304 this._dataGrid.addEventListener(WebInspector.ViewportDataGrid.Events .ViewportCalculated, this._redrawTimelineColumn.bind(this)); | |
305 | |
297 this._timelineColumn.addEventListener(WebInspector.NetworkTimelineCo lumn.Events.RequestHovered, requestHovered.bind(this)); | 306 this._timelineColumn.addEventListener(WebInspector.NetworkTimelineCo lumn.Events.RequestHovered, requestHovered.bind(this)); |
298 this._timelineColumn.show(this._timelineWidget.element); | 307 this._timelineColumn.show(this._timelineWidget.element); |
299 this.switchViewMode(false); | 308 this.switchViewMode(false); |
300 } else { | 309 } else { |
301 this._createTable(); | 310 this._createTable(); |
302 this._dataGrid.asWidget().show(this.element); | 311 this._dataGrid.asWidget().show(this.element); |
303 this._summaryBarElement = this.element.createChild("div", "network-s ummary-bar"); | 312 this._summaryBarElement = this.element.createChild("div", "network-s ummary-bar"); |
304 } | 313 } |
305 | 314 |
306 this._columns.sortByCurrentColumn(); | 315 this._columns.sortByCurrentColumn(); |
307 this._updateRowsSize(); | 316 this._updateRowsSize(); |
308 | 317 |
309 /** | 318 /** |
310 * @param {!WebInspector.Event} event | 319 * @param {!WebInspector.Event} event |
311 * @this {WebInspector.NetworkLogView} | 320 * @this {WebInspector.NetworkLogView} |
312 */ | 321 */ |
313 function requestHovered(event) | 322 function requestHovered(event) |
314 { | 323 { |
315 var request = /** @type {?WebInspector.NetworkRequest} */ (event.dat a); | 324 var request = /** @type {?WebInspector.NetworkRequest} */ (event.dat a); |
316 var node = request ? this._nodesByRequestId.get(request.requestId) : null; | 325 var node = request ? this._nodesByRequestId.get(request.requestId) : null; |
317 this._setHoveredNode(node || null); | 326 this._setHoveredNode(node || null); |
318 } | 327 } |
319 }, | 328 }, |
320 | 329 |
330 _redrawTimelineColumn: function() | |
331 { | |
332 if (this._timelineRequestsAreStale) | |
333 this._timelineColumn.setRequests(this._getOrderedRequests()); | |
334 this._timelineColumn.draw(); | |
dgozman
2016/10/20 23:20:08
Let's add an optional |requests| parameter to draw
allada
2016/10/20 23:48:19
Done.
| |
335 }, | |
336 | |
321 _showRecordingHint: function() | 337 _showRecordingHint: function() |
322 { | 338 { |
323 this._hideRecordingHint(); | 339 this._hideRecordingHint(); |
324 this._recordingHint = this.element.createChild("div", "network-status-pa ne fill"); | 340 this._recordingHint = this.element.createChild("div", "network-status-pa ne fill"); |
325 var hintText = this._recordingHint.createChild("div", "recording-hint"); | 341 var hintText = this._recordingHint.createChild("div", "recording-hint"); |
326 var reloadShortcutNode = this._recordingHint.createChild("b"); | 342 var reloadShortcutNode = this._recordingHint.createChild("b"); |
327 reloadShortcutNode.textContent = WebInspector.shortcutRegistry.shortcutD escriptorsForAction("main.reload")[0].name; | 343 reloadShortcutNode.textContent = WebInspector.shortcutRegistry.shortcutD escriptorsForAction("main.reload")[0].name; |
328 | 344 |
329 if (this._recording) { | 345 if (this._recording) { |
330 var recordingText = hintText.createChild("span"); | 346 var recordingText = hintText.createChild("span"); |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
579 }, | 595 }, |
580 | 596 |
581 /** | 597 /** |
582 * @param {!WebInspector.NetworkTimeCalculator} x | 598 * @param {!WebInspector.NetworkTimeCalculator} x |
583 */ | 599 */ |
584 setCalculator: function(x) | 600 setCalculator: function(x) |
585 { | 601 { |
586 if (!x || this._calculator === x) | 602 if (!x || this._calculator === x) |
587 return; | 603 return; |
588 | 604 |
589 this._calculator = x; | 605 if (this._calculator !== x) { |
606 this._calculator = x; | |
607 if (Runtime.experiments.isEnabled("canvasNetworkTimeline")) | |
608 this._timelineColumn.setCalculator(this._calculator); | |
609 } | |
590 this._calculator.reset(); | 610 this._calculator.reset(); |
591 | 611 |
592 if (this._calculator.startAtZero) | 612 if (this._calculator.startAtZero) |
593 this._columns.hideEventDividers(); | 613 this._columns.hideEventDividers(); |
594 else | 614 else |
595 this._columns.showEventDividers(); | 615 this._columns.showEventDividers(); |
596 | 616 |
597 this._invalidateAllItems(); | 617 this._invalidateAllItems(); |
598 }, | 618 }, |
599 | 619 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
697 if (!this.calculator().boundary().equals(oldBoundary)) { | 717 if (!this.calculator().boundary().equals(oldBoundary)) { |
698 // The boundaries changed, so all item graphs are stale. | 718 // The boundaries changed, so all item graphs are stale. |
699 this._columns.updateDividersIfNeeded(); | 719 this._columns.updateDividersIfNeeded(); |
700 var nodes = this._nodesByRequestId.valuesArray(); | 720 var nodes = this._nodesByRequestId.valuesArray(); |
701 for (var i = 0; i < nodes.length; ++i) | 721 for (var i = 0; i < nodes.length; ++i) |
702 nodes[i].refreshGraph(); | 722 nodes[i].refreshGraph(); |
703 } | 723 } |
704 | 724 |
705 this._staleRequestIds = {}; | 725 this._staleRequestIds = {}; |
706 this._updateSummaryBar(); | 726 this._updateSummaryBar(); |
727 | |
707 if (Runtime.experiments.isEnabled("canvasNetworkTimeline")) | 728 if (Runtime.experiments.isEnabled("canvasNetworkTimeline")) |
708 this._timelineColumn.scheduleRefreshData(); | 729 this._timelineRequestsAreStale = true; |
730 }, | |
731 | |
732 _getOrderedRequests: function() | |
733 { | |
734 var currentNode = this._dataGrid.rootNode(); | |
735 var requestData = []; | |
736 while (currentNode = currentNode.traverseNextNode(true)) | |
737 requestData.push(currentNode.request()); | |
738 return requestData; | |
709 }, | 739 }, |
710 | 740 |
711 reset: function() | 741 reset: function() |
712 { | 742 { |
713 this._requestWithHighlightedInitiators = null; | 743 this._requestWithHighlightedInitiators = null; |
714 this.dispatchEventToListeners(WebInspector.NetworkLogView.Events.Request Selected, null); | 744 this.dispatchEventToListeners(WebInspector.NetworkLogView.Events.Request Selected, null); |
715 | 745 |
716 this._clearSearchMatchedList(); | 746 this._clearSearchMatchedList(); |
717 | 747 |
718 this._columns.reset(); | 748 this._columns.reset(); |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
917 */ | 947 */ |
918 rowHeight: function() | 948 rowHeight: function() |
919 { | 949 { |
920 return this._rowHeight; | 950 return this._rowHeight; |
921 }, | 951 }, |
922 | 952 |
923 _updateRowsSize: function() | 953 _updateRowsSize: function() |
924 { | 954 { |
925 var largeRows = !!this._networkLogLargeRowsSetting.get(); | 955 var largeRows = !!this._networkLogLargeRowsSetting.get(); |
926 // TODO(allada) Make these non-magic numbers. | 956 // TODO(allada) Make these non-magic numbers. |
927 this._rowHeight = largeRows ? 41 : 21; | 957 var rowHeight = largeRows ? 41 : 21; |
928 this._headerHeight = largeRows ? 31 : 27; | 958 var headerHeight = largeRows ? 31 : 27; |
959 if (this._rowHeight !== rowHeight) { | |
960 this._rowHeight = rowHeight; | |
961 if (Runtime.experiments.isEnabled("canvasNetworkTimeline")) | |
962 this._timelineColumn.setRowHeight(this._rowHeight); | |
963 } | |
964 if (this._headerHeight !== headerHeight) { | |
965 this._headerHeight = headerHeight; | |
966 if (Runtime.experiments.isEnabled("canvasNetworkTimeline")) | |
967 this._timelineColumn.setHeaderHeight(this._headerHeight); | |
968 } | |
969 | |
929 this._dataGrid.element.classList.toggle("small", !largeRows); | 970 this._dataGrid.element.classList.toggle("small", !largeRows); |
930 if (Runtime.experiments.isEnabled("canvasNetworkTimeline")) | 971 if (Runtime.experiments.isEnabled("canvasNetworkTimeline")) |
931 this._timelineHeaderElement.classList.toggle("small", !largeRows); | 972 this._timelineHeaderElement.classList.toggle("small", !largeRows); |
932 this._dataGrid.scheduleUpdate(); | 973 this._dataGrid.scheduleUpdate(); |
933 }, | 974 }, |
934 | 975 |
935 /** | 976 /** |
936 * @param {!Event} event | 977 * @param {!Event} event |
937 */ | 978 */ |
938 _contextMenu: function(event) | 979 _contextMenu: function(event) |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1162 | 1203 |
1163 this._timelineColumnSortIcon.classList.remove("sort-ascending", "sort-de scending"); | 1204 this._timelineColumnSortIcon.classList.remove("sort-ascending", "sort-de scending"); |
1164 | 1205 |
1165 if (this._dataGrid.sortColumnIdentifier() === "timeline") { | 1206 if (this._dataGrid.sortColumnIdentifier() === "timeline") { |
1166 if (this._dataGrid.sortOrder() === WebInspector.DataGrid.Order.Ascen ding) | 1207 if (this._dataGrid.sortOrder() === WebInspector.DataGrid.Order.Ascen ding) |
1167 this._timelineColumnSortIcon.classList.add("sort-ascending"); | 1208 this._timelineColumnSortIcon.classList.add("sort-ascending"); |
1168 else | 1209 else |
1169 this._timelineColumnSortIcon.classList.add("sort-descending"); | 1210 this._timelineColumnSortIcon.classList.add("sort-descending"); |
1170 } | 1211 } |
1171 | 1212 |
1172 this._timelineColumn.scheduleRefreshData(); | 1213 this._timelineRequestsAreStale = true; |
1173 }, | 1214 }, |
1174 | 1215 |
1175 /** | 1216 /** |
1176 * @param {number} n | 1217 * @param {number} n |
1177 * @param {boolean} reveal | 1218 * @param {boolean} reveal |
1178 */ | 1219 */ |
1179 _highlightNthMatchedRequestForSearch: function(n, reveal) | 1220 _highlightNthMatchedRequestForSearch: function(n, reveal) |
1180 { | 1221 { |
1181 this._removeAllHighlights(); | 1222 this._removeAllHighlights(); |
1182 | 1223 |
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1851 * @return {boolean} | 1892 * @return {boolean} |
1852 */ | 1893 */ |
1853 WebInspector.NetworkLogView._requestTimeFilter = function(windowStart, windowEnd , request) | 1894 WebInspector.NetworkLogView._requestTimeFilter = function(windowStart, windowEnd , request) |
1854 { | 1895 { |
1855 if (request.issueTime() > windowEnd) | 1896 if (request.issueTime() > windowEnd) |
1856 return false; | 1897 return false; |
1857 if (request.endTime !== -1 && request.endTime < windowStart) | 1898 if (request.endTime !== -1 && request.endTime < windowStart) |
1858 return false; | 1899 return false; |
1859 return true; | 1900 return true; |
1860 } | 1901 } |
OLD | NEW |