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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 this.registerRequiredCSS("network/networkLogView.css"); | 44 this.registerRequiredCSS("network/networkLogView.css"); |
45 | 45 |
46 this._networkHideDataURLSetting = WebInspector.settings.createSetting("netwo
rkHideDataURL", false); | 46 this._networkHideDataURLSetting = WebInspector.settings.createSetting("netwo
rkHideDataURL", false); |
47 this._networkResourceTypeFiltersSetting = WebInspector.settings.createSettin
g("networkResourceTypeFilters", {}); | 47 this._networkResourceTypeFiltersSetting = WebInspector.settings.createSettin
g("networkResourceTypeFilters", {}); |
48 this._networkShowPrimaryLoadWaterfallSetting = WebInspector.settings.createS
etting("networkShowPrimaryLoadWaterfall", false); | 48 this._networkShowPrimaryLoadWaterfallSetting = WebInspector.settings.createS
etting("networkShowPrimaryLoadWaterfall", false); |
49 | 49 |
50 this._filterBar = filterBar; | 50 this._filterBar = filterBar; |
51 this._progressBarContainer = progressBarContainer; | 51 this._progressBarContainer = progressBarContainer; |
52 this._networkLogLargeRowsSetting = networkLogLargeRowsSetting; | 52 this._networkLogLargeRowsSetting = networkLogLargeRowsSetting; |
53 | 53 |
54 this._columns = new WebInspector.NetworkLogViewColumns(this, networkLogLarge
RowsSetting); | 54 /** @type {!WebInspector.NetworkTransferTimeCalculator} */ |
| 55 this._timeCalculator = new WebInspector.NetworkTransferTimeCalculator(); |
| 56 /** @type {!WebInspector.NetworkTransferDurationCalculator} */ |
| 57 this._durationCalculator = new WebInspector.NetworkTransferDurationCalculato
r(); |
| 58 this._calculator = this._timeCalculator; |
| 59 this._columns = new WebInspector.NetworkLogViewColumns(this, this._timeCalcu
lator, this._durationCalculator, networkLogLargeRowsSetting); |
55 | 60 |
56 /** @type {!Map.<string, !WebInspector.NetworkDataGridNode>} */ | 61 /** @type {!Map.<string, !WebInspector.NetworkDataGridNode>} */ |
57 this._nodesByRequestId = new Map(); | 62 this._nodesByRequestId = new Map(); |
58 /** @type {!Object.<string, boolean>} */ | 63 /** @type {!Object.<string, boolean>} */ |
59 this._staleRequestIds = {}; | 64 this._staleRequestIds = {}; |
60 /** @type {number} */ | 65 /** @type {number} */ |
61 this._mainRequestLoadTime = -1; | 66 this._mainRequestLoadTime = -1; |
62 /** @type {number} */ | 67 /** @type {number} */ |
63 this._mainRequestDOMContentLoadedTime = -1; | 68 this._mainRequestDOMContentLoadedTime = -1; |
64 this._matchedRequestCount = 0; | 69 this._matchedRequestCount = 0; |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 _filterChanged: function(event) | 272 _filterChanged: function(event) |
268 { | 273 { |
269 this.removeAllNodeHighlights(); | 274 this.removeAllNodeHighlights(); |
270 this._parseFilterQuery(this._textFilterUI.value()); | 275 this._parseFilterQuery(this._textFilterUI.value()); |
271 this._filterRequests(); | 276 this._filterRequests(); |
272 }, | 277 }, |
273 | 278 |
274 _initializeView: function() | 279 _initializeView: function() |
275 { | 280 { |
276 this.element.id = "network-container"; | 281 this.element.id = "network-container"; |
277 | 282 this._setupDataGrid(); |
278 /** @type {!WebInspector.NetworkTransferTimeCalculator} */ | |
279 this._timeCalculator = new WebInspector.NetworkTransferTimeCalculator(); | |
280 /** @type {!WebInspector.NetworkTransferDurationCalculator} */ | |
281 this._durationCalculator = new WebInspector.NetworkTransferDurationCalcu
lator(); | |
282 this._calculator = this._timeCalculator; | |
283 | |
284 if (Runtime.experiments.isEnabled("canvasNetworkTimeline")) { | 283 if (Runtime.experiments.isEnabled("canvasNetworkTimeline")) { |
285 this._splitWidget = new WebInspector.SplitWidget(true, false, "netwo
rkPanelSplitViewTimeline"); | |
286 this._splitWidget.show(this.element); | |
287 this._createTable(); | |
288 this._splitWidget.setSidebarWidget(this._dataGrid.asWidget()); | |
289 | |
290 this._summaryBarElement = this.element.createChild("div", "network-s
ummary-bar"); | |
291 | |
292 this._timelineWidget = new WebInspector.VBox(); | |
293 this._createTimelineHeader(); | |
294 this._timelineWidget.element.classList.add("network-timeline-view"); | |
295 this._splitWidget.setMainWidget(this._timelineWidget); | |
296 | |
297 this._timelineColumn = new WebInspector.NetworkTimelineColumn(this._
rowHeight, this._headerHeight, this._calculator, this._dataGrid.scrollContainer)
; | |
298 | |
299 var dataGridScroller = this._dataGrid.scrollContainer; | 284 var dataGridScroller = this._dataGrid.scrollContainer; |
| 285 this._timelineColumn = new WebInspector.NetworkTimelineColumn(this._
rowHeight, this._headerHeight, this._calculator, dataGridScroller); |
300 this._dataGrid.setScrollContainer(this._timelineColumn.getScrollCont
ainer()); | 286 this._dataGrid.setScrollContainer(this._timelineColumn.getScrollCont
ainer()); |
301 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.Padding
Changed, () => { | 287 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.Padding
Changed, () => this._timelineColumn.setScrollHeight(dataGridScroller.scrollHeigh
t)); |
302 this._timelineColumn.setScrollHeight(dataGridScroller.scrollHeig
ht); | |
303 }); | |
304 this._dataGrid.addEventListener(WebInspector.ViewportDataGrid.Events
.ViewportCalculated, this._redrawTimelineColumn.bind(this)); | 288 this._dataGrid.addEventListener(WebInspector.ViewportDataGrid.Events
.ViewportCalculated, this._redrawTimelineColumn.bind(this)); |
305 | 289 |
306 this._timelineColumn.addEventListener(WebInspector.NetworkTimelineCo
lumn.Events.RequestHovered, requestHovered.bind(this)); | 290 this._timelineColumn.addEventListener(WebInspector.NetworkTimelineCo
lumn.Events.RequestHovered, requestHovered.bind(this)); |
307 this._timelineColumn.show(this._timelineWidget.element); | 291 |
| 292 // TODO(allada) This code needs to be moved into NetworkLogViewColum
ns. |
| 293 this._createTimelineHeader(); |
| 294 this._timelineColumn.contentElement.classList.add("network-timeline-
view"); |
| 295 |
| 296 this._splitWidget = this._columns.splitWidget(); |
| 297 this._splitWidget.setMainWidget(this._timelineColumn); |
| 298 |
| 299 this._columns.show(this.element); |
308 this.switchViewMode(false); | 300 this.switchViewMode(false); |
309 } else { | 301 } else { |
310 this._createTable(); | 302 this._columns.show(this.element); |
311 this._dataGrid.asWidget().show(this.element); | |
312 this._summaryBarElement = this.element.createChild("div", "network-s
ummary-bar"); | |
313 } | 303 } |
| 304 this._summaryBarElement = this.element.createChild("div", "network-summa
ry-bar"); |
314 | 305 |
315 this._columns.sortByCurrentColumn(); | 306 this._columns.sortByCurrentColumn(); |
316 this._updateRowsSize(); | 307 this._updateRowsSize(); |
317 | 308 |
318 /** | 309 /** |
319 * @param {!WebInspector.Event} event | 310 * @param {!WebInspector.Event} event |
320 * @this {WebInspector.NetworkLogView} | 311 * @this {WebInspector.NetworkLogView} |
321 */ | 312 */ |
322 function requestHovered(event) | 313 function requestHovered(event) |
323 { | 314 { |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 * @override | 368 * @override |
378 * @return {!Array.<!Element>} | 369 * @return {!Array.<!Element>} |
379 */ | 370 */ |
380 elementsToRestoreScrollPositionsFor: function() | 371 elementsToRestoreScrollPositionsFor: function() |
381 { | 372 { |
382 if (!this._dataGrid) // Not initialized yet. | 373 if (!this._dataGrid) // Not initialized yet. |
383 return []; | 374 return []; |
384 return [this._dataGrid.scrollContainer]; | 375 return [this._dataGrid.scrollContainer]; |
385 }, | 376 }, |
386 | 377 |
387 _createTable: function() | 378 _setupDataGrid: function() |
388 { | 379 { |
389 this._dataGrid = this._columns.createGrid(this._timeCalculator, this._du
rationCalculator); | 380 this._dataGrid = this._columns.dataGrid(); |
390 this._dataGrid.setRowContextMenuCallback(this._onRowContextMenu.bind(thi
s)); | 381 this._dataGrid.setRowContextMenuCallback(this._onRowContextMenu.bind(thi
s)); |
391 this._dataGrid.setStickToBottom(true); | 382 this._dataGrid.setStickToBottom(true); |
392 this._dataGrid.setName("networkLog"); | 383 this._dataGrid.setName("networkLog"); |
393 this._dataGrid.setResizeMethod(WebInspector.DataGrid.ResizeMethod.Last); | 384 this._dataGrid.setResizeMethod(WebInspector.DataGrid.ResizeMethod.Last); |
394 this._dataGrid.element.classList.add("network-log-grid"); | 385 this._dataGrid.element.classList.add("network-log-grid"); |
395 this._dataGrid.element.addEventListener("mousedown", this._dataGridMouse
Down.bind(this), true); | 386 this._dataGrid.element.addEventListener("mousedown", this._dataGridMouse
Down.bind(this), true); |
396 this._dataGrid.element.addEventListener("mousemove", this._dataGridMouse
Move.bind(this), true); | 387 this._dataGrid.element.addEventListener("mousemove", this._dataGridMouse
Move.bind(this), true); |
397 this._dataGrid.element.addEventListener("mouseleave", this._dataGridMous
eLeave.bind(this), true); | 388 this._dataGrid.element.addEventListener("mouseleave", this._dataGridMous
eLeave.bind(this), true); |
398 }, | 389 }, |
399 | 390 |
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
904 var node = this._nodesByRequestId.get(request.requestId); | 895 var node = this._nodesByRequestId.get(request.requestId); |
905 if (node) { | 896 if (node) { |
906 node.markAsNavigationRequest(); | 897 node.markAsNavigationRequest(); |
907 break; | 898 break; |
908 } | 899 } |
909 } | 900 } |
910 }, | 901 }, |
911 | 902 |
912 _createTimelineHeader: function() | 903 _createTimelineHeader: function() |
913 { | 904 { |
914 this._timelineHeaderElement = this._timelineWidget.element.createChild("
div", "network-timeline-header"); | 905 this._timelineHeaderElement = this._timelineColumn.contentElement.create
Child("div", "network-timeline-header"); |
915 this._timelineHeaderElement.addEventListener("click", timelineHeaderClic
ked.bind(this)); | 906 this._timelineHeaderElement.addEventListener("click", timelineHeaderClic
ked.bind(this)); |
916 this._timelineHeaderElement.addEventListener("contextmenu", this._column
s.headerContextMenuEvent.bind(this._columns)); | 907 this._timelineHeaderElement.addEventListener("contextmenu", this._column
s.headerContextMenuEvent.bind(this._columns)); |
917 var innerElement = this._timelineHeaderElement.createChild("div"); | 908 var innerElement = this._timelineHeaderElement.createChild("div"); |
918 innerElement.textContent = WebInspector.UIString("Timeline"); | 909 innerElement.textContent = WebInspector.UIString("Timeline"); |
919 this._timelineColumnSortIcon = this._timelineHeaderElement.createChild("
div", "sort-order-icon-container").createChild("div", "sort-order-icon"); | 910 this._timelineColumnSortIcon = this._timelineHeaderElement.createChild("
div", "sort-order-icon-container").createChild("div", "sort-order-icon"); |
920 | 911 |
921 /** | 912 /** |
922 * @this {WebInspector.NetworkLogView} | 913 * @this {WebInspector.NetworkLogView} |
923 */ | 914 */ |
924 function timelineHeaderClicked() | 915 function timelineHeaderClicked() |
925 { | 916 { |
926 var sortOrders = WebInspector.DataGrid.Order; | 917 var sortOrders = WebInspector.DataGrid.Order; |
927 var sortOrder = this._dataGrid.sortOrder() === sortOrders.Ascending
? sortOrders.Descending : sortOrders.Ascending; | 918 var sortOrder = this._dataGrid.sortOrder() === sortOrders.Ascending
? sortOrders.Descending : sortOrders.Ascending; |
928 this._dataGrid.markColumnAsSortedBy("timeline", sortOrder); | 919 this._dataGrid.markColumnAsSortedBy("timeline", sortOrder); |
929 this._columns.sortByCurrentColumn(); | 920 this._columns.sortByCurrentColumn(); |
930 } | 921 } |
931 }, | 922 }, |
932 | 923 |
933 /** | 924 /** |
934 * @param {boolean} gridMode | 925 * @param {boolean} gridMode |
935 */ | 926 */ |
936 switchViewMode: function(gridMode) | 927 switchViewMode: function(gridMode) |
937 { | 928 { |
938 this._columns.switchViewMode(gridMode); | 929 this._columns.switchViewMode(gridMode); |
939 if (!Runtime.experiments.isEnabled("canvasNetworkTimeline")) | |
940 return; | |
941 | |
942 if (gridMode && this._nodesByRequestId.size) | |
943 this._splitWidget.showBoth(); | |
944 else | |
945 this._splitWidget.hideMain(); | |
946 }, | 930 }, |
947 | 931 |
948 /** | 932 /** |
949 * @return {number} | 933 * @return {number} |
950 */ | 934 */ |
951 rowHeight: function() | 935 rowHeight: function() |
952 { | 936 { |
953 return this._rowHeight; | 937 return this._rowHeight; |
954 }, | 938 }, |
955 | 939 |
(...skipping 926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1882 * @return {boolean} | 1866 * @return {boolean} |
1883 */ | 1867 */ |
1884 WebInspector.NetworkLogView._requestTimeFilter = function(windowStart, windowEnd
, request) | 1868 WebInspector.NetworkLogView._requestTimeFilter = function(windowStart, windowEnd
, request) |
1885 { | 1869 { |
1886 if (request.issueTime() > windowEnd) | 1870 if (request.issueTime() > windowEnd) |
1887 return false; | 1871 return false; |
1888 if (request.endTime !== -1 && request.endTime < windowStart) | 1872 if (request.endTime !== -1 && request.endTime < windowStart) |
1889 return false; | 1873 return false; |
1890 return true; | 1874 return true; |
1891 }; | 1875 }; |
OLD | NEW |