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

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

Powered by Google App Engine
This is Rietveld 408576698