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

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

Issue 2450603005: [Devtools] Moved NetworkTimelineColumn to NetworkLogViewColumns P2 (Closed)
Patch Set: [Devtools] Moved NetworkTimelineColumn to NetworkLogViewColumns P2 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 /* 1 /*
2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2008, 2009 Anthony Ricaud <rik@webkit.org> 3 * Copyright (C) 2008, 2009 Anthony Ricaud <rik@webkit.org>
4 * Copyright (C) 2011 Google Inc. All rights reserved. 4 * Copyright (C) 2011 Google Inc. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 9 *
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 this.setMinimumSize(50, 64); 43 this.setMinimumSize(50, 64);
44 this.registerRequiredCSS("network/networkLogView.css"); 44 this.registerRequiredCSS("network/networkLogView.css");
45 45
46 this._networkHideDataURLSetting = WebInspector.settings.createSetting("netwo rkHideDataURL", false); 46 this._networkHideDataURLSetting = WebInspector.settings.createSetting("netwo rkHideDataURL", false);
47 this._networkResourceTypeFiltersSetting = WebInspector.settings.createSettin g("networkResourceTypeFilters", {}); 47 this._networkResourceTypeFiltersSetting = WebInspector.settings.createSettin g("networkResourceTypeFilters", {});
48 this._networkShowPrimaryLoadWaterfallSetting = WebInspector.settings.createS etting("networkShowPrimaryLoadWaterfall", false); 48 this._networkShowPrimaryLoadWaterfallSetting = WebInspector.settings.createS etting("networkShowPrimaryLoadWaterfall", false);
49 49
50 this._filterBar = filterBar; 50 this._filterBar = filterBar;
51 this._progressBarContainer = progressBarContainer; 51 this._progressBarContainer = progressBarContainer;
52 this._networkLogLargeRowsSetting = networkLogLargeRowsSetting; 52 this._networkLogLargeRowsSetting = networkLogLargeRowsSetting;
53 this._networkLogLargeRowsSetting.addChangeListener(updateRowHeight.bind(this ), this);
53 54
54 /** @type {!WebInspector.NetworkTransferTimeCalculator} */ 55 /** @type {!WebInspector.NetworkTransferTimeCalculator} */
55 this._timeCalculator = new WebInspector.NetworkTransferTimeCalculator(); 56 this._timeCalculator = new WebInspector.NetworkTransferTimeCalculator();
56 /** @type {!WebInspector.NetworkTransferDurationCalculator} */ 57 /** @type {!WebInspector.NetworkTransferDurationCalculator} */
57 this._durationCalculator = new WebInspector.NetworkTransferDurationCalculato r(); 58 this._durationCalculator = new WebInspector.NetworkTransferDurationCalculato r();
58 this._calculator = this._timeCalculator; 59 this._calculator = this._timeCalculator;
60
61 /**
62 * @this {WebInspector.NetworkLogView}
63 */
64 function updateRowHeight()
65 {
66 /** @type {number} */
67 this._rowHeight = !!this._networkLogLargeRowsSetting.get() ? 41 : 21;
68 }
69 updateRowHeight.call(this);
70
59 this._columns = new WebInspector.NetworkLogViewColumns(this, this._timeCalcu lator, this._durationCalculator, networkLogLargeRowsSetting); 71 this._columns = new WebInspector.NetworkLogViewColumns(this, this._timeCalcu lator, this._durationCalculator, networkLogLargeRowsSetting);
60 72
61 /** @type {!Map.<string, !WebInspector.NetworkDataGridNode>} */ 73 /** @type {!Map.<string, !WebInspector.NetworkDataGridNode>} */
62 this._nodesByRequestId = new Map(); 74 this._nodesByRequestId = new Map();
63 /** @type {!Object.<string, boolean>} */ 75 /** @type {!Object.<string, boolean>} */
64 this._staleRequestIds = {}; 76 this._staleRequestIds = {};
65 /** @type {number} */ 77 /** @type {number} */
66 this._mainRequestLoadTime = -1; 78 this._mainRequestLoadTime = -1;
67 /** @type {number} */ 79 /** @type {number} */
68 this._mainRequestDOMContentLoadedTime = -1; 80 this._mainRequestDOMContentLoadedTime = -1;
69 this._matchedRequestCount = 0; 81 this._matchedRequestCount = 0;
70 this._highlightedSubstringChanges = []; 82 this._highlightedSubstringChanges = [];
71 83
72 /** @type {!Array.<!WebInspector.NetworkLogView.Filter>} */ 84 /** @type {!Array.<!WebInspector.NetworkLogView.Filter>} */
73 this._filters = []; 85 this._filters = [];
74 /** @type {?WebInspector.NetworkLogView.Filter} */ 86 /** @type {?WebInspector.NetworkLogView.Filter} */
75 this._timeFilter = null; 87 this._timeFilter = null;
76 88
77 this._currentMatchedRequestNode = null; 89 this._currentMatchedRequestNode = null;
78 this._currentMatchedRequestIndex = -1; 90 this._currentMatchedRequestIndex = -1;
79 91
80 /** @type {!WebInspector.Linkifier} */ 92 /** @type {!WebInspector.Linkifier} */
81 this.linkifier = new WebInspector.Linkifier(); 93 this.linkifier = new WebInspector.Linkifier();
82 94
83 this._recording = false; 95 this._recording = false;
84 this._preserveLog = false; 96 this._preserveLog = false;
85 97
86 /** @type {number} */
87 this._rowHeight = 0;
88
89 this._headerHeight = 0; 98 this._headerHeight = 0;
90 this._timelineHeaderElement = null;
91 this._timelineRequestsAreStale = false;
92 99
93 this._addFilters(); 100 this._addFilters();
94 this._resetSuggestionBuilder(); 101 this._resetSuggestionBuilder();
95 this._initializeView(); 102 this._initializeView();
96 103
97 WebInspector.moduleSetting("networkColorCodeResourceTypes").addChangeListene r(this._invalidateAllItems, this); 104 WebInspector.moduleSetting("networkColorCodeResourceTypes").addChangeListene r(this._invalidateAllItems, this);
98 this._networkLogLargeRowsSetting.addChangeListener(this._updateRowsSize, thi s);
99 105
100 WebInspector.targetManager.observeTargets(this); 106 WebInspector.targetManager.observeTargets(this);
101 WebInspector.targetManager.addModelListener(WebInspector.NetworkManager, Web Inspector.NetworkManager.Events.RequestStarted, this._onRequestStarted, this); 107 WebInspector.targetManager.addModelListener(WebInspector.NetworkManager, Web Inspector.NetworkManager.Events.RequestStarted, this._onRequestStarted, this);
102 WebInspector.targetManager.addModelListener(WebInspector.NetworkManager, Web Inspector.NetworkManager.Events.RequestUpdated, this._onRequestUpdated, this); 108 WebInspector.targetManager.addModelListener(WebInspector.NetworkManager, Web Inspector.NetworkManager.Events.RequestUpdated, this._onRequestUpdated, this);
103 WebInspector.targetManager.addModelListener(WebInspector.NetworkManager, Web Inspector.NetworkManager.Events.RequestFinished, this._onRequestUpdated, this); 109 WebInspector.targetManager.addModelListener(WebInspector.NetworkManager, Web Inspector.NetworkManager.Events.RequestFinished, this._onRequestUpdated, this);
104 }; 110 };
105 111
106 WebInspector.NetworkLogView._isFilteredOutSymbol = Symbol("isFilteredOut"); 112 WebInspector.NetworkLogView._isFilteredOutSymbol = Symbol("isFilteredOut");
107 WebInspector.NetworkLogView._isMatchingSearchQuerySymbol = Symbol("isMatchingSea rchQuery"); 113 WebInspector.NetworkLogView._isMatchingSearchQuerySymbol = Symbol("isMatchingSea rchQuery");
108 114
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 { 279 {
274 this.removeAllNodeHighlights(); 280 this.removeAllNodeHighlights();
275 this._parseFilterQuery(this._textFilterUI.value()); 281 this._parseFilterQuery(this._textFilterUI.value());
276 this._filterRequests(); 282 this._filterRequests();
277 }, 283 },
278 284
279 _initializeView: function() 285 _initializeView: function()
280 { 286 {
281 this.element.id = "network-container"; 287 this.element.id = "network-container";
282 this._setupDataGrid(); 288 this._setupDataGrid();
283 if (Runtime.experiments.isEnabled("canvasNetworkTimeline")) {
284 var dataGridScroller = this._dataGrid.scrollContainer;
285 this._timelineColumn = new WebInspector.NetworkTimelineColumn(this._ rowHeight, this._headerHeight, this._calculator, dataGridScroller);
286 this._dataGrid.setScrollContainer(this._timelineColumn.getScrollCont ainer());
287 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.Padding Changed, () => this._timelineColumn.setScrollHeight(dataGridScroller.scrollHeigh t));
288 this._dataGrid.addEventListener(WebInspector.ViewportDataGrid.Events .ViewportCalculated, this._redrawTimelineColumn.bind(this));
289 289
290 this._timelineColumn.addEventListener(WebInspector.NetworkTimelineCo lumn.Events.RequestHovered, requestHovered.bind(this)); 290 this._columns.show(this.element);
291 291
292 // TODO(allada) This code needs to be moved into NetworkLogViewColum ns.
293 this._createTimelineHeader();
294 this._timelineColumn.contentElement.classList.add("network-timeline- view");
295
296 this._splitWidget = this._columns.splitWidget();
297 this._splitWidget.setMainWidget(this._timelineColumn);
298
299 this._columns.show(this.element);
300 this.switchViewMode(false);
301 } else {
302 this._columns.show(this.element);
303 }
304 this._summaryBarElement = this.element.createChild("div", "network-summa ry-bar"); 292 this._summaryBarElement = this.element.createChild("div", "network-summa ry-bar");
305 293
306 this._columns.sortByCurrentColumn(); 294 this._columns.sortByCurrentColumn();
307 this._updateRowsSize();
308
309 /**
310 * @param {!WebInspector.Event} event
311 * @this {WebInspector.NetworkLogView}
312 */
313 function requestHovered(event)
314 {
315 var request = /** @type {?WebInspector.NetworkRequest} */ (event.dat a);
316 var node = request ? this._nodesByRequestId.get(request.requestId) : null;
317 this._setHoveredNode(node || null);
318 }
319 },
320
321 _redrawTimelineColumn: function()
322 {
323 if (!this._timelineRequestsAreStale) {
324 this._timelineColumn.update();
325 return;
326 }
327 var currentNode = this._dataGrid.rootNode();
328 var requestData = {
329 requests: [],
330 navigationRequest: null
331 };
332 while (currentNode = currentNode.traverseNextNode(true)) {
333 if (currentNode.isNavigationRequest())
334 requestData.navigationRequest = currentNode.request();
335 requestData.requests.push(currentNode.request());
336 }
337 this._timelineColumn.update(requestData);
338 }, 295 },
339 296
340 _showRecordingHint: function() 297 _showRecordingHint: function()
341 { 298 {
342 this._hideRecordingHint(); 299 this._hideRecordingHint();
343 this._recordingHint = this.element.createChild("div", "network-status-pa ne fill"); 300 this._recordingHint = this.element.createChild("div", "network-status-pa ne fill");
344 var hintText = this._recordingHint.createChild("div", "recording-hint"); 301 var hintText = this._recordingHint.createChild("div", "recording-hint");
345 var reloadShortcutNode = this._recordingHint.createChild("b"); 302 var reloadShortcutNode = this._recordingHint.createChild("b");
346 reloadShortcutNode.textContent = WebInspector.shortcutRegistry.shortcutD escriptorsForAction("main.reload")[0].name; 303 reloadShortcutNode.textContent = WebInspector.shortcutRegistry.shortcutD escriptorsForAction("main.reload")[0].name;
347 304
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 this._highlightInitiatorChain((event.shiftKey && node) ? node.request() : null); 355 this._highlightInitiatorChain((event.shiftKey && node) ? node.request() : null);
399 }, 356 },
400 357
401 _dataGridMouseLeave: function() 358 _dataGridMouseLeave: function()
402 { 359 {
403 this._setHoveredNode(null); 360 this._setHoveredNode(null);
404 this._highlightInitiatorChain(null); 361 this._highlightInitiatorChain(null);
405 }, 362 },
406 363
407 /** 364 /**
365 * @param {?WebInspector.NetworkRequest} request
366 */
367 setHoveredRequest: function(request)
368 {
369 this._setHoveredNode(request ? this._nodesByRequestId.get(request.reques tId) : null);
370 },
371
372 /**
408 * @param {?WebInspector.NetworkDataGridNode} node 373 * @param {?WebInspector.NetworkDataGridNode} node
409 */ 374 */
410 _setHoveredNode: function(node) 375 _setHoveredNode: function(node)
411 { 376 {
412 if (this._hoveredNode) 377 if (this._hoveredNode)
413 this._hoveredNode.element().classList.remove("hover"); 378 this._hoveredNode.element().classList.remove("hover");
414 this._hoveredNode = node; 379 this._hoveredNode = node;
415 if (this._hoveredNode) 380 if (this._hoveredNode)
416 this._hoveredNode.element().classList.add("hover"); 381 this._hoveredNode.element().classList.add("hover");
417 if (Runtime.experiments.isEnabled("canvasNetworkTimeline")) 382 this._columns.setHoveredRequest(this._hoveredNode ? this._hoveredNode.re quest() : null);
418 this._timelineColumn.setHoveredRequest(this._hoveredNode ? this._hov eredNode.request() : null);
419 }, 383 },
420 384
421 /** 385 /**
422 * @param {!Event} event 386 * @param {!Event} event
423 */ 387 */
424 _dataGridMouseDown: function(event) 388 _dataGridMouseDown: function(event)
425 { 389 {
426 if ((!this._dataGrid.selectedNode && event.button) || event.target.enclo singNodeOrSelfWithNodeName("a")) 390 if ((!this._dataGrid.selectedNode && event.button) || event.target.enclo singNodeOrSelfWithNodeName("a"))
427 event.consume(); 391 event.consume();
428 }, 392 },
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 }, 500 },
537 501
538 scheduleRefresh: function() 502 scheduleRefresh: function()
539 { 503 {
540 if (this._needsRefresh) 504 if (this._needsRefresh)
541 return; 505 return;
542 506
543 this._needsRefresh = true; 507 this._needsRefresh = true;
544 508
545 if (this.isShowing() && !this._refreshRequestId) 509 if (this.isShowing() && !this._refreshRequestId)
546 this._refreshRequestId = this.element.window().requestAnimationFrame (this.refresh.bind(this)); 510 this._refreshRequestId = this.element.window().requestAnimationFrame (this._refresh.bind(this));
547 }, 511 },
548 512
549 /** 513 /**
550 * @param {!Array<number>} times 514 * @param {!Array<number>} times
551 */ 515 */
552 addFilmStripFrames: function(times) 516 addFilmStripFrames: function(times)
553 { 517 {
554 this._columns.addEventDividers(times, "network-frame-divider"); 518 this._columns.addEventDividers(times, "network-frame-divider");
555 }, 519 },
556 520
557 /** 521 /**
558 * @param {number} time 522 * @param {number} time
559 */ 523 */
560 selectFilmStripFrame: function(time) 524 selectFilmStripFrame: function(time)
561 { 525 {
562 this._columns.selectFilmStripFrame(time); 526 this._columns.selectFilmStripFrame(time);
563 }, 527 },
564 528
565 clearFilmStripFrame: function() 529 clearFilmStripFrame: function()
566 { 530 {
567 this._columns.clearFilmStripFrame(); 531 this._columns.clearFilmStripFrame();
568 }, 532 },
569 533
570 _refreshIfNeeded: function() 534 _refreshIfNeeded: function()
571 { 535 {
572 if (this._needsRefresh) 536 if (this._needsRefresh)
573 this.refresh(); 537 this._refresh();
574 }, 538 },
575 539
576 _invalidateAllItems: function() 540 _invalidateAllItems: function()
577 { 541 {
578 var requestIds = this._nodesByRequestId.keysArray(); 542 var requestIds = this._nodesByRequestId.keysArray();
579 for (var i = 0; i < requestIds.length; ++i) 543 for (var i = 0; i < requestIds.length; ++i)
580 this._staleRequestIds[requestIds[i]] = true; 544 this._staleRequestIds[requestIds[i]] = true;
581 this.refresh(); 545 this._refresh();
582 }, 546 },
583 547
584 /** 548 /**
585 * @return {!WebInspector.NetworkTimeCalculator} 549 * @return {!WebInspector.NetworkTimeCalculator}
586 */ 550 */
587 timeCalculator: function() 551 timeCalculator: function()
588 { 552 {
589 return this._timeCalculator; 553 return this._timeCalculator;
590 }, 554 },
591 555
592 /** 556 /**
593 * @return {!WebInspector.NetworkTimeCalculator} 557 * @return {!WebInspector.NetworkTimeCalculator}
594 */ 558 */
595 calculator: function() 559 calculator: function()
596 { 560 {
597 return this._calculator; 561 return this._calculator;
598 }, 562 },
599 563
600 /** 564 /**
601 * @param {!WebInspector.NetworkTimeCalculator} x 565 * @param {!WebInspector.NetworkTimeCalculator} x
602 */ 566 */
603 setCalculator: function(x) 567 setCalculator: function(x)
604 { 568 {
605 if (!x || this._calculator === x) 569 if (!x || this._calculator === x)
606 return; 570 return;
607 571
608 if (this._calculator !== x) { 572 if (this._calculator !== x) {
609 this._calculator = x; 573 this._calculator = x;
610 if (Runtime.experiments.isEnabled("canvasNetworkTimeline")) 574 this._columns.setCalculator(this._calculator);
611 this._timelineColumn.setCalculator(this._calculator);
612 } 575 }
613 this._calculator.reset(); 576 this._calculator.reset();
614 577
615 if (this._calculator.startAtZero) 578 if (this._calculator.startAtZero)
616 this._columns.hideEventDividers(); 579 this._columns.hideEventDividers();
617 else 580 else
618 this._columns.showEventDividers(); 581 this._columns.showEventDividers();
619 582
620 this._invalidateAllItems(); 583 this._invalidateAllItems();
621 }, 584 },
(...skipping 30 matching lines...) Expand all
652 wasShown: function() 615 wasShown: function()
653 { 616 {
654 this._refreshIfNeeded(); 617 this._refreshIfNeeded();
655 }, 618 },
656 619
657 willHide: function() 620 willHide: function()
658 { 621 {
659 this._columns.willHide(); 622 this._columns.willHide();
660 }, 623 },
661 624
662 refresh: function() 625 _refresh: function()
663 { 626 {
664 this._needsRefresh = false; 627 this._needsRefresh = false;
665 628
666 if (this._refreshRequestId) { 629 if (this._refreshRequestId) {
667 this.element.window().cancelAnimationFrame(this._refreshRequestId); 630 this.element.window().cancelAnimationFrame(this._refreshRequestId);
668 delete this._refreshRequestId; 631 delete this._refreshRequestId;
669 } 632 }
670 633
671 this.removeAllNodeHighlights(); 634 this.removeAllNodeHighlights();
672 635
673 var oldBoundary = this.calculator().boundary(); 636 var oldBoundary = this.calculator().boundary();
674 this._timeCalculator.updateBoundariesForEventTime(this._mainRequestLoadT ime); 637 this._timeCalculator.updateBoundariesForEventTime(this._mainRequestLoadT ime);
675 this._durationCalculator.updateBoundariesForEventTime(this._mainRequestL oadTime); 638 this._durationCalculator.updateBoundariesForEventTime(this._mainRequestL oadTime);
676 this._timeCalculator.updateBoundariesForEventTime(this._mainRequestDOMCo ntentLoadedTime); 639 this._timeCalculator.updateBoundariesForEventTime(this._mainRequestDOMCo ntentLoadedTime);
677 this._durationCalculator.updateBoundariesForEventTime(this._mainRequestD OMContentLoadedTime); 640 this._durationCalculator.updateBoundariesForEventTime(this._mainRequestD OMContentLoadedTime);
678 641
679 var dataGrid = this._dataGrid; 642 var dataGrid = this._dataGrid;
680 var rootNode = dataGrid.rootNode(); 643 var rootNode = dataGrid.rootNode();
681 /** @type {!Array<!WebInspector.NetworkDataGridNode> } */ 644 /** @type {!Array<!WebInspector.NetworkDataGridNode> } */
682 var nodesToInsert = []; 645 var nodesToInsert = [];
683 /** @type {!Array<!WebInspector.NetworkDataGridNode> } */ 646 /** @type {!Array<!WebInspector.NetworkDataGridNode> } */
684 var nodesToRefresh = []; 647 var nodesToRefresh = [];
685 for (var requestId in this._staleRequestIds) { 648 for (var requestId in this._staleRequestIds) {
686 var node = this._nodesByRequestId.get(requestId); 649 var node = this._nodesByRequestId.get(requestId);
687 if (!node) 650 if (!node)
688 continue; 651 continue;
689 var isFilteredOut = !this._applyFilter(node); 652 var isFilteredOut = !this._applyFilter(node);
690 if (isFilteredOut && node === this._hoveredNode) 653 if (isFilteredOut && node === this._hoveredNode)
691 this._hoveredNode = null; 654 this._setHoveredNode(null);
692 if (node[WebInspector.NetworkLogView._isFilteredOutSymbol] !== isFil teredOut) { 655 if (node[WebInspector.NetworkLogView._isFilteredOutSymbol] !== isFil teredOut) {
693 if (!node[WebInspector.NetworkLogView._isFilteredOutSymbol]) 656 if (!node[WebInspector.NetworkLogView._isFilteredOutSymbol])
694 rootNode.removeChild(node); 657 rootNode.removeChild(node);
695 658
696 node[WebInspector.NetworkLogView._isFilteredOutSymbol] = isFilte redOut; 659 node[WebInspector.NetworkLogView._isFilteredOutSymbol] = isFilte redOut;
697 660
698 if (!node[WebInspector.NetworkLogView._isFilteredOutSymbol]) 661 if (!node[WebInspector.NetworkLogView._isFilteredOutSymbol])
699 nodesToInsert.push(node); 662 nodesToInsert.push(node);
700 } 663 }
701 if (!isFilteredOut) 664 if (!isFilteredOut)
(...skipping 19 matching lines...) Expand all
721 // The boundaries changed, so all item graphs are stale. 684 // The boundaries changed, so all item graphs are stale.
722 this._columns.updateDividersIfNeeded(); 685 this._columns.updateDividersIfNeeded();
723 var nodes = this._nodesByRequestId.valuesArray(); 686 var nodes = this._nodesByRequestId.valuesArray();
724 for (var i = 0; i < nodes.length; ++i) 687 for (var i = 0; i < nodes.length; ++i)
725 nodes[i].refreshGraph(); 688 nodes[i].refreshGraph();
726 } 689 }
727 690
728 this._staleRequestIds = {}; 691 this._staleRequestIds = {};
729 this._updateSummaryBar(); 692 this._updateSummaryBar();
730 693
731 if (Runtime.experiments.isEnabled("canvasNetworkTimeline")) 694 this._columns.dataChanged();
732 this._timelineRequestsAreStale = true;
733 }, 695 },
734 696
735 reset: function() 697 reset: function()
736 { 698 {
737 this._requestWithHighlightedInitiators = null; 699 this._requestWithHighlightedInitiators = null;
738 this.dispatchEventToListeners(WebInspector.NetworkLogView.Events.Request Selected, null); 700 this.dispatchEventToListeners(WebInspector.NetworkLogView.Events.Request Selected, null);
739 701
740 this._clearSearchMatchedList(); 702 this._clearSearchMatchedList();
741 703
704 this._setHoveredNode(null);
742 this._columns.reset(); 705 this._columns.reset();
743 706
744 this._hoveredNode = null;
745
746 this._timeFilter = null; 707 this._timeFilter = null;
747 this._calculator.reset(); 708 this._calculator.reset();
748 709
749 this._timeCalculator.setWindow(null); 710 this._timeCalculator.setWindow(null);
750 711
751 var nodes = this._nodesByRequestId.valuesArray(); 712 var nodes = this._nodesByRequestId.valuesArray();
752 for (var i = 0; i < nodes.length; ++i) 713 for (var i = 0; i < nodes.length; ++i)
753 nodes[i].dispose(); 714 nodes[i].dispose();
754 715
755 this._nodesByRequestId.clear(); 716 this._nodesByRequestId.clear();
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
893 for (var i = 0; i < requestsToPick.length; ++i) { 854 for (var i = 0; i < requestsToPick.length; ++i) {
894 var request = requestsToPick[i]; 855 var request = requestsToPick[i];
895 var node = this._nodesByRequestId.get(request.requestId); 856 var node = this._nodesByRequestId.get(request.requestId);
896 if (node) { 857 if (node) {
897 node.markAsNavigationRequest(); 858 node.markAsNavigationRequest();
898 break; 859 break;
899 } 860 }
900 } 861 }
901 }, 862 },
902 863
903 _createTimelineHeader: function()
904 {
905 this._timelineHeaderElement = this._timelineColumn.contentElement.create Child("div", "network-timeline-header");
906 this._timelineHeaderElement.addEventListener("click", timelineHeaderClic ked.bind(this));
907 this._timelineHeaderElement.addEventListener("contextmenu", this._column s.headerContextMenuEvent.bind(this._columns));
908 var innerElement = this._timelineHeaderElement.createChild("div");
909 innerElement.textContent = WebInspector.UIString("Timeline");
910 this._timelineColumnSortIcon = this._timelineHeaderElement.createChild(" div", "sort-order-icon-container").createChild("div", "sort-order-icon");
911
912 /**
913 * @this {WebInspector.NetworkLogView}
914 */
915 function timelineHeaderClicked()
916 {
917 var sortOrders = WebInspector.DataGrid.Order;
918 var sortOrder = this._dataGrid.sortOrder() === sortOrders.Ascending ? sortOrders.Descending : sortOrders.Ascending;
919 this._dataGrid.markColumnAsSortedBy("timeline", sortOrder);
920 this._columns.sortByCurrentColumn();
921 }
922 },
923
924 /**
925 * @param {boolean} gridMode
926 */
927 switchViewMode: function(gridMode)
928 {
929 this._columns.switchViewMode(gridMode);
930 },
931
932 /** 864 /**
933 * @return {number} 865 * @return {number}
934 */ 866 */
935 rowHeight: function() 867 rowHeight: function()
936 { 868 {
937 return this._rowHeight; 869 return this._rowHeight;
938 }, 870 },
939 871
940 _updateRowsSize: function() 872 /**
873 * @param {boolean} gridMode
874 */
875 switchViewMode: function(gridMode)
941 { 876 {
942 var largeRows = !!this._networkLogLargeRowsSetting.get(); 877 this._columns.switchViewMode(gridMode);
943 // TODO(allada) Make these non-magic numbers.
944 var rowHeight = largeRows ? 41 : 21;
945 var headerHeight = largeRows ? 31 : 27;
946 if (this._rowHeight !== rowHeight) {
947 this._rowHeight = rowHeight;
948 if (Runtime.experiments.isEnabled("canvasNetworkTimeline"))
949 this._timelineColumn.setRowHeight(this._rowHeight);
950 }
951 if (this._headerHeight !== headerHeight) {
952 this._headerHeight = headerHeight;
953 if (Runtime.experiments.isEnabled("canvasNetworkTimeline"))
954 this._timelineColumn.setHeaderHeight(this._headerHeight);
955 }
956
957 this._dataGrid.element.classList.toggle("small", !largeRows);
958 if (Runtime.experiments.isEnabled("canvasNetworkTimeline"))
959 this._timelineHeaderElement.classList.toggle("small", !largeRows);
960 this._dataGrid.scheduleUpdate();
961 }, 878 },
962 879
963 /** 880 /**
964 * @param {!WebInspector.ContextMenu} contextMenu 881 * @param {!WebInspector.ContextMenu} contextMenu
965 * @param {!WebInspector.DataGridNode} node 882 * @param {!WebInspector.DataGridNode} node
966 */ 883 */
967 _onRowContextMenu: function(contextMenu, node) 884 _onRowContextMenu: function(contextMenu, node)
968 { 885 {
969 var request = node.request(); 886 var request = node.request();
970 887
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
1164 { 1081 {
1165 this.removeAllNodeHighlights(); 1082 this.removeAllNodeHighlights();
1166 for (var i = 0; i < this._highlightedSubstringChanges.length; ++i) 1083 for (var i = 0; i < this._highlightedSubstringChanges.length; ++i)
1167 WebInspector.revertDomChanges(this._highlightedSubstringChanges[i]); 1084 WebInspector.revertDomChanges(this._highlightedSubstringChanges[i]);
1168 this._highlightedSubstringChanges = []; 1085 this._highlightedSubstringChanges = [];
1169 }, 1086 },
1170 1087
1171 dataGridSorted: function() 1088 dataGridSorted: function()
1172 { 1089 {
1173 this._highlightNthMatchedRequestForSearch(this._updateMatchCountAndFindM atchIndex(this._currentMatchedRequestNode), false); 1090 this._highlightNthMatchedRequestForSearch(this._updateMatchCountAndFindM atchIndex(this._currentMatchedRequestNode), false);
1174
1175 if (!Runtime.experiments.isEnabled("canvasNetworkTimeline"))
1176 return;
1177
1178 this._timelineColumnSortIcon.classList.remove("sort-ascending", "sort-de scending");
1179
1180 if (this._dataGrid.sortColumnId() === "timeline") {
1181 if (this._dataGrid.sortOrder() === WebInspector.DataGrid.Order.Ascen ding)
1182 this._timelineColumnSortIcon.classList.add("sort-ascending");
1183 else
1184 this._timelineColumnSortIcon.classList.add("sort-descending");
1185 }
1186
1187 this._timelineRequestsAreStale = true;
1188 }, 1091 },
1189 1092
1190 /** 1093 /**
1191 * @param {number} n 1094 * @param {number} n
1192 * @param {boolean} reveal 1095 * @param {boolean} reveal
1193 */ 1096 */
1194 _highlightNthMatchedRequestForSearch: function(n, reveal) 1097 _highlightNthMatchedRequestForSearch: function(n, reveal)
1195 { 1098 {
1196 this._removeAllHighlights(); 1099 this._removeAllHighlights();
1197 1100
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after
1866 * @return {boolean} 1769 * @return {boolean}
1867 */ 1770 */
1868 WebInspector.NetworkLogView._requestTimeFilter = function(windowStart, windowEnd , request) 1771 WebInspector.NetworkLogView._requestTimeFilter = function(windowStart, windowEnd , request)
1869 { 1772 {
1870 if (request.issueTime() > windowEnd) 1773 if (request.issueTime() > windowEnd)
1871 return false; 1774 return false;
1872 if (request.endTime !== -1 && request.endTime < windowStart) 1775 if (request.endTime !== -1 && request.endTime < windowStart)
1873 return false; 1776 return false;
1874 return true; 1777 return true;
1875 }; 1778 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698