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

Side by Side Diff: Source/devtools/front_end/network/NetworkPanel.js

Issue 420183003: DevTools: NetworkPanel: support "selfNodeHeight" contract. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 4 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 | no next file » | 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._createStatusBarItems(); 76 this._createStatusBarItems();
77 this._linkifier = new WebInspector.Linkifier(); 77 this._linkifier = new WebInspector.Linkifier();
78 78
79 this._allowPopover = true; 79 this._allowPopover = true;
80 80
81 this._addFilters(); 81 this._addFilters();
82 this._resetSuggestionBuilder(); 82 this._resetSuggestionBuilder();
83 this._initializeView(); 83 this._initializeView();
84 this._recordButton.toggled = true; 84 this._recordButton.toggled = true;
85 85
86 /** @type {number} */
87 this._rowHeight = 0;
88
86 WebInspector.targetManager.observeTargets(this); 89 WebInspector.targetManager.observeTargets(this);
87 WebInspector.targetManager.addModelListener(WebInspector.NetworkManager, Web Inspector.NetworkManager.EventTypes.RequestStarted, this._onRequestStarted, this ); 90 WebInspector.targetManager.addModelListener(WebInspector.NetworkManager, Web Inspector.NetworkManager.EventTypes.RequestStarted, this._onRequestStarted, this );
88 WebInspector.targetManager.addModelListener(WebInspector.NetworkManager, Web Inspector.NetworkManager.EventTypes.RequestUpdated, this._onRequestUpdated, this ); 91 WebInspector.targetManager.addModelListener(WebInspector.NetworkManager, Web Inspector.NetworkManager.EventTypes.RequestUpdated, this._onRequestUpdated, this );
89 WebInspector.targetManager.addModelListener(WebInspector.NetworkManager, Web Inspector.NetworkManager.EventTypes.RequestFinished, this._onRequestUpdated, thi s); 92 WebInspector.targetManager.addModelListener(WebInspector.NetworkManager, Web Inspector.NetworkManager.EventTypes.RequestFinished, this._onRequestUpdated, thi s);
90 93
91 WebInspector.targetManager.addModelListener(WebInspector.ResourceTreeModel, WebInspector.ResourceTreeModel.EventTypes.WillReloadPage, this._willReloadPage, this); 94 WebInspector.targetManager.addModelListener(WebInspector.ResourceTreeModel, WebInspector.ResourceTreeModel.EventTypes.WillReloadPage, this._willReloadPage, this);
92 WebInspector.targetManager.addModelListener(WebInspector.ResourceTreeModel, WebInspector.ResourceTreeModel.EventTypes.MainFrameNavigated, this._mainFrameNav igated, this); 95 WebInspector.targetManager.addModelListener(WebInspector.ResourceTreeModel, WebInspector.ResourceTreeModel.EventTypes.MainFrameNavigated, this._mainFrameNav igated, this);
93 WebInspector.targetManager.addModelListener(WebInspector.ResourceTreeModel, WebInspector.ResourceTreeModel.EventTypes.Load, this._loadEventFired, this); 96 WebInspector.targetManager.addModelListener(WebInspector.ResourceTreeModel, WebInspector.ResourceTreeModel.EventTypes.Load, this._loadEventFired, this);
94 WebInspector.targetManager.addModelListener(WebInspector.ResourceTreeModel, WebInspector.ResourceTreeModel.EventTypes.DOMContentLoaded, this._domContentLoad edEventFired, this); 97 WebInspector.targetManager.addModelListener(WebInspector.ResourceTreeModel, WebInspector.ResourceTreeModel.EventTypes.DOMContentLoaded, this._domContentLoad edEventFired, this);
95 } 98 }
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 188
186 _initializeView: function() 189 _initializeView: function()
187 { 190 {
188 this.element.id = "network-container"; 191 this.element.id = "network-container";
189 192
190 this._createSortingFunctions(); 193 this._createSortingFunctions();
191 this._createTable(); 194 this._createTable();
192 this._createTimelineGrid(); 195 this._createTimelineGrid();
193 this._summaryBarElement = this.element.createChild("div", "network-summa ry-bar"); 196 this._summaryBarElement = this.element.createChild("div", "network-summa ry-bar");
194 197
195 if (!this.usesLargeRows()) 198 this._updateRowsSize();
196 this._setLargerRequests(false);
197 199
198 this._popoverHelper = new WebInspector.PopoverHelper(this.element, this. _getPopoverAnchor.bind(this), this._showPopover.bind(this), this._onHidePopover. bind(this)); 200 this._popoverHelper = new WebInspector.PopoverHelper(this.element, this. _getPopoverAnchor.bind(this), this._showPopover.bind(this), this._onHidePopover. bind(this));
199 // Enable faster hint. 201 // Enable faster hint.
200 this._popoverHelper.setTimeout(100); 202 this._popoverHelper.setTimeout(100);
201 203
202 this._setCalculator(new WebInspector.NetworkTransferTimeCalculator()); 204 this._setCalculator(new WebInspector.NetworkTransferTimeCalculator());
203 205
204 this.switchToDetailedView(); 206 this.switchToDetailedView();
205 }, 207 },
206 208
(...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after
961 this.element.classList.add("brief-mode"); 963 this.element.classList.add("brief-mode");
962 this._removeAllNodeHighlights(); 964 this._removeAllNodeHighlights();
963 this._detailedMode = false; 965 this._detailedMode = false;
964 this._updateColumns(); 966 this._updateColumns();
965 this._popoverHelper.hidePopover(); 967 this._popoverHelper.hidePopover();
966 }, 968 },
967 969
968 _toggleLargerRequests: function() 970 _toggleLargerRequests: function()
969 { 971 {
970 WebInspector.settings.resourcesLargeRows.set(!WebInspector.settings.reso urcesLargeRows.get()); 972 WebInspector.settings.resourcesLargeRows.set(!WebInspector.settings.reso urcesLargeRows.get());
971 this._setLargerRequests(WebInspector.settings.resourcesLargeRows.get()); 973 this._updateRowsSize();
972 }, 974 },
973 975
974 /** 976 /**
975 * @param {boolean} enabled 977 * @return {number}
976 */ 978 */
977 _setLargerRequests: function(enabled) 979 rowHeight: function()
978 { 980 {
979 this._largerRequestsButton.toggled = enabled; 981 return this._rowHeight;
980 if (!enabled) { 982 },
981 this._largerRequestsButton.title = WebInspector.UIString("Use large resource rows."); 983
982 this._dataGrid.element.classList.add("small"); 984 _updateRowsSize: function()
983 this._timelineGrid.element.classList.add("small"); 985 {
984 } else { 986 var largeRows = this.usesLargeRows();
985 this._largerRequestsButton.title = WebInspector.UIString("Use small resource rows."); 987 this._largerRequestsButton.toggled = largeRows;
986 this._dataGrid.element.classList.remove("small"); 988 this._rowHeight = largeRows ? 41 : 21;
987 this._timelineGrid.element.classList.remove("small"); 989 this._largerRequestsButton.title = WebInspector.UIString(largeRows ? "Us e small resource rows." : "Use large resource rows.");
988 } 990 this._dataGrid.element.classList.toggle("small", !largeRows);
989 this.dispatchEventToListeners(WebInspector.NetworkLogView.EventTypes.Row SizeChanged, { largeRows: enabled }); 991 this._timelineGrid.element.classList.toggle("small", !largeRows);
992 this.dispatchEventToListeners(WebInspector.NetworkLogView.EventTypes.Row SizeChanged, { largeRows: largeRows });
990 }, 993 },
991 994
992 /** 995 /**
993 * @param {!Element} element 996 * @param {!Element} element
994 * @param {!Event} event 997 * @param {!Event} event
995 * @return {!Element|!AnchorBox|undefined} 998 * @return {!Element|!AnchorBox|undefined}
996 */ 999 */
997 _getPopoverAnchor: function(element, event) 1000 _getPopoverAnchor: function(element, event)
998 { 1001 {
999 if (!this._allowPopover) 1002 if (!this._allowPopover)
(...skipping 1485 matching lines...) Expand 10 before | Expand all | Expand 10 after
2485 { 2488 {
2486 WebInspector.SortableDataGridNode.call(this, {}); 2489 WebInspector.SortableDataGridNode.call(this, {});
2487 this._parentView = parentView; 2490 this._parentView = parentView;
2488 this._request = request; 2491 this._request = request;
2489 this._linkifier = new WebInspector.Linkifier(); 2492 this._linkifier = new WebInspector.Linkifier();
2490 this._isFilteredOut = true; 2493 this._isFilteredOut = true;
2491 this._isMatchingSearchQuery = false; 2494 this._isMatchingSearchQuery = false;
2492 } 2495 }
2493 2496
2494 WebInspector.NetworkDataGridNode.prototype = { 2497 WebInspector.NetworkDataGridNode.prototype = {
2498 /**
2499 * @override
2500 * @return {number}
2501 */
2502 nodeSelfHeight: function() {
2503 return this._parentView.rowHeight();
2504 },
2505
2495 /** override */ 2506 /** override */
2496 createCells: function() 2507 createCells: function()
2497 { 2508 {
2498 this._nameCell = null; 2509 this._nameCell = null;
2499 this._timelineCell = null; 2510 this._timelineCell = null;
2500 2511
2501 var element = this._element; 2512 var element = this._element;
2502 element.classList.toggle("network-error-row", this._isFailed()); 2513 element.classList.toggle("network-error-row", this._isFailed());
2503 element.classList.toggle("resource-cached", this._request.cached); 2514 element.classList.toggle("resource-cached", this._request.cached);
2504 var typeClassName = "network-type-" + this._request.type.name(); 2515 var typeClassName = "network-type-" + this._request.type.name();
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
3017 WebInspector.NetworkDataGridNode.RequestPropertyComparator = function(propertyNa me, revert, a, b) 3028 WebInspector.NetworkDataGridNode.RequestPropertyComparator = function(propertyNa me, revert, a, b)
3018 { 3029 {
3019 var aValue = a._request[propertyName]; 3030 var aValue = a._request[propertyName];
3020 var bValue = b._request[propertyName]; 3031 var bValue = b._request[propertyName];
3021 if (aValue > bValue) 3032 if (aValue > bValue)
3022 return revert ? -1 : 1; 3033 return revert ? -1 : 1;
3023 if (bValue > aValue) 3034 if (bValue > aValue)
3024 return revert ? 1 : -1; 3035 return revert ? 1 : -1;
3025 return a._request.indentityCompare(b._request); 3036 return a._request.indentityCompare(b._request);
3026 } 3037 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698