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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 this._createTable(); | 286 this._createTable(); |
287 this._splitWidget.setSidebarWidget(this._dataGrid.asWidget()); | 287 this._splitWidget.setSidebarWidget(this._dataGrid.asWidget()); |
288 | 288 |
289 this._summaryBarElement = this.element.createChild("div", "network-s
ummary-bar"); | 289 this._summaryBarElement = this.element.createChild("div", "network-s
ummary-bar"); |
290 | 290 |
291 this._timelineWidget = new WebInspector.VBox(); | 291 this._timelineWidget = new WebInspector.VBox(); |
292 this._createTimelineHeader(); | 292 this._createTimelineHeader(); |
293 this._timelineWidget.element.classList.add("network-timeline-view"); | 293 this._timelineWidget.element.classList.add("network-timeline-view"); |
294 this._splitWidget.setMainWidget(this._timelineWidget); | 294 this._splitWidget.setMainWidget(this._timelineWidget); |
295 | 295 |
296 this._timelineColumn = new WebInspector.NetworkTimelineColumn(this,
this._dataGrid); | 296 this._timelineColumn = new WebInspector.NetworkTimelineColumn(this._
rowHeight, this._headerHeight, this._calculator, this._dataGrid.scrollContainer)
; |
| 297 |
| 298 var dataGridScroller = this._dataGrid.scrollContainer; |
| 299 this._dataGrid.setScrollContainer(this._timelineColumn.getScrollCont
ainer()); |
| 300 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.Padding
Changed, () => { |
| 301 this._timelineColumn.setScrollHeight(dataGridScroller.scrollHeig
ht) |
| 302 }); |
| 303 this._dataGrid.addEventListener(WebInspector.ViewportDataGrid.Events
.ViewportCalculated, this._timelineColumn.update.bind(this._timelineColumn)); |
| 304 |
297 this._timelineColumn.addEventListener(WebInspector.NetworkTimelineCo
lumn.Events.RequestHovered, requestHovered.bind(this)); | 305 this._timelineColumn.addEventListener(WebInspector.NetworkTimelineCo
lumn.Events.RequestHovered, requestHovered.bind(this)); |
298 this._timelineColumn.show(this._timelineWidget.element); | 306 this._timelineColumn.show(this._timelineWidget.element); |
299 this.switchViewMode(false); | 307 this.switchViewMode(false); |
300 } else { | 308 } else { |
301 this._createTable(); | 309 this._createTable(); |
302 this._dataGrid.asWidget().show(this.element); | 310 this._dataGrid.asWidget().show(this.element); |
303 this._summaryBarElement = this.element.createChild("div", "network-s
ummary-bar"); | 311 this._summaryBarElement = this.element.createChild("div", "network-s
ummary-bar"); |
304 } | 312 } |
305 | 313 |
306 this._columns.sortByCurrentColumn(); | 314 this._columns.sortByCurrentColumn(); |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
579 }, | 587 }, |
580 | 588 |
581 /** | 589 /** |
582 * @param {!WebInspector.NetworkTimeCalculator} x | 590 * @param {!WebInspector.NetworkTimeCalculator} x |
583 */ | 591 */ |
584 setCalculator: function(x) | 592 setCalculator: function(x) |
585 { | 593 { |
586 if (!x || this._calculator === x) | 594 if (!x || this._calculator === x) |
587 return; | 595 return; |
588 | 596 |
589 this._calculator = x; | 597 if (this._calculator !== x) { |
| 598 this._calculator = x; |
| 599 if (Runtime.experiments.isEnabled("canvasNetworkTimeline")) |
| 600 this._timelineColumn.setCalculator(this._calculator); |
| 601 } |
590 this._calculator.reset(); | 602 this._calculator.reset(); |
591 | 603 |
592 if (this._calculator.startAtZero) | 604 if (this._calculator.startAtZero) |
593 this._columns.hideEventDividers(); | 605 this._columns.hideEventDividers(); |
594 else | 606 else |
595 this._columns.showEventDividers(); | 607 this._columns.showEventDividers(); |
596 | 608 |
597 this._invalidateAllItems(); | 609 this._invalidateAllItems(); |
598 }, | 610 }, |
599 | 611 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
695 if (!this.calculator().boundary().equals(oldBoundary)) { | 707 if (!this.calculator().boundary().equals(oldBoundary)) { |
696 // The boundaries changed, so all item graphs are stale. | 708 // The boundaries changed, so all item graphs are stale. |
697 this._columns.updateDividersIfNeeded(); | 709 this._columns.updateDividersIfNeeded(); |
698 var nodes = this._nodesByRequestId.valuesArray(); | 710 var nodes = this._nodesByRequestId.valuesArray(); |
699 for (var i = 0; i < nodes.length; ++i) | 711 for (var i = 0; i < nodes.length; ++i) |
700 nodes[i].refreshGraph(); | 712 nodes[i].refreshGraph(); |
701 } | 713 } |
702 | 714 |
703 this._staleRequestIds = {}; | 715 this._staleRequestIds = {}; |
704 this._updateSummaryBar(); | 716 this._updateSummaryBar(); |
| 717 |
705 if (Runtime.experiments.isEnabled("canvasNetworkTimeline")) | 718 if (Runtime.experiments.isEnabled("canvasNetworkTimeline")) |
706 this._timelineColumn.scheduleRefreshData(); | 719 this._timelineColumn.setRequests(this._getOrderedRequests()); |
| 720 }, |
| 721 |
| 722 _getOrderedRequests: function() |
| 723 { |
| 724 var currentNode = this._dataGrid.rootNode(); |
| 725 var requestData = []; |
| 726 while (currentNode = currentNode.traverseNextNode(true)) |
| 727 requestData.push(currentNode.request()); |
| 728 return requestData; |
707 }, | 729 }, |
708 | 730 |
709 reset: function() | 731 reset: function() |
710 { | 732 { |
711 this._requestWithHighlightedInitiators = null; | 733 this._requestWithHighlightedInitiators = null; |
712 this.dispatchEventToListeners(WebInspector.NetworkLogView.Events.Request
Selected, null); | 734 this.dispatchEventToListeners(WebInspector.NetworkLogView.Events.Request
Selected, null); |
713 | 735 |
714 this._clearSearchMatchedList(); | 736 this._clearSearchMatchedList(); |
715 | 737 |
716 this._columns.reset(); | 738 this._columns.reset(); |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
913 */ | 935 */ |
914 rowHeight: function() | 936 rowHeight: function() |
915 { | 937 { |
916 return this._rowHeight; | 938 return this._rowHeight; |
917 }, | 939 }, |
918 | 940 |
919 _updateRowsSize: function() | 941 _updateRowsSize: function() |
920 { | 942 { |
921 var largeRows = !!this._networkLogLargeRowsSetting.get(); | 943 var largeRows = !!this._networkLogLargeRowsSetting.get(); |
922 // TODO(allada) Make these non-magic numbers. | 944 // TODO(allada) Make these non-magic numbers. |
923 this._rowHeight = largeRows ? 41 : 21; | 945 var rowHeight = largeRows ? 41 : 21; |
924 this._headerHeight = largeRows ? 31 : 27; | 946 var headerHeight = largeRows ? 31 : 27; |
| 947 if (this._rowHeight !== rowHeight) { |
| 948 this._rowHeight = rowHeight; |
| 949 if (Runtime.experiments.isEnabled("canvasNetworkTimeline")) |
| 950 this._timelineColumn.setRowHeight(this._rowHeight); |
| 951 } |
| 952 if (this._headerHeight !== headerHeight) { |
| 953 this._headerHeight = headerHeight; |
| 954 if (Runtime.experiments.isEnabled("canvasNetworkTimeline")) |
| 955 this._timelineColumn.setHeaderHeight(this._headerHeight); |
| 956 } |
| 957 |
925 this._dataGrid.element.classList.toggle("small", !largeRows); | 958 this._dataGrid.element.classList.toggle("small", !largeRows); |
926 if (Runtime.experiments.isEnabled("canvasNetworkTimeline")) | 959 if (Runtime.experiments.isEnabled("canvasNetworkTimeline")) |
927 this._timelineHeaderElement.classList.toggle("small", !largeRows); | 960 this._timelineHeaderElement.classList.toggle("small", !largeRows); |
928 this._dataGrid.scheduleUpdate(); | 961 this._dataGrid.scheduleUpdate(); |
929 }, | 962 }, |
930 | 963 |
931 /** | 964 /** |
932 * @param {!Event} event | 965 * @param {!Event} event |
933 */ | 966 */ |
934 _contextMenu: function(event) | 967 _contextMenu: function(event) |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1158 | 1191 |
1159 this._timelineColumnSortIcon.classList.remove("sort-ascending", "sort-de
scending"); | 1192 this._timelineColumnSortIcon.classList.remove("sort-ascending", "sort-de
scending"); |
1160 | 1193 |
1161 if (this._dataGrid.sortColumnIdentifier() === "timeline") { | 1194 if (this._dataGrid.sortColumnIdentifier() === "timeline") { |
1162 if (this._dataGrid.sortOrder() === WebInspector.DataGrid.Order.Ascen
ding) | 1195 if (this._dataGrid.sortOrder() === WebInspector.DataGrid.Order.Ascen
ding) |
1163 this._timelineColumnSortIcon.classList.add("sort-ascending"); | 1196 this._timelineColumnSortIcon.classList.add("sort-ascending"); |
1164 else | 1197 else |
1165 this._timelineColumnSortIcon.classList.add("sort-descending"); | 1198 this._timelineColumnSortIcon.classList.add("sort-descending"); |
1166 } | 1199 } |
1167 | 1200 |
1168 this._timelineColumn.scheduleRefreshData(); | 1201 this._timelineColumn.setRequests(this._getOrderedRequests()); |
1169 }, | 1202 }, |
1170 | 1203 |
1171 /** | 1204 /** |
1172 * @param {number} n | 1205 * @param {number} n |
1173 * @param {boolean} reveal | 1206 * @param {boolean} reveal |
1174 */ | 1207 */ |
1175 _highlightNthMatchedRequestForSearch: function(n, reveal) | 1208 _highlightNthMatchedRequestForSearch: function(n, reveal) |
1176 { | 1209 { |
1177 this._removeAllHighlights(); | 1210 this._removeAllHighlights(); |
1178 | 1211 |
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1847 * @return {boolean} | 1880 * @return {boolean} |
1848 */ | 1881 */ |
1849 WebInspector.NetworkLogView._requestTimeFilter = function(windowStart, windowEnd
, request) | 1882 WebInspector.NetworkLogView._requestTimeFilter = function(windowStart, windowEnd
, request) |
1850 { | 1883 { |
1851 if (request.issueTime() > windowEnd) | 1884 if (request.issueTime() > windowEnd) |
1852 return false; | 1885 return false; |
1853 if (request.endTime !== -1 && request.endTime < windowStart) | 1886 if (request.endTime !== -1 && request.endTime < windowStart) |
1854 return false; | 1887 return false; |
1855 return true; | 1888 return true; |
1856 } | 1889 } |
OLD | NEW |