Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(153)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/network/NetworkLogView.js

Issue 2439453003: [Devtools] Removed dependency of networkLogView and dataGrid (Closed)
Patch Set: changes Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/network/NetworkTimelineColumn.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 /** @type {!Array<!WebInspector.NetworkRequest>|undefined} */
333 var requests;
334 if (this._timelineRequestsAreStale)
335 requests = this._getOrderedRequests();
336 this._timelineColumn.update(requests);
337 },
338
321 _showRecordingHint: function() 339 _showRecordingHint: function()
322 { 340 {
323 this._hideRecordingHint(); 341 this._hideRecordingHint();
324 this._recordingHint = this.element.createChild("div", "network-status-pa ne fill"); 342 this._recordingHint = this.element.createChild("div", "network-status-pa ne fill");
325 var hintText = this._recordingHint.createChild("div", "recording-hint"); 343 var hintText = this._recordingHint.createChild("div", "recording-hint");
326 var reloadShortcutNode = this._recordingHint.createChild("b"); 344 var reloadShortcutNode = this._recordingHint.createChild("b");
327 reloadShortcutNode.textContent = WebInspector.shortcutRegistry.shortcutD escriptorsForAction("main.reload")[0].name; 345 reloadShortcutNode.textContent = WebInspector.shortcutRegistry.shortcutD escriptorsForAction("main.reload")[0].name;
328 346
329 if (this._recording) { 347 if (this._recording) {
330 var recordingText = hintText.createChild("span"); 348 var recordingText = hintText.createChild("span");
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 }, 597 },
580 598
581 /** 599 /**
582 * @param {!WebInspector.NetworkTimeCalculator} x 600 * @param {!WebInspector.NetworkTimeCalculator} x
583 */ 601 */
584 setCalculator: function(x) 602 setCalculator: function(x)
585 { 603 {
586 if (!x || this._calculator === x) 604 if (!x || this._calculator === x)
587 return; 605 return;
588 606
589 this._calculator = x; 607 if (this._calculator !== x) {
608 this._calculator = x;
609 if (Runtime.experiments.isEnabled("canvasNetworkTimeline"))
610 this._timelineColumn.setCalculator(this._calculator);
611 }
590 this._calculator.reset(); 612 this._calculator.reset();
591 613
592 if (this._calculator.startAtZero) 614 if (this._calculator.startAtZero)
593 this._columns.hideEventDividers(); 615 this._columns.hideEventDividers();
594 else 616 else
595 this._columns.showEventDividers(); 617 this._columns.showEventDividers();
596 618
597 this._invalidateAllItems(); 619 this._invalidateAllItems();
598 }, 620 },
599 621
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 if (!this.calculator().boundary().equals(oldBoundary)) { 719 if (!this.calculator().boundary().equals(oldBoundary)) {
698 // The boundaries changed, so all item graphs are stale. 720 // The boundaries changed, so all item graphs are stale.
699 this._columns.updateDividersIfNeeded(); 721 this._columns.updateDividersIfNeeded();
700 var nodes = this._nodesByRequestId.valuesArray(); 722 var nodes = this._nodesByRequestId.valuesArray();
701 for (var i = 0; i < nodes.length; ++i) 723 for (var i = 0; i < nodes.length; ++i)
702 nodes[i].refreshGraph(); 724 nodes[i].refreshGraph();
703 } 725 }
704 726
705 this._staleRequestIds = {}; 727 this._staleRequestIds = {};
706 this._updateSummaryBar(); 728 this._updateSummaryBar();
729
707 if (Runtime.experiments.isEnabled("canvasNetworkTimeline")) 730 if (Runtime.experiments.isEnabled("canvasNetworkTimeline"))
708 this._timelineColumn.scheduleRefreshData(); 731 this._timelineRequestsAreStale = true;
732 },
733
734 _getOrderedRequests: function()
735 {
736 var currentNode = this._dataGrid.rootNode();
737 var requestData = [];
738 while (currentNode = currentNode.traverseNextNode(true))
739 requestData.push(currentNode.request());
740 return requestData;
709 }, 741 },
710 742
711 reset: function() 743 reset: function()
712 { 744 {
713 this._requestWithHighlightedInitiators = null; 745 this._requestWithHighlightedInitiators = null;
714 this.dispatchEventToListeners(WebInspector.NetworkLogView.Events.Request Selected, null); 746 this.dispatchEventToListeners(WebInspector.NetworkLogView.Events.Request Selected, null);
715 747
716 this._clearSearchMatchedList(); 748 this._clearSearchMatchedList();
717 749
718 this._columns.reset(); 750 this._columns.reset();
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
917 */ 949 */
918 rowHeight: function() 950 rowHeight: function()
919 { 951 {
920 return this._rowHeight; 952 return this._rowHeight;
921 }, 953 },
922 954
923 _updateRowsSize: function() 955 _updateRowsSize: function()
924 { 956 {
925 var largeRows = !!this._networkLogLargeRowsSetting.get(); 957 var largeRows = !!this._networkLogLargeRowsSetting.get();
926 // TODO(allada) Make these non-magic numbers. 958 // TODO(allada) Make these non-magic numbers.
927 this._rowHeight = largeRows ? 41 : 21; 959 var rowHeight = largeRows ? 41 : 21;
928 this._headerHeight = largeRows ? 31 : 27; 960 var headerHeight = largeRows ? 31 : 27;
961 if (this._rowHeight !== rowHeight) {
962 this._rowHeight = rowHeight;
963 if (Runtime.experiments.isEnabled("canvasNetworkTimeline"))
964 this._timelineColumn.setRowHeight(this._rowHeight);
965 }
966 if (this._headerHeight !== headerHeight) {
967 this._headerHeight = headerHeight;
968 if (Runtime.experiments.isEnabled("canvasNetworkTimeline"))
969 this._timelineColumn.setHeaderHeight(this._headerHeight);
970 }
971
929 this._dataGrid.element.classList.toggle("small", !largeRows); 972 this._dataGrid.element.classList.toggle("small", !largeRows);
930 if (Runtime.experiments.isEnabled("canvasNetworkTimeline")) 973 if (Runtime.experiments.isEnabled("canvasNetworkTimeline"))
931 this._timelineHeaderElement.classList.toggle("small", !largeRows); 974 this._timelineHeaderElement.classList.toggle("small", !largeRows);
932 this._dataGrid.scheduleUpdate(); 975 this._dataGrid.scheduleUpdate();
933 }, 976 },
934 977
935 /** 978 /**
936 * @param {!Event} event 979 * @param {!Event} event
937 */ 980 */
938 _contextMenu: function(event) 981 _contextMenu: function(event)
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
1162 1205
1163 this._timelineColumnSortIcon.classList.remove("sort-ascending", "sort-de scending"); 1206 this._timelineColumnSortIcon.classList.remove("sort-ascending", "sort-de scending");
1164 1207
1165 if (this._dataGrid.sortColumnIdentifier() === "timeline") { 1208 if (this._dataGrid.sortColumnIdentifier() === "timeline") {
1166 if (this._dataGrid.sortOrder() === WebInspector.DataGrid.Order.Ascen ding) 1209 if (this._dataGrid.sortOrder() === WebInspector.DataGrid.Order.Ascen ding)
1167 this._timelineColumnSortIcon.classList.add("sort-ascending"); 1210 this._timelineColumnSortIcon.classList.add("sort-ascending");
1168 else 1211 else
1169 this._timelineColumnSortIcon.classList.add("sort-descending"); 1212 this._timelineColumnSortIcon.classList.add("sort-descending");
1170 } 1213 }
1171 1214
1172 this._timelineColumn.scheduleRefreshData(); 1215 this._timelineRequestsAreStale = true;
1173 }, 1216 },
1174 1217
1175 /** 1218 /**
1176 * @param {number} n 1219 * @param {number} n
1177 * @param {boolean} reveal 1220 * @param {boolean} reveal
1178 */ 1221 */
1179 _highlightNthMatchedRequestForSearch: function(n, reveal) 1222 _highlightNthMatchedRequestForSearch: function(n, reveal)
1180 { 1223 {
1181 this._removeAllHighlights(); 1224 this._removeAllHighlights();
1182 1225
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after
1851 * @return {boolean} 1894 * @return {boolean}
1852 */ 1895 */
1853 WebInspector.NetworkLogView._requestTimeFilter = function(windowStart, windowEnd , request) 1896 WebInspector.NetworkLogView._requestTimeFilter = function(windowStart, windowEnd , request)
1854 { 1897 {
1855 if (request.issueTime() > windowEnd) 1898 if (request.issueTime() > windowEnd)
1856 return false; 1899 return false;
1857 if (request.endTime !== -1 && request.endTime < windowStart) 1900 if (request.endTime !== -1 && request.endTime < windowStart)
1858 return false; 1901 return false;
1859 return true; 1902 return true;
1860 } 1903 }
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/network/NetworkTimelineColumn.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698