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

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

Issue 1178563002: DevTools: Refactor network panel overview (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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 | Annotate | Revision Log
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 15 matching lines...) Expand all
26 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 /** 31 /**
32 * @constructor 32 * @constructor
33 * @implements {WebInspector.Searchable} 33 * @implements {WebInspector.Searchable}
34 * @implements {WebInspector.TargetManager.Observer} 34 * @implements {WebInspector.TargetManager.Observer}
35 * @extends {WebInspector.VBox} 35 * @extends {WebInspector.VBox}
36 * @param {!WebInspector.NetworkOverview} overview
37 * @param {!WebInspector.FilterBar} filterBar 36 * @param {!WebInspector.FilterBar} filterBar
38 * @param {!Element} progressBarContainer 37 * @param {!Element} progressBarContainer
39 * @param {!WebInspector.Setting} networkLogLargeRowsSetting 38 * @param {!WebInspector.Setting} networkLogLargeRowsSetting
40 */ 39 */
41 WebInspector.NetworkLogView = function(overview, filterBar, progressBarContainer , networkLogLargeRowsSetting) 40 WebInspector.NetworkLogView = function(filterBar, progressBarContainer, networkL ogLargeRowsSetting)
42 { 41 {
43 WebInspector.VBox.call(this); 42 WebInspector.VBox.call(this);
44 this.registerRequiredCSS("network/networkLogView.css"); 43 this.registerRequiredCSS("network/networkLogView.css");
45 this.registerRequiredCSS("ui/filter.css"); 44 this.registerRequiredCSS("ui/filter.css");
46 45
47 this._networkHideDataURLSetting = WebInspector.settings.createSetting("netwo rkHideDataURL", false); 46 this._networkHideDataURLSetting = WebInspector.settings.createSetting("netwo rkHideDataURL", false);
48 this._networkResourceTypeFiltersSetting = WebInspector.settings.createSettin g("networkResourceTypeFilters", {}); 47 this._networkResourceTypeFiltersSetting = WebInspector.settings.createSettin g("networkResourceTypeFilters", {});
49 this._networkShowPrimaryLoadWaterfallSetting = WebInspector.settings.createS etting("networkShowPrimaryLoadWaterfall", false); 48 this._networkShowPrimaryLoadWaterfallSetting = WebInspector.settings.createS etting("networkShowPrimaryLoadWaterfall", false);
50 49
51 this._filterBar = filterBar; 50 this._filterBar = filterBar;
52 /** @type {!WebInspector.NetworkOverview} */
53 this._overview = overview;
54 this._progressBarContainer = progressBarContainer; 51 this._progressBarContainer = progressBarContainer;
55 this._networkLogLargeRowsSetting = networkLogLargeRowsSetting; 52 this._networkLogLargeRowsSetting = networkLogLargeRowsSetting;
56 53
57 var defaultColumnsVisibility = WebInspector.NetworkLogView._defaultColumnsVi sibility; 54 var defaultColumnsVisibility = WebInspector.NetworkLogView._defaultColumnsVi sibility;
58 this._columnsVisibilitySetting = WebInspector.settings.createSetting("networ kLogColumnsVisibility", defaultColumnsVisibility); 55 this._columnsVisibilitySetting = WebInspector.settings.createSetting("networ kLogColumnsVisibility", defaultColumnsVisibility);
59 var savedColumnsVisibility = this._columnsVisibilitySetting.get(); 56 var savedColumnsVisibility = this._columnsVisibilitySetting.get();
60 var columnsVisibility = {}; 57 var columnsVisibility = {};
61 for (var columnId in defaultColumnsVisibility) 58 for (var columnId in defaultColumnsVisibility)
62 columnsVisibility[columnId] = savedColumnsVisibility.hasOwnProperty(colu mnId) ? savedColumnsVisibility[columnId] : defaultColumnsVisibility[columnId]; 59 columnsVisibility[columnId] = savedColumnsVisibility.hasOwnProperty(colu mnId) ? savedColumnsVisibility[columnId] : defaultColumnsVisibility[columnId];
63 this._columnsVisibilitySetting.set(columnsVisibility); 60 this._columnsVisibilitySetting.set(columnsVisibility);
(...skipping 28 matching lines...) Expand all
92 this._recording = false; 89 this._recording = false;
93 this._preserveLog = false; 90 this._preserveLog = false;
94 91
95 /** @type {number} */ 92 /** @type {number} */
96 this._rowHeight = 0; 93 this._rowHeight = 0;
97 94
98 this._addFilters(); 95 this._addFilters();
99 this._resetSuggestionBuilder(); 96 this._resetSuggestionBuilder();
100 this._initializeView(); 97 this._initializeView();
101 98
102 this._overview.addEventListener(WebInspector.NetworkOverview.Events.WindowCh anged, this._onWindowChanged, this);
103
104 WebInspector.moduleSetting("networkColorCodeResourceTypes").addChangeListene r(this._invalidateAllItems, this); 99 WebInspector.moduleSetting("networkColorCodeResourceTypes").addChangeListene r(this._invalidateAllItems, this);
105 this._networkLogLargeRowsSetting.addChangeListener(this._updateRowsSize, thi s); 100 this._networkLogLargeRowsSetting.addChangeListener(this._updateRowsSize, thi s);
106 101
107 WebInspector.targetManager.observeTargets(this); 102 WebInspector.targetManager.observeTargets(this);
108 WebInspector.targetManager.addModelListener(WebInspector.NetworkManager, Web Inspector.NetworkManager.EventTypes.RequestStarted, this._onRequestStarted, this ); 103 WebInspector.targetManager.addModelListener(WebInspector.NetworkManager, Web Inspector.NetworkManager.EventTypes.RequestStarted, this._onRequestStarted, this );
109 WebInspector.targetManager.addModelListener(WebInspector.NetworkManager, Web Inspector.NetworkManager.EventTypes.RequestUpdated, this._onRequestUpdated, this ); 104 WebInspector.targetManager.addModelListener(WebInspector.NetworkManager, Web Inspector.NetworkManager.EventTypes.RequestUpdated, this._onRequestUpdated, this );
110 WebInspector.targetManager.addModelListener(WebInspector.NetworkManager, Web Inspector.NetworkManager.EventTypes.RequestFinished, this._onRequestUpdated, thi s); 105 WebInspector.targetManager.addModelListener(WebInspector.NetworkManager, Web Inspector.NetworkManager.EventTypes.RequestFinished, this._onRequestUpdated, thi s);
111 106
112 WebInspector.targetManager.addModelListener(WebInspector.ResourceTreeModel, WebInspector.ResourceTreeModel.EventTypes.MainFrameNavigated, this._mainFrameNav igated, this); 107 WebInspector.targetManager.addModelListener(WebInspector.ResourceTreeModel, WebInspector.ResourceTreeModel.EventTypes.MainFrameNavigated, this._mainFrameNav igated, this);
113 WebInspector.targetManager.addModelListener(WebInspector.ResourceTreeModel, WebInspector.ResourceTreeModel.EventTypes.Load, this._loadEventFired, this); 108 WebInspector.targetManager.addModelListener(WebInspector.ResourceTreeModel, WebInspector.ResourceTreeModel.EventTypes.Load, this._loadEventFired, this);
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 204
210 /** 205 /**
211 * @override 206 * @override
212 * @param {!WebInspector.Target} target 207 * @param {!WebInspector.Target} target
213 */ 208 */
214 targetRemoved: function(target) 209 targetRemoved: function(target)
215 { 210 {
216 }, 211 },
217 212
218 /** 213 /**
219 * @param {!WebInspector.Event} event 214 * @param {number} start
215 * @param {number} end
220 */ 216 */
221 _onWindowChanged: function(event) 217 setWindow: function(start, end)
222 { 218 {
223 var start = /** @type {number} */ (event.data.start);
224 var end = /** @type {number} */ (event.data.end);
225 if (!start && !end) { 219 if (!start && !end) {
226 this._timeFilter = null; 220 this._timeFilter = null;
227 this._timeCalculator.setWindow(null); 221 this._timeCalculator.setWindow(null);
228 } else { 222 } else {
229 this._timeFilter = WebInspector.NetworkLogView._requestTimeFilter.bi nd(null, start, end); 223 this._timeFilter = WebInspector.NetworkLogView._requestTimeFilter.bi nd(null, start, end);
230 this._timeCalculator.setWindow(new WebInspector.NetworkTimeBoundary( start, end)); 224 this._timeCalculator.setWindow(new WebInspector.NetworkTimeBoundary( start, end));
231 } 225 }
232 this._updateDividersIfNeeded(); 226 this._updateDividersIfNeeded();
233 this._filterRequests(); 227 this._filterRequests();
234 }, 228 },
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after
938 { 932 {
939 this.dispatchEventToListeners(WebInspector.NetworkLogView.EventTypes.Req uestSelected, null); 933 this.dispatchEventToListeners(WebInspector.NetworkLogView.EventTypes.Req uestSelected, null);
940 934
941 /** @type {boolean} */ 935 /** @type {boolean} */
942 this._shouldSetWaterfallWindow = Runtime.experiments.isEnabled("showPrim aryLoadWaterfallInNetworkTimeline") && this._networkShowPrimaryLoadWaterfallSett ing.get(); 936 this._shouldSetWaterfallWindow = Runtime.experiments.isEnabled("showPrim aryLoadWaterfallInNetworkTimeline") && this._networkShowPrimaryLoadWaterfallSett ing.get();
943 937
944 this._clearSearchMatchedList(); 938 this._clearSearchMatchedList();
945 if (this._popoverHelper) 939 if (this._popoverHelper)
946 this._popoverHelper.hidePopover(); 940 this._popoverHelper.hidePopover();
947 941
948 this._overview.reset();
949 this._timeFilter = null; 942 this._timeFilter = null;
950 this._calculator.reset(); 943 this._calculator.reset();
951 944
952 this._timeCalculator.setWindow(null); 945 this._timeCalculator.setWindow(null);
953 946
954 var nodes = this._nodesByRequestId.valuesArray(); 947 var nodes = this._nodesByRequestId.valuesArray();
955 for (var i = 0; i < nodes.length; ++i) 948 for (var i = 0; i < nodes.length; ++i)
956 nodes[i].dispose(); 949 nodes[i].dispose();
957 950
958 this._nodesByRequestId.clear(); 951 this._nodesByRequestId.clear();
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
1035 this._suggestionBuilder.addItem(WebInspector.NetworkLogView.FilterTy pe.HasResponseHeader, responseHeaders[i].name); 1028 this._suggestionBuilder.addItem(WebInspector.NetworkLogView.FilterTy pe.HasResponseHeader, responseHeaders[i].name);
1036 var cookies = request.responseCookies; 1029 var cookies = request.responseCookies;
1037 for (var i = 0, l = cookies ? cookies.length : 0; i < l; ++i) { 1030 for (var i = 0, l = cookies ? cookies.length : 0; i < l; ++i) {
1038 var cookie = cookies[i]; 1031 var cookie = cookies[i];
1039 this._suggestionBuilder.addItem(WebInspector.NetworkLogView.FilterTy pe.SetCookieDomain, cookie.domain()); 1032 this._suggestionBuilder.addItem(WebInspector.NetworkLogView.FilterTy pe.SetCookieDomain, cookie.domain());
1040 this._suggestionBuilder.addItem(WebInspector.NetworkLogView.FilterTy pe.SetCookieName, cookie.name()); 1033 this._suggestionBuilder.addItem(WebInspector.NetworkLogView.FilterTy pe.SetCookieName, cookie.name());
1041 this._suggestionBuilder.addItem(WebInspector.NetworkLogView.FilterTy pe.SetCookieValue, cookie.value()); 1034 this._suggestionBuilder.addItem(WebInspector.NetworkLogView.FilterTy pe.SetCookieValue, cookie.value());
1042 } 1035 }
1043 1036
1044 this._staleRequestIds[request.requestId] = true; 1037 this._staleRequestIds[request.requestId] = true;
1045 this._overview.updateRequest(request); 1038 this.dispatchEventToListeners(WebInspector.NetworkLogView.EventTypes.Upd ateRequest, request);
1046 this._scheduleRefresh(); 1039 this._scheduleRefresh();
1047 }, 1040 },
1048 1041
1049 /** 1042 /**
1050 * @param {!WebInspector.Event} event 1043 * @param {!WebInspector.Event} event
1051 */ 1044 */
1052 _mainFrameNavigated: function(event) 1045 _mainFrameNavigated: function(event)
1053 { 1046 {
1054 if (!this._recording) 1047 if (!this._recording)
1055 return; 1048 return;
(...skipping 967 matching lines...) Expand 10 before | Expand all | Expand 10 after
2023 WebInspector.NetworkLogView._requestTimeFilter = function(windowStart, windowEnd , request) 2016 WebInspector.NetworkLogView._requestTimeFilter = function(windowStart, windowEnd , request)
2024 { 2017 {
2025 if (request.issueTime() > windowEnd) 2018 if (request.issueTime() > windowEnd)
2026 return false; 2019 return false;
2027 if (request.endTime !== -1 && request.endTime < windowStart) 2020 if (request.endTime !== -1 && request.endTime < windowStart)
2028 return false; 2021 return false;
2029 return true; 2022 return true;
2030 } 2023 }
2031 2024
2032 WebInspector.NetworkLogView.EventTypes = { 2025 WebInspector.NetworkLogView.EventTypes = {
2033 RequestSelected: "RequestSelected", 2026 RequestSelected: Symbol("RequestSelected"),
yurys 2015/06/11 15:33:36 Although I agree that Symbols would be more approp
alph 2015/06/11 16:35:00 Reverted.
2034 SearchCountUpdated: "SearchCountUpdated", 2027 SearchCountUpdated: Symbol("SearchCountUpdated"),
2035 SearchIndexUpdated: "SearchIndexUpdated" 2028 SearchIndexUpdated: Symbol("SearchIndexUpdated"),
2029 UpdateRequest: Symbol("UpdateRequest")
2036 }; 2030 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698