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

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

Issue 2460073002: [Devtools] Move canvas timeline out of experiments and remove old code (Closed)
Patch Set: changes Created 4 years, 1 month 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 /** 4 /**
5 * @unrestricted 5 * @unrestricted
6 */ 6 */
7 WebInspector.NetworkLogViewColumns = class { 7 WebInspector.NetworkLogViewColumns = class {
8 /** 8 /**
9 * @param {!WebInspector.NetworkLogView} networkLogView 9 * @param {!WebInspector.NetworkLogView} networkLogView
10 * @param {!WebInspector.NetworkTransferTimeCalculator} timeCalculator 10 * @param {!WebInspector.NetworkTransferTimeCalculator} timeCalculator
11 * @param {!WebInspector.NetworkTransferDurationCalculator} durationCalculator 11 * @param {!WebInspector.NetworkTransferDurationCalculator} durationCalculator
12 * @param {!WebInspector.Setting} networkLogLargeRowsSetting 12 * @param {!WebInspector.Setting} networkLogLargeRowsSetting
13 */ 13 */
14 constructor(networkLogView, timeCalculator, durationCalculator, networkLogLarg eRowsSetting) { 14 constructor(networkLogView, timeCalculator, durationCalculator, networkLogLarg eRowsSetting) {
15 if (Runtime.experiments.isEnabled('canvasNetworkTimeline')) {
16 var timelineColumn =
17 WebInspector.NetworkLogViewColumns._defaultColumns.find(columnConfig = > columnConfig.id === 'timeline');
18 timelineColumn.visible = false;
19 timelineColumn.hideable = false;
20 }
21
22 this._networkLogView = networkLogView; 15 this._networkLogView = networkLogView;
23 16
24 /** @type {!WebInspector.Setting} */ 17 /** @type {!WebInspector.Setting} */
25 this._persistantSettings = WebInspector.settings.createSetting('networkLogCo lumns', {}); 18 this._persistantSettings = WebInspector.settings.createSetting('networkLogCo lumns', {});
26 19
27 /** @type {!Array<!Element>} */
28 this._dropDownColumnSelectors = [];
29
30 this._networkLogLargeRowsSetting = networkLogLargeRowsSetting; 20 this._networkLogLargeRowsSetting = networkLogLargeRowsSetting;
31 this._networkLogLargeRowsSetting.addChangeListener(this._updateRowsSize, thi s); 21 this._networkLogLargeRowsSetting.addChangeListener(this._updateRowsSize, thi s);
32 22
33 /** @type {!Array<{time: number, element: !Element}>} */
34 this._eventDividers = [];
35
36 /** @type {!Map<string, !Array<number>>} */ 23 /** @type {!Map<string, !Array<number>>} */
37 this._shownEventDividers = new Map(); 24 this._eventDividers = new Map();
38 this._eventDividersShown = false; 25 this._eventDividersShown = false;
39 26
40 this._gridMode = true; 27 this._gridMode = true;
41 28
42 /** @type {!Array.<!WebInspector.NetworkLogViewColumns.Descriptor>} */ 29 /** @type {!Array.<!WebInspector.NetworkLogViewColumns.Descriptor>} */
43 this._columns = []; 30 this._columns = [];
44 31
45 /** @type {?WebInspector.TimelineGrid} */
46 this._timelineGrid = null;
47 this._timelineHeaderElement = null;
48 this._timelineRequestsAreStale = false; 32 this._timelineRequestsAreStale = false;
49 this._timelineScrollerWidthIsStale = true; 33 this._timelineScrollerWidthIsStale = true;
50 34
51 /** @type {!WebInspector.Linkifier} */ 35 /** @type {!WebInspector.Linkifier} */
52 this._popupLinkifier = new WebInspector.Linkifier(); 36 this._popupLinkifier = new WebInspector.Linkifier();
53 37
54 /** @type {!Map<string, !WebInspector.NetworkTimeCalculator>} */ 38 /** @type {!Map<string, !WebInspector.NetworkTimeCalculator>} */
55 this._calculatorsMap = new Map(); 39 this._calculatorsMap = new Map();
56 this._calculatorsMap.set(WebInspector.NetworkLogViewColumns._calculatorTypes .Time, timeCalculator); 40 this._calculatorsMap.set(WebInspector.NetworkLogViewColumns._calculatorTypes .Time, timeCalculator);
57 this._calculatorsMap.set(WebInspector.NetworkLogViewColumns._calculatorTypes .Duration, durationCalculator); 41 this._calculatorsMap.set(WebInspector.NetworkLogViewColumns._calculatorTypes .Duration, durationCalculator);
58 42
59 this._setupDataGrid(); 43 this._setupDataGrid();
60 if (Runtime.experiments.isEnabled('canvasNetworkTimeline')) 44 this._setupTimeline();
61 this._setupTimeline();
62 } 45 }
63 46
64 /** 47 /**
65 * @param {!WebInspector.NetworkLogViewColumns.Descriptor} columnConfig 48 * @param {!WebInspector.NetworkLogViewColumns.Descriptor} columnConfig
66 * @return {!WebInspector.DataGrid.ColumnDescriptor} 49 * @return {!WebInspector.DataGrid.ColumnDescriptor}
67 */ 50 */
68 static _convertToDataGridDescriptor(columnConfig) { 51 static _convertToDataGridDescriptor(columnConfig) {
69 return /** @type {!WebInspector.DataGrid.ColumnDescriptor} */ ({ 52 return /** @type {!WebInspector.DataGrid.ColumnDescriptor} */ ({
70 id: columnConfig.id, 53 id: columnConfig.id,
71 title: columnConfig.title, 54 title: columnConfig.title,
72 sortable: columnConfig.sortable, 55 sortable: columnConfig.sortable,
73 align: columnConfig.align, 56 align: columnConfig.align,
74 nonSelectable: columnConfig.nonSelectable, 57 nonSelectable: columnConfig.nonSelectable,
75 weight: columnConfig.weight 58 weight: columnConfig.weight
76 }); 59 });
77 } 60 }
78 61
79 wasShown() { 62 wasShown() {
80 this._updateRowsSize(); 63 this._updateRowsSize();
81 } 64 }
82 65
83 willHide() { 66 willHide() {
84 this._popoverHelper.hidePopover(); 67 this._popoverHelper.hidePopover();
85 } 68 }
86 69
87 reset() { 70 reset() {
88 if (this._popoverHelper) 71 if (this._popoverHelper)
89 this._popoverHelper.hidePopover(); 72 this._popoverHelper.hidePopover();
90 this._timelineGrid.removeEventDividers(); 73 this._eventDividers.clear();
91 this._shownEventDividers.clear();
92 this.updateDividersIfNeeded();
93 } 74 }
94 75
95 _setupDataGrid() { 76 _setupDataGrid() {
96 var defaultColumns = WebInspector.NetworkLogViewColumns._defaultColumns; 77 var defaultColumns = WebInspector.NetworkLogViewColumns._defaultColumns;
97 var defaultColumnConfig = WebInspector.NetworkLogViewColumns._defaultColumnC onfig; 78 var defaultColumnConfig = WebInspector.NetworkLogViewColumns._defaultColumnC onfig;
98 79
99 this._columns = /** @type {!Array<!WebInspector.NetworkLogViewColumns.Descri ptor>} */ ([]); 80 this._columns = /** @type {!Array<!WebInspector.NetworkLogViewColumns.Descri ptor>} */ ([]);
100 for (var currentConfigColumn of defaultColumns) { 81 for (var currentConfigColumn of defaultColumns) {
101 var columnConfig = /** @type {!WebInspector.NetworkLogViewColumns.Descript or} */ ( 82 var columnConfig = /** @type {!WebInspector.NetworkLogViewColumns.Descript or} */ (
102 Object.assign(/** @type {!Object} */ ({}), defaultColumnConfig, curren tConfigColumn)); 83 Object.assign(/** @type {!Object} */ ({}), defaultColumnConfig, curren tConfigColumn));
(...skipping 12 matching lines...) Expand all
115 this._columns.map(WebInspector.NetworkLogViewColumns._convertToDataGridD escriptor)); 96 this._columns.map(WebInspector.NetworkLogViewColumns._convertToDataGridD escriptor));
116 this._dataGrid.element.addEventListener('mousedown', event => { 97 this._dataGrid.element.addEventListener('mousedown', event => {
117 if ((!this._dataGrid.selectedNode && event.button) || event.target.enclosi ngNodeOrSelfWithNodeName('a')) 98 if ((!this._dataGrid.selectedNode && event.button) || event.target.enclosi ngNodeOrSelfWithNodeName('a'))
118 event.consume(); 99 event.consume();
119 }, true); 100 }, true);
120 101
121 this._dataGridScroller = this._dataGrid.scrollContainer; 102 this._dataGridScroller = this._dataGrid.scrollContainer;
122 103
123 this._updateColumns(); 104 this._updateColumns();
124 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.SortingChanged, this._sortHandler, this); 105 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.SortingChanged, this._sortHandler, this);
125 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.ColumnsResized, this.updateDividersIfNeeded, this);
126 this._dataGrid.setHeaderContextMenuCallback(this._innerHeaderContextMenu.bin d(this)); 106 this._dataGrid.setHeaderContextMenuCallback(this._innerHeaderContextMenu.bin d(this));
127 107
128 this._timelineGrid = new WebInspector.TimelineGrid();
129 this._timelineGrid.element.classList.add('network-timeline-grid');
130 if (!Runtime.experiments.isEnabled('canvasNetworkTimeline'))
131 this._dataGrid.element.appendChild(this._timelineGrid.element);
132
133 this._setupDropdownColumns();
134
135 this._activeTimelineSortId = WebInspector.NetworkLogViewColumns.TimelineSort Ids.StartTime; 108 this._activeTimelineSortId = WebInspector.NetworkLogViewColumns.TimelineSort Ids.StartTime;
136 this._dataGrid.markColumnAsSortedBy( 109 this._dataGrid.markColumnAsSortedBy(
137 WebInspector.NetworkLogViewColumns._initialSortColumn, WebInspector.Data Grid.Order.Ascending); 110 WebInspector.NetworkLogViewColumns._initialSortColumn, WebInspector.Data Grid.Order.Ascending);
138 111
139 if (Runtime.experiments.isEnabled('canvasNetworkTimeline')) { 112 this._splitWidget = new WebInspector.SplitWidget(true, true, 'networkPanelSp litViewTimeline', 200);
140 this._splitWidget = new WebInspector.SplitWidget(true, true, 'networkPanel SplitViewTimeline', 200); 113 var widget = this._dataGrid.asWidget();
141 var widget = this._dataGrid.asWidget(); 114 widget.setMinimumSize(150, 0);
142 widget.setMinimumSize(150, 0); 115 this._splitWidget.setMainWidget(widget);
143 this._splitWidget.setMainWidget(widget);
144 }
145 } 116 }
146 117
147 _setupTimeline() { 118 _setupTimeline() {
148 this._timelineColumn = 119 this._timelineColumn =
149 new WebInspector.NetworkTimelineColumn(this._networkLogView.rowHeight(), this._networkLogView.calculator()); 120 new WebInspector.NetworkTimelineColumn(this._networkLogView.rowHeight(), this._networkLogView.calculator());
150 121
151 this._timelineColumn.element.addEventListener('contextmenu', handleContextMe nu.bind(this)); 122 this._timelineColumn.element.addEventListener('contextmenu', handleContextMe nu.bind(this));
152 this._timelineColumn.element.addEventListener('mousewheel', this._onMouseWhe el.bind(this, false), {passive: true}); 123 this._timelineColumn.element.addEventListener('mousewheel', this._onMouseWhe el.bind(this, false), {passive: true});
153 this._dataGridScroller.addEventListener('mousewheel', this._onMouseWheel.bin d(this, true), true); 124 this._dataGridScroller.addEventListener('mousewheel', this._onMouseWheel.bin d(this, true), true);
154 125
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 this._timelineScrollerWidthIsStale = false; 191 this._timelineScrollerWidthIsStale = false;
221 this._timelineColumn.setRightPadding( 192 this._timelineColumn.setRightPadding(
222 this._timelineScroller.offsetWidth - this._timelineScrollerContent.off setWidth); 193 this._timelineScroller.offsetWidth - this._timelineScrollerContent.off setWidth);
223 } 194 }
224 } 195 }
225 196
226 _redrawTimelineColumn() { 197 _redrawTimelineColumn() {
227 if (!this._timelineRequestsAreStale) { 198 if (!this._timelineRequestsAreStale) {
228 this._updateScrollerWidthIfNeeded(); 199 this._updateScrollerWidthIfNeeded();
229 this._timelineColumn.update( 200 this._timelineColumn.update(
230 this._activeScroller.scrollTop, this._eventDividersShown ? this._shown EventDividers : undefined); 201 this._activeScroller.scrollTop, this._eventDividersShown ? this._event Dividers : undefined);
231 return; 202 return;
232 } 203 }
233 var currentNode = this._dataGrid.rootNode(); 204 var currentNode = this._dataGrid.rootNode();
234 /** @type {!WebInspector.NetworkTimelineColumn.RequestData} */ 205 /** @type {!WebInspector.NetworkTimelineColumn.RequestData} */
235 var requestData = {requests: [], navigationRequest: null}; 206 var requestData = {requests: [], navigationRequest: null};
236 while (currentNode = currentNode.traverseNextNode(true)) { 207 while (currentNode = currentNode.traverseNextNode(true)) {
237 if (currentNode.isNavigationRequest()) 208 if (currentNode.isNavigationRequest())
238 requestData.navigationRequest = currentNode.request(); 209 requestData.navigationRequest = currentNode.request();
239 requestData.requests.push(currentNode.request()); 210 requestData.requests.push(currentNode.request());
240 } 211 }
241 this._timelineColumn.update(this._activeScroller.scrollTop, this._shownEvent Dividers, requestData); 212 this._timelineColumn.update(this._activeScroller.scrollTop, this._eventDivid ers, requestData);
242 } 213 }
243 214
244 /** 215 /**
245 * @param {?WebInspector.NetworkRequest} request 216 * @param {?WebInspector.NetworkRequest} request
246 * @param {boolean} highlightInitiatorChain 217 * @param {boolean} highlightInitiatorChain
247 */ 218 */
248 setHoveredRequest(request, highlightInitiatorChain) { 219 setHoveredRequest(request, highlightInitiatorChain) {
249 if (Runtime.experiments.isEnabled('canvasNetworkTimeline')) 220 this._timelineColumn.setHoveredRequest(request, highlightInitiatorChain);
250 this._timelineColumn.setHoveredRequest(request, highlightInitiatorChain);
251 } 221 }
252 222
253 _createTimelineHeader() { 223 _createTimelineHeader() {
254 this._timelineHeaderElement = this._timelineColumn.contentElement.createChil d('div', 'network-timeline-header'); 224 this._timelineHeaderElement = this._timelineColumn.contentElement.createChil d('div', 'network-timeline-header');
255 this._timelineHeaderElement.addEventListener('click', timelineHeaderClicked. bind(this)); 225 this._timelineHeaderElement.addEventListener('click', timelineHeaderClicked. bind(this));
256 this._timelineHeaderElement.addEventListener( 226 this._timelineHeaderElement.addEventListener(
257 'contextmenu', event => this._innerHeaderContextMenu(new WebInspector.Co ntextMenu(event))); 227 'contextmenu', event => this._innerHeaderContextMenu(new WebInspector.Co ntextMenu(event)));
258 var innerElement = this._timelineHeaderElement.createChild('div'); 228 var innerElement = this._timelineHeaderElement.createChild('div');
259 innerElement.textContent = WebInspector.UIString('Waterfall'); 229 innerElement.textContent = WebInspector.UIString('Waterfall');
260 this._timelineColumnSortIcon = this._timelineHeaderElement.createChild('div' , 'sort-order-icon-container') 230 this._timelineColumnSortIcon = this._timelineHeaderElement.createChild('div' , 'sort-order-icon-container')
261 .createChild('div', 'sort-order-icon'); 231 .createChild('div', 'sort-order-icon');
262 232
263 /** 233 /**
264 * @this {WebInspector.NetworkLogViewColumns} 234 * @this {WebInspector.NetworkLogViewColumns}
265 */ 235 */
266 function timelineHeaderClicked() { 236 function timelineHeaderClicked() {
267 var sortOrders = WebInspector.DataGrid.Order; 237 var sortOrders = WebInspector.DataGrid.Order;
268 var sortOrder = 238 var sortOrder =
269 this._dataGrid.sortOrder() === sortOrders.Ascending ? sortOrders.Desce nding : sortOrders.Ascending; 239 this._dataGrid.sortOrder() === sortOrders.Ascending ? sortOrders.Desce nding : sortOrders.Ascending;
270 this._dataGrid.markColumnAsSortedBy('timeline', sortOrder); 240 this._dataGrid.markColumnAsSortedBy('timeline', sortOrder);
271 this._sortHandler(); 241 this._sortHandler();
272 } 242 }
273 } 243 }
274 244
275 /** 245 /**
276 * @param {!WebInspector.NetworkTimeCalculator} x 246 * @param {!WebInspector.NetworkTimeCalculator} x
277 */ 247 */
278 setCalculator(x) { 248 setCalculator(x) {
279 if (Runtime.experiments.isEnabled('canvasNetworkTimeline')) 249 this._timelineColumn.setCalculator(x);
280 this._timelineColumn.setCalculator(x);
281 } 250 }
282 251
283 dataChanged() { 252 dataChanged() {
284 if (Runtime.experiments.isEnabled('canvasNetworkTimeline')) 253 this._timelineRequestsAreStale = true;
285 this._timelineRequestsAreStale = true;
286 } 254 }
287 255
288 _updateRowsSize() { 256 _updateRowsSize() {
289 var largeRows = !!this._networkLogLargeRowsSetting.get(); 257 var largeRows = !!this._networkLogLargeRowsSetting.get();
290 this._dataGrid.element.classList.toggle('small', !largeRows); 258 this._dataGrid.element.classList.toggle('small', !largeRows);
291 this._dataGrid.scheduleUpdate(); 259 this._dataGrid.scheduleUpdate();
292 260
293 if (!Runtime.experiments.isEnabled('canvasNetworkTimeline'))
294 return;
295 this._timelineScrollerWidthIsStale = true; 261 this._timelineScrollerWidthIsStale = true;
296 this._timelineColumn.setRowHeight(this._networkLogView.rowHeight()); 262 this._timelineColumn.setRowHeight(this._networkLogView.rowHeight());
297 this._timelineScroller.classList.toggle('small', !largeRows); 263 this._timelineScroller.classList.toggle('small', !largeRows);
298 this._timelineHeaderElement.classList.toggle('small', !largeRows); 264 this._timelineHeaderElement.classList.toggle('small', !largeRows);
299 this._timelineGrid.element.classList.toggle('small', !this._networkLogLargeR owsSetting.get());
300 this._timelineColumn.setHeaderHeight(this._timelineScroller.offsetTop); 265 this._timelineColumn.setHeaderHeight(this._timelineScroller.offsetTop);
301 } 266 }
302 267
303 /** 268 /**
304 * @param {!Element} element 269 * @param {!Element} element
305 */ 270 */
306 show(element) { 271 show(element) {
307 if (Runtime.experiments.isEnabled('canvasNetworkTimeline')) 272 this._splitWidget.show(element);
308 this._splitWidget.show(element);
309 else
310 this._dataGrid.asWidget().show(element);
311 } 273 }
312 274
313 /** 275 /**
314 * @return {!WebInspector.SortableDataGrid} dataGrid 276 * @return {!WebInspector.SortableDataGrid} dataGrid
315 */ 277 */
316 dataGrid() { 278 dataGrid() {
317 return this._dataGrid; 279 return this._dataGrid;
318 } 280 }
319 281
320 _setupDropdownColumns() {
321 for (var columnConfig of this._columns) {
322 if (!columnConfig.sortConfig || !columnConfig.sortConfig.entries)
323 continue;
324 var select = createElement('select');
325 var placeHolderOption = select.createChild('option');
326 placeHolderOption.classList.add('hidden');
327 for (var entry of columnConfig.sortConfig.entries) {
328 var option = select.createChild('option');
329 option.value = entry.id;
330 option.label = entry.title;
331 select.appendChild(option);
332 }
333 var header = this._dataGrid.headerTableHeader(columnConfig.id);
334 header.replaceChild(select, header.firstChild);
335 header.createChild('div', 'sort-order-icon-container').createChild('div', 'sort-order-icon');
336 columnConfig.selectBox = select;
337 select.addEventListener('change', this._sortByDropdownItem.bind(this, colu mnConfig), false);
338 this._dropDownColumnSelectors.push(select);
339 }
340 }
341
342 sortByCurrentColumn() { 282 sortByCurrentColumn() {
343 this._sortHandler(); 283 this._sortHandler();
344 } 284 }
345 285
346 _sortHandler() { 286 _sortHandler() {
347 var columnId = this._dataGrid.sortColumnId(); 287 var columnId = this._dataGrid.sortColumnId();
348 this._networkLogView.removeAllNodeHighlights(); 288 this._networkLogView.removeAllNodeHighlights();
349 if (Runtime.experiments.isEnabled('canvasNetworkTimeline') && columnId === ' timeline') { 289 if (columnId === 'timeline') {
350 this._timelineColumnSortIcon.classList.remove('sort-ascending', 'sort-desc ending'); 290 this._timelineColumnSortIcon.classList.remove('sort-ascending', 'sort-desc ending');
351 291
352 if (this._dataGrid.sortOrder() === WebInspector.DataGrid.Order.Ascending) 292 if (this._dataGrid.sortOrder() === WebInspector.DataGrid.Order.Ascending)
353 this._timelineColumnSortIcon.classList.add('sort-ascending'); 293 this._timelineColumnSortIcon.classList.add('sort-ascending');
354 else 294 else
355 this._timelineColumnSortIcon.classList.add('sort-descending'); 295 this._timelineColumnSortIcon.classList.add('sort-descending');
356 296
357 this._timelineRequestsAreStale = true; 297 this._timelineRequestsAreStale = true;
358 var sortFunction = 298 var sortFunction =
359 WebInspector.NetworkDataGridNode.RequestPropertyComparator.bind(null, this._activeTimelineSortId); 299 WebInspector.NetworkDataGridNode.RequestPropertyComparator.bind(null, this._activeTimelineSortId);
360 this._dataGrid.sortNodes(sortFunction, !this._dataGrid.isSortOrderAscendin g()); 300 this._dataGrid.sortNodes(sortFunction, !this._dataGrid.isSortOrderAscendin g());
361 return; 301 return;
362 } 302 }
363 303
364 var columnConfig = this._columns.find(columnConfig => columnConfig.id === co lumnId); 304 var columnConfig = this._columns.find(columnConfig => columnConfig.id === co lumnId);
365 if (!columnConfig) 305 if (!columnConfig || !columnConfig.sortingFunction)
366 return;
367 if (columnConfig.sortConfig && columnConfig.sortConfig.entries) {
368 this._sortByDropdownItem(columnConfig);
369 return;
370 }
371 if (!columnConfig.sortConfig.sortingFunction)
372 return; 306 return;
373 307
374 this._dataGrid.sortNodes(columnConfig.sortConfig.sortingFunction, !this._dat aGrid.isSortOrderAscending()); 308 this._dataGrid.sortNodes(columnConfig.sortingFunction, !this._dataGrid.isSor tOrderAscending());
375 this._networkLogView.dataGridSorted(); 309 this._networkLogView.dataGridSorted();
376 } 310 }
377 311
378 /**
379 * @param {!WebInspector.NetworkLogViewColumns.Descriptor} columnConfig
380 */
381 _sortByDropdownItem(columnConfig) {
382 this._networkLogView.removeAllNodeHighlights();
383 var selectedIndex = columnConfig.selectBox.selectedIndex;
384 if (!selectedIndex)
385 selectedIndex = 1; // Sort by first item by default.
386 var selectedItemConfig = columnConfig.sortConfig.entries[selectedIndex - 1]; // -1 because of placeholder.
387 var selectedOption = columnConfig.selectBox[selectedIndex];
388 var value = selectedOption.value;
389
390 this._dataGrid.sortNodes(selectedItemConfig.sortingFunction);
391 this._dataGrid.markColumnAsSortedBy(
392 columnConfig.id, /** @type {!WebInspector.DataGrid.Order} */ (selectedIt emConfig.sort));
393 if (selectedItemConfig.calculator)
394 this._networkLogView.setCalculator(this._calculatorsMap.get(selectedItemCo nfig.calculator));
395 columnConfig.selectBox.options[0].label = selectedItemConfig.title;
396 columnConfig.selectBox.selectedIndex = 0;
397 this._networkLogView.dataGridSorted();
398 }
399
400 _updateColumns() { 312 _updateColumns() {
401 if (!this._dataGrid) 313 if (!this._dataGrid)
402 return; 314 return;
403 var visibleColumns = /** @type {!Object.<string, boolean>} */ ({}); 315 var visibleColumns = /** @type {!Object.<string, boolean>} */ ({});
404 if (this._gridMode) { 316 if (this._gridMode) {
405 for (var columnConfig of this._columns) 317 for (var columnConfig of this._columns)
406 visibleColumns[columnConfig.id] = columnConfig.visible; 318 visibleColumns[columnConfig.id] = columnConfig.visible;
407 } else { 319 } else {
408 visibleColumns.name = true; 320 visibleColumns.name = true;
409 } 321 }
410 this._dataGrid.setColumnsVisiblity(visibleColumns); 322 this._dataGrid.setColumnsVisiblity(visibleColumns);
411 } 323 }
412 324
413 /** 325 /**
414 * @param {boolean} gridMode 326 * @param {boolean} gridMode
415 */ 327 */
416 switchViewMode(gridMode) { 328 switchViewMode(gridMode) {
417 if (this._gridMode === gridMode) 329 if (this._gridMode === gridMode)
418 return; 330 return;
419 this._gridMode = gridMode; 331 this._gridMode = gridMode;
420 332
421 if (gridMode) { 333 if (gridMode) {
422 if (this._dataGrid.selectedNode) 334 if (this._dataGrid.selectedNode)
423 this._dataGrid.selectedNode.selected = false; 335 this._dataGrid.selectedNode.selected = false;
424 } else {
425 this._networkLogView.removeAllNodeHighlights();
426 this._popoverHelper.hidePopover();
427 }
428
429 this._networkLogView.element.classList.toggle('brief-mode', !gridMode);
430 this._updateColumns();
431
432 if (!Runtime.experiments.isEnabled('canvasNetworkTimeline'))
433 return;
434 // TODO(allada) Move this code into the code above.
435 if (gridMode) {
436 this._splitWidget.showBoth(); 336 this._splitWidget.showBoth();
437 this._activeScroller = this._timelineScroller; 337 this._activeScroller = this._timelineScroller;
438 this._timelineScroller.scrollTop = this._dataGridScroller.scrollTop; 338 this._timelineScroller.scrollTop = this._dataGridScroller.scrollTop;
439 this._dataGridScroller.style.overflow = 'hidden';
440 this._dataGrid.setScrollContainer(this._timelineScroller); 339 this._dataGrid.setScrollContainer(this._timelineScroller);
441 } else { 340 } else {
341 this._networkLogView.removeAllNodeHighlights();
442 this._splitWidget.hideSidebar(); 342 this._splitWidget.hideSidebar();
443 this._activeScroller = this._dataGridScroller; 343 this._activeScroller = this._dataGridScroller;
444 this._dataGridScroller.style.overflow = 'overlay';
445 this._dataGrid.setScrollContainer(this._dataGridScroller); 344 this._dataGrid.setScrollContainer(this._dataGridScroller);
446 } 345 }
346 this._networkLogView.element.classList.toggle('brief-mode', !gridMode);
347 this._updateColumns();
447 } 348 }
448 349
449 /** 350 /**
450 * @param {!WebInspector.NetworkLogViewColumns.Descriptor} columnConfig 351 * @param {!WebInspector.NetworkLogViewColumns.Descriptor} columnConfig
451 */ 352 */
452 _toggleColumnVisibility(columnConfig) { 353 _toggleColumnVisibility(columnConfig) {
453 this._loadColumns(); 354 this._loadColumns();
454 columnConfig.visible = !columnConfig.visible; 355 columnConfig.visible = !columnConfig.visible;
455 this._saveColumns(); 356 this._saveColumns();
456 this._updateColumns(); 357 this._updateColumns();
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 subtitleDiv.createTextChild(subtitle); 392 subtitleDiv.createTextChild(subtitle);
492 return fragment; 393 return fragment;
493 } 394 }
494 395
495 /** 396 /**
496 * @param {!WebInspector.ContextMenu} contextMenu 397 * @param {!WebInspector.ContextMenu} contextMenu
497 */ 398 */
498 _innerHeaderContextMenu(contextMenu) { 399 _innerHeaderContextMenu(contextMenu) {
499 var columnConfigs = this._columns.filter(columnConfig => columnConfig.hideab le); 400 var columnConfigs = this._columns.filter(columnConfig => columnConfig.hideab le);
500 var nonResponseHeaders = columnConfigs.filter(columnConfig => !columnConfig. isResponseHeader); 401 var nonResponseHeaders = columnConfigs.filter(columnConfig => !columnConfig. isResponseHeader);
501 for (var columnConfig of nonResponseHeaders) 402 for (var columnConfig of nonResponseHeaders) {
502 contextMenu.appendCheckboxItem( 403 contextMenu.appendCheckboxItem(
503 columnConfig.title, this._toggleColumnVisibility.bind(this, columnConf ig), columnConfig.visible); 404 columnConfig.title, this._toggleColumnVisibility.bind(this, columnConf ig), columnConfig.visible);
405 }
504 406
505 contextMenu.appendSeparator(); 407 contextMenu.appendSeparator();
506 408
507 var responseSubMenu = contextMenu.appendSubMenuItem(WebInspector.UIString('R esponse Headers')); 409 var responseSubMenu = contextMenu.appendSubMenuItem(WebInspector.UIString('R esponse Headers'));
508 var responseHeaders = columnConfigs.filter(columnConfig => columnConfig.isRe sponseHeader); 410 var responseHeaders = columnConfigs.filter(columnConfig => columnConfig.isRe sponseHeader);
509 for (var columnConfig of responseHeaders) 411 for (var columnConfig of responseHeaders) {
510 responseSubMenu.appendCheckboxItem( 412 responseSubMenu.appendCheckboxItem(
511 columnConfig.title, this._toggleColumnVisibility.bind(this, columnConf ig), columnConfig.visible); 413 columnConfig.title, this._toggleColumnVisibility.bind(this, columnConf ig), columnConfig.visible);
414 }
512 415
513 responseSubMenu.appendSeparator(); 416 responseSubMenu.appendSeparator();
514 responseSubMenu.appendItem( 417 responseSubMenu.appendItem(
515 WebInspector.UIString('Manage Header Columns\u2026'), this._manageCustom HeaderDialog.bind(this)); 418 WebInspector.UIString('Manage Header Columns\u2026'), this._manageCustom HeaderDialog.bind(this));
516 419
517 if (Runtime.experiments.isEnabled('canvasNetworkTimeline')) { 420 contextMenu.appendSeparator();
518 contextMenu.appendSeparator(); 421
519 var timelineSortIds = WebInspector.NetworkLogViewColumns.TimelineSortIds; 422 var timelineSortIds = WebInspector.NetworkLogViewColumns.TimelineSortIds;
520 var timelineSubMenu = contextMenu.appendSubMenuItem(WebInspector.UIString( 'Waterfall')); 423 var timelineSubMenu = contextMenu.appendSubMenuItem(WebInspector.UIString('W aterfall'));
521 timelineSubMenu.appendCheckboxItem( 424 timelineSubMenu.appendCheckboxItem(
522 WebInspector.UIString('Start Time'), setTimelineMode.bind(this, timeli neSortIds.StartTime), 425 WebInspector.UIString('Start Time'), setTimelineMode.bind(this, timeline SortIds.StartTime),
523 this._activeTimelineSortId === timelineSortIds.StartTime); 426 this._activeTimelineSortId === timelineSortIds.StartTime);
524 timelineSubMenu.appendCheckboxItem( 427 timelineSubMenu.appendCheckboxItem(
525 WebInspector.UIString('Response Time'), setTimelineMode.bind(this, tim elineSortIds.ResponseTime), 428 WebInspector.UIString('Response Time'), setTimelineMode.bind(this, timel ineSortIds.ResponseTime),
526 this._activeTimelineSortId === timelineSortIds.ResponseTime); 429 this._activeTimelineSortId === timelineSortIds.ResponseTime);
527 timelineSubMenu.appendCheckboxItem( 430 timelineSubMenu.appendCheckboxItem(
528 WebInspector.UIString('End Time'), setTimelineMode.bind(this, timeline SortIds.EndTime), 431 WebInspector.UIString('End Time'), setTimelineMode.bind(this, timelineSo rtIds.EndTime),
529 this._activeTimelineSortId === timelineSortIds.EndTime); 432 this._activeTimelineSortId === timelineSortIds.EndTime);
530 timelineSubMenu.appendCheckboxItem( 433 timelineSubMenu.appendCheckboxItem(
531 WebInspector.UIString('Total Duration'), setTimelineMode.bind(this, ti melineSortIds.Duration), 434 WebInspector.UIString('Total Duration'), setTimelineMode.bind(this, time lineSortIds.Duration),
532 this._activeTimelineSortId === timelineSortIds.Duration); 435 this._activeTimelineSortId === timelineSortIds.Duration);
533 timelineSubMenu.appendCheckboxItem( 436 timelineSubMenu.appendCheckboxItem(
534 WebInspector.UIString('Latency'), setTimelineMode.bind(this, timelineS ortIds.Latency), 437 WebInspector.UIString('Latency'), setTimelineMode.bind(this, timelineSor tIds.Latency),
535 this._activeTimelineSortId === timelineSortIds.Latency); 438 this._activeTimelineSortId === timelineSortIds.Latency);
536 }
537 439
538 contextMenu.show(); 440 contextMenu.show();
539 441
540 /** 442 /**
541 * @param {!WebInspector.NetworkLogViewColumns.TimelineSortIds} sortId 443 * @param {!WebInspector.NetworkLogViewColumns.TimelineSortIds} sortId
542 * @this {WebInspector.NetworkLogViewColumns} 444 * @this {WebInspector.NetworkLogViewColumns}
543 */ 445 */
544 function setTimelineMode(sortId) { 446 function setTimelineMode(sortId) {
545 var calculator = this._calculatorsMap.get(WebInspector.NetworkLogViewColum ns._calculatorTypes.Time); 447 var calculator = this._calculatorsMap.get(WebInspector.NetworkLogViewColum ns._calculatorTypes.Time);
546 var timelineSortIds = WebInspector.NetworkLogViewColumns.TimelineSortIds; 448 var timelineSortIds = WebInspector.NetworkLogViewColumns.TimelineSortIds;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 if (currentColumnConfig) 503 if (currentColumnConfig)
602 return null; 504 return null;
603 505
604 var columnConfig = /** @type {!WebInspector.NetworkLogViewColumns.Descriptor } */ ( 506 var columnConfig = /** @type {!WebInspector.NetworkLogViewColumns.Descriptor } */ (
605 Object.assign(/** @type {!Object} */ ({}), WebInspector.NetworkLogViewCo lumns._defaultColumnConfig, { 507 Object.assign(/** @type {!Object} */ ({}), WebInspector.NetworkLogViewCo lumns._defaultColumnConfig, {
606 id: headerId, 508 id: headerId,
607 title: headerTitle, 509 title: headerTitle,
608 isResponseHeader: true, 510 isResponseHeader: true,
609 isCustomHeader: true, 511 isCustomHeader: true,
610 visible: true, 512 visible: true,
611 sortConfig: { 513 sortingFunction: WebInspector.NetworkDataGridNode.ResponseHeaderString Comparator.bind(null, headerId)
612 sortingFunction: WebInspector.NetworkDataGridNode.ResponseHeaderStri ngComparator.bind(null, headerId)
613 }
614 })); 514 }));
615 this._columns.splice(index, 0, columnConfig); 515 this._columns.splice(index, 0, columnConfig);
616 if (this._dataGrid) 516 if (this._dataGrid)
617 this._dataGrid.addColumn(WebInspector.NetworkLogViewColumns._convertToData GridDescriptor(columnConfig), index); 517 this._dataGrid.addColumn(WebInspector.NetworkLogViewColumns._convertToData GridDescriptor(columnConfig), index);
618 this._saveColumns(); 518 this._saveColumns();
619 this._updateColumns(); 519 this._updateColumns();
620 return columnConfig; 520 return columnConfig;
621 } 521 }
622 522
623 /** 523 /**
(...skipping 11 matching lines...) Expand all
635 var oldColumnConfig = this._columns[oldIndex]; 535 var oldColumnConfig = this._columns[oldIndex];
636 var currentColumnConfig = this._columns.find(columnConfig => columnConfig.id === newHeaderId); 536 var currentColumnConfig = this._columns.find(columnConfig => columnConfig.id === newHeaderId);
637 if (!oldColumnConfig || (currentColumnConfig && oldHeaderId !== newHeaderId) ) 537 if (!oldColumnConfig || (currentColumnConfig && oldHeaderId !== newHeaderId) )
638 return false; 538 return false;
639 539
640 this._removeCustomHeader(oldHeaderId); 540 this._removeCustomHeader(oldHeaderId);
641 this._addCustomHeader(newHeaderTitle, newHeaderId, oldIndex); 541 this._addCustomHeader(newHeaderTitle, newHeaderId, oldIndex);
642 return true; 542 return true;
643 } 543 }
644 544
645 updateDividersIfNeeded() {
646 // TODO(allada) Remove this code out when timeline canvas experiment is over .
647 if (Runtime.experiments.isEnabled('canvasNetworkTimeline'))
648 return;
649 if (!this._networkLogView.isShowing()) {
650 this._networkLogView.scheduleRefresh();
651 return;
652 }
653
654 var timelineOffset = this._dataGrid.columnOffset('timeline');
655 // Position timline grid location.
656 if (timelineOffset)
657 this._timelineGrid.element.style.left = timelineOffset + 'px';
658
659 var calculator = this._calculatorsMap.get(WebInspector.NetworkLogViewColumns ._calculatorTypes.Time);
660 calculator.setDisplayWindow(this._timelineGrid.dividersElement.clientWidth);
661 this._timelineGrid.updateDividers(calculator, 75);
662
663 if (calculator.startAtZero) {
664 // If our current sorting method starts at zero, that means it shows all
665 // requests starting at the same point, and so onLoad event and DOMContent
666 // event lines really wouldn't make much sense here, so don't render them.
667 return;
668 }
669
670 this._updateEventDividers();
671 }
672
673 /** 545 /**
674 * @param {!Element} element 546 * @param {!Element} element
675 * @param {!Event} event 547 * @param {!Event} event
676 * @return {!Element|!AnchorBox|undefined} 548 * @return {!Element|!AnchorBox|undefined}
677 */ 549 */
678 _getPopoverAnchor(element, event) { 550 _getPopoverAnchor(element, event) {
679 if (!this._gridMode) 551 if (!this._gridMode)
680 return; 552 return;
681 var anchor = element.enclosingNodeOrSelfWithClass('network-graph-bar') || 553 var anchor = element.enclosingNodeOrSelfWithClass('network-script-initiated' );
682 element.enclosingNodeOrSelfWithClass('network-graph-label');
683 if (anchor && anchor.parentElement.request && anchor.parentElement.request.t iming)
684 return anchor;
685 anchor = element.enclosingNodeOrSelfWithClass('network-script-initiated');
686 if (anchor && anchor.request) { 554 if (anchor && anchor.request) {
687 var initiator = /** @type {!WebInspector.NetworkRequest} */ (anchor.reques t).initiator(); 555 var initiator = /** @type {!WebInspector.NetworkRequest} */ (anchor.reques t).initiator();
688 if (initiator && initiator.stack) 556 if (initiator && initiator.stack)
689 return anchor; 557 return anchor;
690 } 558 }
691 } 559 }
692 560
693 /** 561 /**
694 * @param {!Element} anchor 562 * @param {!Element} anchor
695 * @param {!WebInspector.Popover} popover 563 * @param {!WebInspector.Popover} popover
696 */ 564 */
697 _showPopover(anchor, popover) { 565 _showPopover(anchor, popover) {
698 var content; 566 var request = /** @type {!WebInspector.NetworkRequest} */ (anchor.request);
699 if (anchor.classList.contains('network-script-initiated')) { 567 var initiator = /** @type {!Protocol.Network.Initiator} */ (request.initiato r());
700 var request = /** @type {!WebInspector.NetworkRequest} */ (anchor.request) ; 568 var content = WebInspector.DOMPresentationUtils.buildStackTracePreviewConten ts(
701 var initiator = /** @type {!Protocol.Network.Initiator} */ (request.initia tor()); 569 request.target(), this._popupLinkifier, initiator.stack);
702 content = WebInspector.DOMPresentationUtils.buildStackTracePreviewContents ( 570 popover.setCanShrink(true);
703 request.target(), this._popupLinkifier, initiator.stack);
704 popover.setCanShrink(true);
705 } else {
706 content = WebInspector.RequestTimingView.createTimingTable(
707 anchor.parentElement.request, this._networkLogView.timeCalculator().mi nimumBoundary());
708 popover.setCanShrink(false);
709 }
710 popover.showForAnchor(content, anchor); 571 popover.showForAnchor(content, anchor);
711 } 572 }
712 573
713 _onHidePopover() { 574 _onHidePopover() {
714 this._popupLinkifier.reset(); 575 this._popupLinkifier.reset();
715 } 576 }
716 577
717 /** 578 /**
718 * @param {!Array<number>} times 579 * @param {!Array<number>} times
719 * @param {string} className 580 * @param {string} className
720 */ 581 */
721 addEventDividers(times, className) { 582 addEventDividers(times, className) {
722 if (Runtime.experiments.isEnabled('canvasNetworkTimeline')) { 583 // TODO(allada) Remove this and pass in the color.
723 // TODO(allada) When we remove old timeline remove this and pass in the co lor. 584 var color = 'transparent';
724 var color = 'transparent'; 585 switch (className) {
725 switch (className) { 586 case 'network-blue-divider':
726 case 'network-blue-divider': 587 color = 'hsla(240, 100%, 80%, 0.7)';
727 color = 'hsla(240, 100%, 80%, 0.7)'; 588 break;
728 break; 589 case 'network-red-divider':
729 case 'network-red-divider': 590 color = 'rgba(255, 0, 0, 0.5)';
730 color = 'rgba(255, 0, 0, 0.5)'; 591 break;
731 break; 592 default:
732 default: 593 return;
733 return;
734 }
735 var currentTimes = this._shownEventDividers.get(color) || [];
736 this._shownEventDividers.set(color, currentTimes.concat(times));
737
738 this._networkLogView.scheduleRefresh();
739 return;
740 } 594 }
741 595 var currentTimes = this._eventDividers.get(color) || [];
742 for (var i = 0; i < times.length; ++i) { 596 this._eventDividers.set(color, currentTimes.concat(times));
743 var element = createElementWithClass('div', 'network-event-divider ' + cla ssName);
744 this._timelineGrid.addEventDivider(element);
745 this._eventDividers.push({time: times[i], element: element});
746 }
747 // Update event dividers immediately
748 this._updateEventDividers();
749 // Schedule refresh in case dividers change the calculator span.
750 this._networkLogView.scheduleRefresh(); 597 this._networkLogView.scheduleRefresh();
751 } 598 }
752 599
753 _updateEventDividers() {
754 if (Runtime.experiments.isEnabled('canvasNetworkTimeline'))
755 return;
756 var calculator = this._calculatorsMap.get(WebInspector.NetworkLogViewColumns ._calculatorTypes.Time);
757 for (var divider of this._eventDividers) {
758 var timePercent = calculator.computePercentageFromEventTime(divider.time);
759 divider.element.classList.toggle('invisible', timePercent < 0);
760 divider.element.style.left = timePercent + '%';
761 }
762 }
763
764 hideEventDividers() { 600 hideEventDividers() {
765 this._eventDividersShown = true; 601 this._eventDividersShown = true;
766 if (Runtime.experiments.isEnabled('canvasNetworkTimeline')) { 602 this._redrawTimelineColumn();
767 this._redrawTimelineColumn();
768 return;
769 }
770 this._timelineGrid.hideEventDividers();
771 } 603 }
772 604
773 showEventDividers() { 605 showEventDividers() {
774 this._eventDividersShown = false; 606 this._eventDividersShown = false;
775 if (Runtime.experiments.isEnabled('canvasNetworkTimeline')) { 607 this._redrawTimelineColumn();
776 this._redrawTimelineColumn();
777 return;
778 }
779 this._timelineGrid.showEventDividers();
780 } 608 }
781 609
782 /** 610 /**
783 * @param {number} time 611 * @param {number} time
784 */ 612 */
785 selectFilmStripFrame(time) { 613 selectFilmStripFrame(time) {
786 if (Runtime.experiments.isEnabled('canvasNetworkTimeline')) { 614 this._eventDividers.set(WebInspector.NetworkLogViewColumns._filmStripDivider Color, [time]);
787 this._shownEventDividers.set(WebInspector.NetworkLogViewColumns._filmStrip DividerColor, [time]); 615 this._redrawTimelineColumn();
788 this._redrawTimelineColumn();
789 return;
790 }
791 for (var divider of this._eventDividers)
792 divider.element.classList.toggle('network-frame-divider-selected', divider .time === time);
793 } 616 }
794 617
795 clearFilmStripFrame() { 618 clearFilmStripFrame() {
796 if (Runtime.experiments.isEnabled('canvasNetworkTimeline')) { 619 this._eventDividers.delete(WebInspector.NetworkLogViewColumns._filmStripDivi derColor);
797 this._shownEventDividers.delete(WebInspector.NetworkLogViewColumns._filmSt ripDividerColor); 620 this._redrawTimelineColumn();
798 this._redrawTimelineColumn();
799 return;
800 }
801 for (var divider of this._eventDividers)
802 divider.element.classList.toggle('network-frame-divider-selected', false);
803 } 621 }
804 }; 622 };
805 623
806 WebInspector.NetworkLogViewColumns._initialSortColumn = 'timeline'; 624 WebInspector.NetworkLogViewColumns._initialSortColumn = 'timeline';
807 625
808 /** 626 /**
809 * @typedef {{ 627 * @typedef {{
810 * id: string, 628 * id: string,
811 * title: string, 629 * title: string,
812 * titleDOMFragment: (!DocumentFragment|undefined), 630 * titleDOMFragment: (!DocumentFragment|undefined),
813 * subtitle: (string|null), 631 * subtitle: (string|null),
814 * visible: boolean, 632 * visible: boolean,
815 * weight: number, 633 * weight: number,
816 * hideable: boolean, 634 * hideable: boolean,
817 * nonSelectable: boolean, 635 * nonSelectable: boolean,
818 * sortable: boolean, 636 * sortable: boolean,
819 * align: (?WebInspector.DataGrid.Align|undefined), 637 * align: (?WebInspector.DataGrid.Align|undefined),
820 * isResponseHeader: boolean, 638 * isResponseHeader: boolean,
821 * sortConfig: !WebInspector.NetworkLogViewColumns.SortConfig, 639 * sortingFunction: (!function(!WebInspector.NetworkDataGridNode, !WebInspec tor.NetworkDataGridNode):number|undefined),
822 * isCustomHeader: boolean 640 * isCustomHeader: boolean
823 * }} 641 * }}
824 */ 642 */
825 WebInspector.NetworkLogViewColumns.Descriptor; 643 WebInspector.NetworkLogViewColumns.Descriptor;
826 644
827 /**
828 * @typedef {{
829 * sortingFunction: (!function(!WebInspector.NetworkDataGridNode, !WebInspec tor.NetworkDataGridNode):number|undefined),
830 * entries: (!Array.<!WebInspector.DataGrid.ColumnDescriptor>|undefined)
831 * }}
832 */
833 WebInspector.NetworkLogViewColumns.SortConfig;
834
835 /** @enum {string} */ 645 /** @enum {string} */
836 WebInspector.NetworkLogViewColumns._calculatorTypes = { 646 WebInspector.NetworkLogViewColumns._calculatorTypes = {
837 Duration: 'Duration', 647 Duration: 'Duration',
838 Time: 'Time' 648 Time: 'Time'
839 }; 649 };
840 650
841 /** 651 /**
842 * @type {!Object} column 652 * @type {!Object} column
843 */ 653 */
844 WebInspector.NetworkLogViewColumns._defaultColumnConfig = { 654 WebInspector.NetworkLogViewColumns._defaultColumnConfig = {
(...skipping 14 matching lines...) Expand all
859 WebInspector.NetworkLogViewColumns._defaultColumns = [ 669 WebInspector.NetworkLogViewColumns._defaultColumns = [
860 { 670 {
861 id: 'name', 671 id: 'name',
862 title: WebInspector.UIString('Name'), 672 title: WebInspector.UIString('Name'),
863 subtitle: WebInspector.UIString('Path'), 673 subtitle: WebInspector.UIString('Path'),
864 visible: true, 674 visible: true,
865 weight: 20, 675 weight: 20,
866 hideable: false, 676 hideable: false,
867 nonSelectable: false, 677 nonSelectable: false,
868 alwaysVisible: true, 678 alwaysVisible: true,
869 sortConfig: {sortingFunction: WebInspector.NetworkDataGridNode.NameComparato r} 679 sortingFunction: WebInspector.NetworkDataGridNode.NameComparator
870 }, 680 },
871 { 681 {
872 id: 'method', 682 id: 'method',
873 title: WebInspector.UIString('Method'), 683 title: WebInspector.UIString('Method'),
874 sortConfig: 684 sortingFunction: WebInspector.NetworkDataGridNode.RequestPropertyComparator. bind(null, 'requestMethod')
875 {sortingFunction: WebInspector.NetworkDataGridNode.RequestPropertyCompar ator.bind(null, 'requestMethod')}
876 }, 685 },
877 { 686 {
878 id: 'status', 687 id: 'status',
879 title: WebInspector.UIString('Status'), 688 title: WebInspector.UIString('Status'),
880 visible: true, 689 visible: true,
881 subtitle: WebInspector.UIString('Text'), 690 subtitle: WebInspector.UIString('Text'),
882 sortConfig: {sortingFunction: WebInspector.NetworkDataGridNode.RequestProper tyComparator.bind(null, 'statusCode')} 691 sortingFunction: WebInspector.NetworkDataGridNode.RequestPropertyComparator. bind(null, 'statusCode')
883 }, 692 },
884 { 693 {
885 id: 'protocol', 694 id: 'protocol',
886 title: WebInspector.UIString('Protocol'), 695 title: WebInspector.UIString('Protocol'),
887 sortConfig: {sortingFunction: WebInspector.NetworkDataGridNode.RequestProper tyComparator.bind(null, 'protocol')} 696 sortingFunction: WebInspector.NetworkDataGridNode.RequestPropertyComparator. bind(null, 'protocol')
888 }, 697 },
889 { 698 {
890 id: 'scheme', 699 id: 'scheme',
891 title: WebInspector.UIString('Scheme'), 700 title: WebInspector.UIString('Scheme'),
892 sortConfig: {sortingFunction: WebInspector.NetworkDataGridNode.RequestProper tyComparator.bind(null, 'scheme')} 701 sortingFunction: WebInspector.NetworkDataGridNode.RequestPropertyComparator. bind(null, 'scheme')
893 }, 702 },
894 { 703 {
895 id: 'domain', 704 id: 'domain',
896 title: WebInspector.UIString('Domain'), 705 title: WebInspector.UIString('Domain'),
897 sortConfig: {sortingFunction: WebInspector.NetworkDataGridNode.RequestProper tyComparator.bind(null, 'domain')} 706 sortingFunction: WebInspector.NetworkDataGridNode.RequestPropertyComparator. bind(null, 'domain')
898 }, 707 },
899 { 708 {
900 id: 'remoteaddress', 709 id: 'remoteaddress',
901 title: WebInspector.UIString('Remote Address'), 710 title: WebInspector.UIString('Remote Address'),
902 weight: 10, 711 weight: 10,
903 align: WebInspector.DataGrid.Align.Right, 712 align: WebInspector.DataGrid.Align.Right,
904 sortConfig: {sortingFunction: WebInspector.NetworkDataGridNode.RemoteAddress Comparator} 713 sortingFunction: WebInspector.NetworkDataGridNode.RemoteAddressComparator
905 }, 714 },
906 { 715 {
907 id: 'type', 716 id: 'type',
908 title: WebInspector.UIString('Type'), 717 title: WebInspector.UIString('Type'),
909 visible: true, 718 visible: true,
910 sortConfig: {sortingFunction: WebInspector.NetworkDataGridNode.TypeComparato r} 719 sortingFunction: WebInspector.NetworkDataGridNode.TypeComparator
911 }, 720 },
912 { 721 {
913 id: 'initiator', 722 id: 'initiator',
914 title: WebInspector.UIString('Initiator'), 723 title: WebInspector.UIString('Initiator'),
915 visible: true, 724 visible: true,
916 weight: 10, 725 weight: 10,
917 sortConfig: {sortingFunction: WebInspector.NetworkDataGridNode.InitiatorComp arator} 726 sortingFunction: WebInspector.NetworkDataGridNode.InitiatorComparator
918 }, 727 },
919 { 728 {
920 id: 'cookies', 729 id: 'cookies',
921 title: WebInspector.UIString('Cookies'), 730 title: WebInspector.UIString('Cookies'),
922 align: WebInspector.DataGrid.Align.Right, 731 align: WebInspector.DataGrid.Align.Right,
923 sortConfig: {sortingFunction: WebInspector.NetworkDataGridNode.RequestCookie sCountComparator} 732 sortingFunction: WebInspector.NetworkDataGridNode.RequestCookiesCountCompara tor
924 }, 733 },
925 { 734 {
926 id: 'setcookies', 735 id: 'setcookies',
927 title: WebInspector.UIString('Set Cookies'), 736 title: WebInspector.UIString('Set Cookies'),
928 align: WebInspector.DataGrid.Align.Right, 737 align: WebInspector.DataGrid.Align.Right,
929 sortConfig: {sortingFunction: WebInspector.NetworkDataGridNode.ResponseCooki esCountComparator} 738 sortingFunction: WebInspector.NetworkDataGridNode.ResponseCookiesCountCompar ator
930 }, 739 },
931 { 740 {
932 id: 'size', 741 id: 'size',
933 title: WebInspector.UIString('Size'), 742 title: WebInspector.UIString('Size'),
934 visible: true, 743 visible: true,
935 subtitle: WebInspector.UIString('Content'), 744 subtitle: WebInspector.UIString('Content'),
936 align: WebInspector.DataGrid.Align.Right, 745 align: WebInspector.DataGrid.Align.Right,
937 sortConfig: {sortingFunction: WebInspector.NetworkDataGridNode.SizeComparato r} 746 sortingFunction: WebInspector.NetworkDataGridNode.SizeComparator
938 }, 747 },
939 { 748 {
940 id: 'time', 749 id: 'time',
941 title: WebInspector.UIString('Time'), 750 title: WebInspector.UIString('Time'),
942 visible: true, 751 visible: true,
943 subtitle: WebInspector.UIString('Latency'), 752 subtitle: WebInspector.UIString('Latency'),
944 align: WebInspector.DataGrid.Align.Right, 753 align: WebInspector.DataGrid.Align.Right,
945 sortConfig: {sortingFunction: WebInspector.NetworkDataGridNode.RequestProper tyComparator.bind(null, 'duration')} 754 sortingFunction: WebInspector.NetworkDataGridNode.RequestPropertyComparator. bind(null, 'duration')
946 }, 755 },
947 { 756 {
948 id: 'priority', 757 id: 'priority',
949 title: WebInspector.UIString('Priority'), 758 title: WebInspector.UIString('Priority'),
950 sortConfig: {sortingFunction: WebInspector.NetworkDataGridNode.InitialPriori tyComparator} 759 sortingFunction: WebInspector.NetworkDataGridNode.InitialPriorityComparator
951 }, 760 },
952 { 761 {
953 id: 'connectionid', 762 id: 'connectionid',
954 title: WebInspector.UIString('Connection ID'), 763 title: WebInspector.UIString('Connection ID'),
955 sortConfig: 764 sortingFunction: WebInspector.NetworkDataGridNode.RequestPropertyComparator. bind(null, 'connectionId')
956 {sortingFunction: WebInspector.NetworkDataGridNode.RequestPropertyCompar ator.bind(null, 'connectionId')}
957 }, 765 },
958 { 766 {
959 id: 'cache-control', 767 id: 'cache-control',
960 isResponseHeader: true, 768 isResponseHeader: true,
961 title: WebInspector.UIString('Cache-Control'), 769 title: WebInspector.UIString('Cache-Control'),
962 sortConfig: 770 sortingFunction: WebInspector.NetworkDataGridNode.ResponseHeaderStringCompar ator.bind(null, 'cache-control')
963 {sortingFunction: WebInspector.NetworkDataGridNode.ResponseHeaderStringC omparator.bind(null, 'cache-control')}
964 }, 771 },
965 { 772 {
966 id: 'connection', 773 id: 'connection',
967 isResponseHeader: true, 774 isResponseHeader: true,
968 title: WebInspector.UIString('Connection'), 775 title: WebInspector.UIString('Connection'),
969 sortConfig: 776 sortingFunction: WebInspector.NetworkDataGridNode.ResponseHeaderStringCompar ator.bind(null, 'connection')
970 {sortingFunction: WebInspector.NetworkDataGridNode.ResponseHeaderStringC omparator.bind(null, 'connection')}
971 }, 777 },
972 { 778 {
973 id: 'content-encoding', 779 id: 'content-encoding',
974 isResponseHeader: true, 780 isResponseHeader: true,
975 title: WebInspector.UIString('Content-Encoding'), 781 title: WebInspector.UIString('Content-Encoding'),
976 sortConfig: { 782 sortingFunction: WebInspector.NetworkDataGridNode.ResponseHeaderStringCompar ator.bind(null, 'content-encoding')
977 sortingFunction: WebInspector.NetworkDataGridNode.ResponseHeaderStringComp arator.bind(null, 'content-encoding')
978 }
979 }, 783 },
980 { 784 {
981 id: 'content-length', 785 id: 'content-length',
982 isResponseHeader: true, 786 isResponseHeader: true,
983 title: WebInspector.UIString('Content-Length'), 787 title: WebInspector.UIString('Content-Length'),
984 align: WebInspector.DataGrid.Align.Right, 788 align: WebInspector.DataGrid.Align.Right,
985 sortConfig: { 789 sortingFunction: WebInspector.NetworkDataGridNode.ResponseHeaderNumberCompar ator.bind(null, 'content-length')
986 sortingFunction: WebInspector.NetworkDataGridNode.ResponseHeaderNumberComp arator.bind(null, 'content-length')
987 }
988 }, 790 },
989 { 791 {
990 id: 'etag', 792 id: 'etag',
991 isResponseHeader: true, 793 isResponseHeader: true,
992 title: WebInspector.UIString('ETag'), 794 title: WebInspector.UIString('ETag'),
993 sortConfig: {sortingFunction: WebInspector.NetworkDataGridNode.ResponseHeade rStringComparator.bind(null, 'etag')} 795 sortingFunction: WebInspector.NetworkDataGridNode.ResponseHeaderStringCompar ator.bind(null, 'etag')
994 }, 796 },
995 { 797 {
996 id: 'keep-alive', 798 id: 'keep-alive',
997 isResponseHeader: true, 799 isResponseHeader: true,
998 title: WebInspector.UIString('Keep-Alive'), 800 title: WebInspector.UIString('Keep-Alive'),
999 sortConfig: 801 sortingFunction: WebInspector.NetworkDataGridNode.ResponseHeaderStringCompar ator.bind(null, 'keep-alive')
1000 {sortingFunction: WebInspector.NetworkDataGridNode.ResponseHeaderStringC omparator.bind(null, 'keep-alive')}
1001 }, 802 },
1002 { 803 {
1003 id: 'last-modified', 804 id: 'last-modified',
1004 isResponseHeader: true, 805 isResponseHeader: true,
1005 title: WebInspector.UIString('Last-Modified'), 806 title: WebInspector.UIString('Last-Modified'),
1006 sortConfig: 807 sortingFunction: WebInspector.NetworkDataGridNode.ResponseHeaderDateComparat or.bind(null, 'last-modified')
1007 {sortingFunction: WebInspector.NetworkDataGridNode.ResponseHeaderDateCom parator.bind(null, 'last-modified')}
1008 }, 808 },
1009 { 809 {
1010 id: 'server', 810 id: 'server',
1011 isResponseHeader: true, 811 isResponseHeader: true,
1012 title: WebInspector.UIString('Server'), 812 title: WebInspector.UIString('Server'),
1013 sortConfig: 813 sortingFunction: WebInspector.NetworkDataGridNode.ResponseHeaderStringCompar ator.bind(null, 'server')
1014 {sortingFunction: WebInspector.NetworkDataGridNode.ResponseHeaderStringC omparator.bind(null, 'server')}
1015 }, 814 },
1016 { 815 {
1017 id: 'vary', 816 id: 'vary',
1018 isResponseHeader: true, 817 isResponseHeader: true,
1019 title: WebInspector.UIString('Vary'), 818 title: WebInspector.UIString('Vary'),
1020 sortConfig: {sortingFunction: WebInspector.NetworkDataGridNode.ResponseHeade rStringComparator.bind(null, 'vary')} 819 sortingFunction: WebInspector.NetworkDataGridNode.ResponseHeaderStringCompar ator.bind(null, 'vary')
1021 }, 820 },
1022 { 821 // This header is a placeholder to let datagrid know that it can be sorted by this column, but never shown.
1023 id: 'timeline', 822 {id: 'timeline', title: '', visible: false, hideable: false}
1024 title: WebInspector.UIString('Waterfall'),
1025 visible: true,
1026 weight: 40,
1027 sortable: false,
1028 hideable: false,
1029 sortConfig: {
1030 entries: [
1031 {
1032 id: 'starttime',
1033 title: WebInspector.UIString('Waterfall \u2013 Start Time'),
1034 sort: WebInspector.DataGrid.Order.Ascending,
1035 sortingFunction: WebInspector.NetworkDataGridNode.RequestPropertyCompa rator.bind(null, 'startTime'),
1036 calculator: WebInspector.NetworkLogViewColumns._calculatorTypes.Time
1037 },
1038 {
1039 id: 'responsetime',
1040 title: WebInspector.UIString('Waterfall \u2013 Response Time'),
1041 sort: WebInspector.DataGrid.Order.Ascending,
1042 sortingFunction:
1043 WebInspector.NetworkDataGridNode.RequestPropertyComparator.bind(nu ll, 'responseReceivedTime'),
1044 calculator: WebInspector.NetworkLogViewColumns._calculatorTypes.Time
1045 },
1046 {
1047 id: 'endtime',
1048 title: WebInspector.UIString('Waterfall \u2013 End Time'),
1049 sort: WebInspector.DataGrid.Order.Ascending,
1050 sortingFunction: WebInspector.NetworkDataGridNode.RequestPropertyCompa rator.bind(null, 'endTime'),
1051 calculator: WebInspector.NetworkLogViewColumns._calculatorTypes.Time
1052 },
1053 {
1054 id: 'duration',
1055 title: WebInspector.UIString('Waterfall \u2013 Total Duration'),
1056 sort: WebInspector.DataGrid.Order.Descending,
1057 sortingFunction: WebInspector.NetworkDataGridNode.RequestPropertyCompa rator.bind(null, 'duration'),
1058 calculator: WebInspector.NetworkLogViewColumns._calculatorTypes.Durati on
1059 },
1060 {
1061 id: 'latency',
1062 title: WebInspector.UIString('Waterfall \u2013 Latency'),
1063 sort: WebInspector.DataGrid.Order.Descending,
1064 sortingFunction: WebInspector.NetworkDataGridNode.RequestPropertyCompa rator.bind(null, 'latency'),
1065 calculator: WebInspector.NetworkLogViewColumns._calculatorTypes.Durati on
1066 }
1067 ]
1068 }
1069 }
1070 ]; 823 ];
1071 824
1072 WebInspector.NetworkLogViewColumns._filmStripDividerColor = '#fccc49'; 825 WebInspector.NetworkLogViewColumns._filmStripDividerColor = '#fccc49';
1073 826
1074 /** 827 /**
1075 * @enum {string} 828 * @enum {string}
1076 */ 829 */
1077 WebInspector.NetworkLogViewColumns.TimelineSortIds = { 830 WebInspector.NetworkLogViewColumns.TimelineSortIds = {
1078 StartTime: 'startTime', 831 StartTime: 'startTime',
1079 ResponseTime: 'responseReceivedTime', 832 ResponseTime: 'responseReceivedTime',
1080 EndTime: 'endTime', 833 EndTime: 'endTime',
1081 Duration: 'duration', 834 Duration: 'duration',
1082 Latency: 'latency' 835 Latency: 'latency'
1083 }; 836 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698