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

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

Issue 1048823002: [DevTools] Simplify getting back to default network order. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 this._popupLinkifier = new WebInspector.Linkifier(); 83 this._popupLinkifier = new WebInspector.Linkifier();
84 /** @type {!WebInspector.Linkifier} */ 84 /** @type {!WebInspector.Linkifier} */
85 this.linkifier = new WebInspector.Linkifier(); 85 this.linkifier = new WebInspector.Linkifier();
86 86
87 this._gridMode = true; 87 this._gridMode = true;
88 this._recording = false; 88 this._recording = false;
89 this._preserveLog = false; 89 this._preserveLog = false;
90 90
91 /** @type {number} */ 91 /** @type {number} */
92 this._rowHeight = 0; 92 this._rowHeight = 0;
93 /** @type {!WebInspector.NetworkTimeCalculator} */
94 this._calculator = new WebInspector.NetworkTimeCalculator();
93 95
94 this._addFilters(); 96 this._addFilters();
95 this._resetSuggestionBuilder(); 97 this._resetSuggestionBuilder();
96 this._initializeView(); 98 this._initializeView();
97 99
98 this._overview.addEventListener(WebInspector.NetworkOverview.Events.WindowCh anged, this._onWindowChanged, this); 100 this._overview.addEventListener(WebInspector.NetworkOverview.Events.WindowCh anged, this._onWindowChanged, this);
99 101
100 WebInspector.settings.networkColorCodeResourceTypes.addChangeListener(this._ invalidateAllItems, this); 102 WebInspector.settings.networkColorCodeResourceTypes.addChangeListener(this._ invalidateAllItems, this);
101 WebInspector.settings.networkLogLargeRows.addChangeListener(this._updateRows Size, this); 103 WebInspector.settings.networkLogLargeRows.addChangeListener(this._updateRows Size, this);
102 104
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 233
232 /** 234 /**
233 * @param {!WebInspector.Event} event 235 * @param {!WebInspector.Event} event
234 */ 236 */
235 _onWindowChanged: function(event) 237 _onWindowChanged: function(event)
236 { 238 {
237 var start = /** @type {number} */ (event.data.start); 239 var start = /** @type {number} */ (event.data.start);
238 var end = /** @type {number} */ (event.data.end); 240 var end = /** @type {number} */ (event.data.end);
239 if (!start && !end) { 241 if (!start && !end) {
240 this._timeFilter = null; 242 this._timeFilter = null;
241 this._timeCalculator.setWindow(null); 243 this._calculator.setWindow(null);
242 } else { 244 } else {
243 this._timeFilter = WebInspector.NetworkLogView._requestTimeFilter.bi nd(null, start, end); 245 this._timeFilter = WebInspector.NetworkLogView._requestTimeFilter.bi nd(null, start, end);
244 this._timeCalculator.setWindow(new WebInspector.NetworkTimeBoundary( start, end)); 246 this._calculator.setWindow(new WebInspector.NetworkTimeBoundary(star t, end));
245 } 247 }
246 this._updateDividersIfNeeded(); 248 this._updateDividersIfNeeded();
247 this._filterRequests(); 249 this._filterRequests();
248 }, 250 },
249 251
250 clearSelection: function() 252 clearSelection: function()
251 { 253 {
252 if (this._dataGrid.selectedNode) 254 if (this._dataGrid.selectedNode)
253 this._dataGrid.selectedNode.deselect(); 255 this._dataGrid.selectedNode.deselect();
254 }, 256 },
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 this._removeAllNodeHighlights(); 296 this._removeAllNodeHighlights();
295 this._parseFilterQuery(this._textFilterUI.value()); 297 this._parseFilterQuery(this._textFilterUI.value());
296 this._filterRequests(); 298 this._filterRequests();
297 }, 299 },
298 300
299 _initializeView: function() 301 _initializeView: function()
300 { 302 {
301 this.element.id = "network-container"; 303 this.element.id = "network-container";
302 304
303 this._createSortingFunctions(); 305 this._createSortingFunctions();
304 this._createCalculators();
305 this._createTable(); 306 this._createTable();
306 this._createTimelineGrid(); 307 this._createTimelineGrid();
307 this._summaryBarElement = this.element.createChild("div", "network-summa ry-bar"); 308 this._summaryBarElement = this.element.createChild("div", "network-summa ry-bar");
308 309
309 this._updateRowsSize(); 310 this._updateRowsSize();
310 311
311 this._popoverHelper = new WebInspector.PopoverHelper(this.element, this. _getPopoverAnchor.bind(this), this._showPopover.bind(this), this._onHidePopover. bind(this)); 312 this._popoverHelper = new WebInspector.PopoverHelper(this.element, this. _getPopoverAnchor.bind(this), this._showPopover.bind(this), this._onHidePopover. bind(this));
312 // Enable faster hint. 313 // Enable faster hint.
313 this._popoverHelper.setTimeout(250, 250); 314 this._popoverHelper.setTimeout(250, 250);
314 315
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 weight: 6 459 weight: 6
459 }; 460 };
460 if (headerName === "Content-Length") 461 if (headerName === "Content-Length")
461 descriptor.align = WebInspector.DataGrid.Align.Right; 462 descriptor.align = WebInspector.DataGrid.Align.Right;
462 columns.push(descriptor); 463 columns.push(descriptor);
463 } 464 }
464 465
465 columns.push({ 466 columns.push({
466 id: "timeline", 467 id: "timeline",
467 title: WebInspector.NetworkLogView._columnTitles["timeline"], 468 title: WebInspector.NetworkLogView._columnTitles["timeline"],
468 sortable: false, 469 sortable: true,
469 weight: 40, 470 weight: 40,
470 sort: WebInspector.DataGrid.Order.Ascending 471 sort: WebInspector.DataGrid.Order.Ascending
471 }); 472 });
472 473
473 this._dataGrid = new WebInspector.SortableDataGrid(columns); 474 this._dataGrid = new WebInspector.SortableDataGrid(columns);
474 this._dataGrid.setStickToBottom(true); 475 this._dataGrid.setStickToBottom(true);
475 this._updateColumns(); 476 this._updateColumns();
476 this._dataGrid.setName("networkLog"); 477 this._dataGrid.setName("networkLog");
477 this._dataGrid.setResizeMethod(WebInspector.DataGrid.ResizeMethod.Last); 478 this._dataGrid.setResizeMethod(WebInspector.DataGrid.ResizeMethod.Last);
478 this._dataGrid.element.classList.add("network-log-grid"); 479 this._dataGrid.element.classList.add("network-log-grid");
479 this._dataGrid.element.addEventListener("contextmenu", this._contextMenu .bind(this), true); 480 this._dataGrid.element.addEventListener("contextmenu", this._contextMenu .bind(this), true);
480 this._dataGrid.element.addEventListener("mousedown", this._dataGridMouse Down.bind(this), true); 481 this._dataGrid.element.addEventListener("mousedown", this._dataGridMouse Down.bind(this), true);
481 this._dataGrid.element.addEventListener("mousemove", this._mouseMove.bin d(this), true); 482 this._dataGrid.element.addEventListener("mousemove", this._mouseMove.bin d(this), true);
482 this._dataGrid.show(this.element); 483 this._dataGrid.show(this.element);
483 484
484 // Event listeners need to be added _after_ we attach to the document, s o that owner document is properly update. 485 // Event listeners need to be added _after_ we attach to the document, s o that owner document is properly update.
485 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.SortingChan ged, this._sortItems, this); 486 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.SortingChan ged, this._sortItems, this);
486 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.ColumnsResi zed, this._updateDividersIfNeeded, this); 487 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.ColumnsResi zed, this._updateDividersIfNeeded, this);
487 488
488 this._patchTimelineHeader(); 489 this._sortItems();
489 this._dataGrid.sortNodes(this._sortingFunctions.startTime, false);
490 }, 490 },
491 491
492 /** 492 /**
493 * @param {!Event} event 493 * @param {!Event} event
494 */ 494 */
495 _dataGridMouseDown: function(event) 495 _dataGridMouseDown: function(event)
496 { 496 {
497 if ((!this._dataGrid.selectedNode && event.button) || event.target.enclo singNodeOrSelfWithNodeName("a")) 497 if ((!this._dataGrid.selectedNode && event.button) || event.target.enclo singNodeOrSelfWithNodeName("a"))
498 event.consume(); 498 event.consume();
499 }, 499 },
(...skipping 24 matching lines...) Expand all
524 */ 524 */
525 _makeHeaderFragment: function(title, subtitle) 525 _makeHeaderFragment: function(title, subtitle)
526 { 526 {
527 var fragment = createDocumentFragment(); 527 var fragment = createDocumentFragment();
528 fragment.createTextChild(title); 528 fragment.createTextChild(title);
529 var subtitleDiv = fragment.createChild("div", "network-header-subtitle") ; 529 var subtitleDiv = fragment.createChild("div", "network-header-subtitle") ;
530 subtitleDiv.createTextChild(subtitle); 530 subtitleDiv.createTextChild(subtitle);
531 return fragment; 531 return fragment;
532 }, 532 },
533 533
534 _patchTimelineHeader: function()
535 {
536 var timelineSorting = createElement("select");
537
538 var option = createElement("option");
539 option.value = "startTime";
540 option.label = WebInspector.UIString("Timeline");
541 timelineSorting.appendChild(option);
542
543 option = createElement("option");
544 option.value = "startTime";
545 option.label = WebInspector.UIString("Start Time");
546 timelineSorting.appendChild(option);
547
548 option = createElement("option");
549 option.value = "responseTime";
550 option.label = WebInspector.UIString("Response Time");
551 timelineSorting.appendChild(option);
552
553 option = createElement("option");
554 option.value = "endTime";
555 option.label = WebInspector.UIString("End Time");
556 timelineSorting.appendChild(option);
557
558 option = createElement("option");
559 option.value = "duration";
560 option.label = WebInspector.UIString("Duration");
561 timelineSorting.appendChild(option);
562
563 option = createElement("option");
564 option.value = "latency";
565 option.label = WebInspector.UIString("Latency");
566 timelineSorting.appendChild(option);
567
568 var header = this._dataGrid.headerTableHeader("timeline");
569 header.replaceChild(timelineSorting, header.firstChild);
570
571 timelineSorting.addEventListener("click", function(event) { event.consum e(); }, false);
572 timelineSorting.addEventListener("change", this._sortByTimeline.bind(thi s), false);
573 this._timelineSortSelector = timelineSorting;
574 },
575
576 _createSortingFunctions: function() 534 _createSortingFunctions: function()
577 { 535 {
578 this._sortingFunctions = {}; 536 this._sortingFunctions = {};
579 this._sortingFunctions.name = WebInspector.NetworkDataGridNode.NameCompa rator; 537 this._sortingFunctions.name = WebInspector.NetworkDataGridNode.NameCompa rator;
580 this._sortingFunctions.method = WebInspector.NetworkDataGridNode.Request PropertyComparator.bind(null, "method", false); 538 this._sortingFunctions.method = WebInspector.NetworkDataGridNode.Request PropertyComparator.bind(null, "method", false);
581 this._sortingFunctions.status = WebInspector.NetworkDataGridNode.Request PropertyComparator.bind(null, "statusCode", false); 539 this._sortingFunctions.status = WebInspector.NetworkDataGridNode.Request PropertyComparator.bind(null, "statusCode", false);
582 this._sortingFunctions.protocol = WebInspector.NetworkDataGridNode.Reque stPropertyComparator.bind(null, "protocol", false); 540 this._sortingFunctions.protocol = WebInspector.NetworkDataGridNode.Reque stPropertyComparator.bind(null, "protocol", false);
583 this._sortingFunctions.scheme = WebInspector.NetworkDataGridNode.Request PropertyComparator.bind(null, "scheme", false); 541 this._sortingFunctions.scheme = WebInspector.NetworkDataGridNode.Request PropertyComparator.bind(null, "scheme", false);
584 this._sortingFunctions.domain = WebInspector.NetworkDataGridNode.Request PropertyComparator.bind(null, "domain", false); 542 this._sortingFunctions.domain = WebInspector.NetworkDataGridNode.Request PropertyComparator.bind(null, "domain", false);
585 this._sortingFunctions.remoteAddress = WebInspector.NetworkDataGridNode. RemoteAddressComparator; 543 this._sortingFunctions.remoteAddress = WebInspector.NetworkDataGridNode. RemoteAddressComparator;
586 this._sortingFunctions.type = WebInspector.NetworkDataGridNode.RequestPr opertyComparator.bind(null, "mimeType", false); 544 this._sortingFunctions.type = WebInspector.NetworkDataGridNode.RequestPr opertyComparator.bind(null, "mimeType", false);
587 this._sortingFunctions.initiator = WebInspector.NetworkDataGridNode.Init iatorComparator; 545 this._sortingFunctions.initiator = WebInspector.NetworkDataGridNode.Init iatorComparator;
588 this._sortingFunctions.cookies = WebInspector.NetworkDataGridNode.Reques tCookiesCountComparator; 546 this._sortingFunctions.cookies = WebInspector.NetworkDataGridNode.Reques tCookiesCountComparator;
589 this._sortingFunctions.setCookies = WebInspector.NetworkDataGridNode.Res ponseCookiesCountComparator; 547 this._sortingFunctions.setCookies = WebInspector.NetworkDataGridNode.Res ponseCookiesCountComparator;
590 this._sortingFunctions.size = WebInspector.NetworkDataGridNode.SizeCompa rator; 548 this._sortingFunctions.size = WebInspector.NetworkDataGridNode.SizeCompa rator;
591 this._sortingFunctions.time = WebInspector.NetworkDataGridNode.RequestPr opertyComparator.bind(null, "duration", false); 549 this._sortingFunctions.time = WebInspector.NetworkDataGridNode.RequestPr opertyComparator.bind(null, "duration", false);
592 this._sortingFunctions.connectionId = WebInspector.NetworkDataGridNode.R equestPropertyComparator.bind(null, "connectionId", false); 550 this._sortingFunctions.connectionId = WebInspector.NetworkDataGridNode.R equestPropertyComparator.bind(null, "connectionId", false);
593 this._sortingFunctions.timeline = WebInspector.NetworkDataGridNode.Reque stPropertyComparator.bind(null, "startTime", false); 551 this._sortingFunctions.timeline = WebInspector.NetworkDataGridNode.Reque stPropertyComparator.bind(null, "startTime", false);
594 this._sortingFunctions.startTime = WebInspector.NetworkDataGridNode.Requ estPropertyComparator.bind(null, "startTime", false);
595 this._sortingFunctions.endTime = WebInspector.NetworkDataGridNode.Reques tPropertyComparator.bind(null, "endTime", false);
596 this._sortingFunctions.responseTime = WebInspector.NetworkDataGridNode.R equestPropertyComparator.bind(null, "responseReceivedTime", false);
597 this._sortingFunctions.duration = WebInspector.NetworkDataGridNode.Reque stPropertyComparator.bind(null, "duration", true);
598 this._sortingFunctions.latency = WebInspector.NetworkDataGridNode.Reques tPropertyComparator.bind(null, "latency", true);
599 },
600
601 _createCalculators: function()
602 {
603 /** @type {!WebInspector.NetworkTransferTimeCalculator} */
604 this._timeCalculator = new WebInspector.NetworkTransferTimeCalculator();
605 /** @type {!WebInspector.NetworkTransferDurationCalculator} */
606 this._durationCalculator = new WebInspector.NetworkTransferDurationCalcu lator();
607
608 /** @type {!Object.<string, !WebInspector.NetworkTimeCalculator>} */
609 this._calculators = {};
610 this._calculators.timeline = this._timeCalculator;
611 this._calculators.startTime = this._timeCalculator;
612 this._calculators.endTime = this._timeCalculator;
613 this._calculators.responseTime = this._timeCalculator;
614 this._calculators.duration = this._durationCalculator;
615 this._calculators.latency = this._durationCalculator;
616
617 this._calculator = this._timeCalculator;
618 }, 552 },
619 553
620 _sortItems: function() 554 _sortItems: function()
621 { 555 {
622 this._removeAllNodeHighlights(); 556 this._removeAllNodeHighlights();
623 var columnIdentifier = this._dataGrid.sortColumnIdentifier(); 557 var columnIdentifier = this._dataGrid.sortColumnIdentifier();
624 if (columnIdentifier === "timeline") {
625 this._sortByTimeline();
626 return;
627 }
628 var sortingFunction = this._sortingFunctions[columnIdentifier]; 558 var sortingFunction = this._sortingFunctions[columnIdentifier];
629 if (!sortingFunction) 559 if (!sortingFunction)
630 return; 560 return;
631 561
632 this._dataGrid.sortNodes(sortingFunction, !this._dataGrid.isSortOrderAsc ending()); 562 this._dataGrid.sortNodes(sortingFunction, !this._dataGrid.isSortOrderAsc ending());
633 this._highlightNthMatchedRequestForSearch(this._updateMatchCountAndFindM atchIndex(this._currentMatchedRequestNode), false); 563 this._highlightNthMatchedRequestForSearch(this._updateMatchCountAndFindM atchIndex(this._currentMatchedRequestNode), false);
634 this._timelineSortSelector.selectedIndex = 0;
635 564
636 WebInspector.notifications.dispatchEventToListeners(WebInspector.UserMet rics.UserAction, { 565 WebInspector.notifications.dispatchEventToListeners(WebInspector.UserMet rics.UserAction, {
637 action: WebInspector.UserMetrics.UserActionNames.NetworkSort, 566 action: WebInspector.UserMetrics.UserActionNames.NetworkSort,
638 column: columnIdentifier, 567 column: columnIdentifier,
639 sortOrder: this._dataGrid.sortOrder() 568 sortOrder: this._dataGrid.sortOrder()
640 }); 569 });
641 }, 570 },
642 571
643 _sortByTimeline: function()
644 {
645 this._removeAllNodeHighlights();
646 var selectedIndex = this._timelineSortSelector.selectedIndex;
647 if (!selectedIndex)
648 selectedIndex = 1; // Sort by start time by default.
649 var selectedOption = this._timelineSortSelector[selectedIndex];
650 var value = selectedOption.value;
651
652 this._setCalculator(this._calculators[value]);
653 var sortingFunction = this._sortingFunctions[value];
654 this._dataGrid.sortNodes(sortingFunction);
655 this._highlightNthMatchedRequestForSearch(this._updateMatchCountAndFindM atchIndex(this._currentMatchedRequestNode), false);
656 this._dataGrid.markColumnAsSortedBy("timeline", WebInspector.DataGrid.Or der.Ascending);
657 },
658
659 _updateSummaryBar: function() 572 _updateSummaryBar: function()
660 { 573 {
661 var requestsNumber = this._nodesByRequestId.size; 574 var requestsNumber = this._nodesByRequestId.size;
662 575
663 if (!requestsNumber) { 576 if (!requestsNumber) {
664 if (this._summaryBarElement._isDisplayingWarning) 577 if (this._summaryBarElement._isDisplayingWarning)
665 return; 578 return;
666 this._summaryBarElement._isDisplayingWarning = true; 579 this._summaryBarElement._isDisplayingWarning = true;
667 this._summaryBarElement.removeChildren(); 580 this._summaryBarElement.removeChildren();
668 this._summaryBarElement.createChild("label", "", "dt-icon-label").ty pe = "warning-icon"; 581 this._summaryBarElement.createChild("label", "", "dt-icon-label").ty pe = "warning-icon";
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 668
756 var timelineOffset = this._dataGrid.columnOffset("timeline"); 669 var timelineOffset = this._dataGrid.columnOffset("timeline");
757 // Position timline grid location. 670 // Position timline grid location.
758 if (timelineOffset) 671 if (timelineOffset)
759 this._timelineGrid.element.style.left = timelineOffset + "px"; 672 this._timelineGrid.element.style.left = timelineOffset + "px";
760 673
761 var calculator = this.calculator(); 674 var calculator = this.calculator();
762 calculator.setDisplayWindow(this._timelineGrid.dividersElement.clientWid th); 675 calculator.setDisplayWindow(this._timelineGrid.dividersElement.clientWid th);
763 this._timelineGrid.updateDividers(calculator, 50); 676 this._timelineGrid.updateDividers(calculator, 50);
764 677
765 if (calculator.startAtZero) {
766 // If our current sorting method starts at zero, that means it shows all
767 // requests starting at the same point, and so onLoad event and DOMC ontent
768 // event lines really wouldn't make much sense here, so don't render them.
769 return;
770 }
771
772 this._updateEventDividers(); 678 this._updateEventDividers();
773 }, 679 },
774 680
775 _updateEventDividers: function() 681 _updateEventDividers: function()
776 { 682 {
777 var calculator = this.calculator(); 683 var calculator = this.calculator();
778 684
779 var selectedFrameTime = this._showSelectedFrame ? this._selectedFrameTim e : -1; 685 var selectedFrameTime = this._showSelectedFrame ? this._selectedFrameTim e : -1;
780 var selectedFrameTimePercent = calculator.computePercentageFromEventTime (selectedFrameTime); 686 var selectedFrameTimePercent = calculator.computePercentageFromEventTime (selectedFrameTime);
781 this._selectedFrameDivider.classList.toggle("invisible", selectedFrameTi me === -1 || selectedFrameTimePercent < 0); 687 this._selectedFrameDivider.classList.toggle("invisible", selectedFrameTi me === -1 || selectedFrameTimePercent < 0);
(...skipping 18 matching lines...) Expand all
800 { 706 {
801 var requestIds = this._nodesByRequestId.keysArray(); 707 var requestIds = this._nodesByRequestId.keysArray();
802 for (var i = 0; i < requestIds.length; ++i) 708 for (var i = 0; i < requestIds.length; ++i)
803 this._staleRequestIds[requestIds[i]] = true; 709 this._staleRequestIds[requestIds[i]] = true;
804 this.refresh(); 710 this.refresh();
805 }, 711 },
806 712
807 /** 713 /**
808 * @return {!WebInspector.NetworkTimeCalculator} 714 * @return {!WebInspector.NetworkTimeCalculator}
809 */ 715 */
810 timeCalculator: function()
811 {
812 return this._timeCalculator;
813 },
814
815 /**
816 * @return {!WebInspector.NetworkTimeCalculator}
817 */
818 calculator: function() 716 calculator: function()
819 { 717 {
820 return this._calculator; 718 return this._calculator;
821 }, 719 },
822 720
823 /** 721 /**
824 * @param {!WebInspector.NetworkTimeCalculator} x
825 */
826 _setCalculator: function(x)
827 {
828 if (!x || this._calculator === x)
829 return;
830
831 this._calculator = x;
832 this._calculator.reset();
833
834 if (this._calculator.startAtZero)
835 this._timelineGrid.hideEventDividers();
836 else
837 this._timelineGrid.showEventDividers();
838
839 this._invalidateAllItems();
840 },
841
842 /**
843 * @param {!WebInspector.Event} event 722 * @param {!WebInspector.Event} event
844 */ 723 */
845 _loadEventFired: function(event) 724 _loadEventFired: function(event)
846 { 725 {
847 if (!this._recording) 726 if (!this._recording)
848 return; 727 return;
849 728
850 var data = /** @type {number} */ (event.data); 729 var data = /** @type {number} */ (event.data);
851 this._mainRequestLoadTime = data || -1; 730 this._mainRequestLoadTime = data || -1;
852 // Schedule refresh to update boundaries and draw the new line. 731 // Schedule refresh to update boundaries and draw the new line.
(...skipping 27 matching lines...) Expand all
880 { 759 {
881 this._needsRefresh = false; 760 this._needsRefresh = false;
882 if (this._refreshTimeout) { 761 if (this._refreshTimeout) {
883 clearTimeout(this._refreshTimeout); 762 clearTimeout(this._refreshTimeout);
884 delete this._refreshTimeout; 763 delete this._refreshTimeout;
885 } 764 }
886 765
887 this._removeAllNodeHighlights(); 766 this._removeAllNodeHighlights();
888 767
889 var oldBoundary = this.calculator().boundary(); 768 var oldBoundary = this.calculator().boundary();
890 this._timeCalculator.updateBoundariesForEventTime(this._mainRequestLoadT ime); 769 this._calculator.updateBoundariesForEventTime(this._mainRequestLoadTime) ;
891 this._durationCalculator.updateBoundariesForEventTime(this._mainRequestL oadTime); 770 this._calculator.updateBoundariesForEventTime(this._mainRequestDOMConten tLoadedTime);
892 this._timeCalculator.updateBoundariesForEventTime(this._mainRequestDOMCo ntentLoadedTime);
893 this._durationCalculator.updateBoundariesForEventTime(this._mainRequestD OMContentLoadedTime);
894 771
895 var dataGrid = this._dataGrid; 772 var dataGrid = this._dataGrid;
896 var rootNode = dataGrid.rootNode(); 773 var rootNode = dataGrid.rootNode();
897 var nodesToInsert = []; 774 var nodesToInsert = [];
898 for (var requestId in this._staleRequestIds) { 775 for (var requestId in this._staleRequestIds) {
899 var node = this._nodesByRequestId.get(requestId); 776 var node = this._nodesByRequestId.get(requestId);
900 if (!node) 777 if (!node)
901 continue; 778 continue;
902 if (!node[WebInspector.NetworkLogView._isFilteredOutSymbol]) 779 if (!node[WebInspector.NetworkLogView._isFilteredOutSymbol])
903 rootNode.removeChild(node); 780 rootNode.removeChild(node);
904 node[WebInspector.NetworkLogView._isFilteredOutSymbol] = !this._appl yFilter(node); 781 node[WebInspector.NetworkLogView._isFilteredOutSymbol] = !this._appl yFilter(node);
905 if (!node[WebInspector.NetworkLogView._isFilteredOutSymbol]) 782 if (!node[WebInspector.NetworkLogView._isFilteredOutSymbol])
906 nodesToInsert.push(node); 783 nodesToInsert.push(node);
907 var request = node.request(); 784 var request = node.request();
908 this._timeCalculator.updateBoundaries(request); 785 this._calculator.updateBoundaries(request);
909 this._durationCalculator.updateBoundaries(request);
910 } 786 }
911 787
912 for (var i = 0; i < nodesToInsert.length; ++i) { 788 for (var i = 0; i < nodesToInsert.length; ++i) {
913 var node = nodesToInsert[i]; 789 var node = nodesToInsert[i];
914 var request = node.request(); 790 var request = node.request();
915 node.refresh(); 791 node.refresh();
916 dataGrid.insertChild(node); 792 dataGrid.insertChild(node);
917 node[WebInspector.NetworkLogView._isMatchingSearchQuerySymbol] = thi s._matchRequest(request); 793 node[WebInspector.NetworkLogView._isMatchingSearchQuerySymbol] = thi s._matchRequest(request);
918 } 794 }
919 795
920 this._highlightNthMatchedRequestForSearch(this._updateMatchCountAndFindM atchIndex(this._currentMatchedRequestNode), false); 796 this._highlightNthMatchedRequestForSearch(this._updateMatchCountAndFindM atchIndex(this._currentMatchedRequestNode), false);
921 797
922 if (this._shouldSetWaterfallWindow && this._mainRequestLoadTime !== -1) { 798 if (this._shouldSetWaterfallWindow && this._mainRequestLoadTime !== -1) {
923 var waterfallWindow = this.calculator().boundary(); 799 var waterfallWindow = this.calculator().boundary();
924 var overtime = this._mainRequestLoadTime - waterfallWindow.minimum; 800 var overtime = this._mainRequestLoadTime - waterfallWindow.minimum;
925 overtime = Number.constrain(overtime, WebInspector.NetworkLogView._w aterfallMinOvertime, WebInspector.NetworkLogView._waterfallMaxOvertime) 801 overtime = Number.constrain(overtime, WebInspector.NetworkLogView._w aterfallMinOvertime, WebInspector.NetworkLogView._waterfallMaxOvertime)
926 var waterfallEnd = this._mainRequestLoadTime + overtime; 802 var waterfallEnd = this._mainRequestLoadTime + overtime;
927 if (waterfallEnd <= waterfallWindow.maximum) { 803 if (waterfallEnd <= waterfallWindow.maximum) {
928 waterfallWindow.maximum = waterfallEnd; 804 waterfallWindow.maximum = waterfallEnd;
929 this._shouldSetWaterfallWindow = false; 805 this._shouldSetWaterfallWindow = false;
930 this._timeCalculator.setWindow(waterfallWindow); 806 this._calculator.setWindow(waterfallWindow);
931 } 807 }
932 } 808 }
933 809
934 if (!this.calculator().boundary().equals(oldBoundary)) { 810 if (!this.calculator().boundary().equals(oldBoundary)) {
935 // The boundaries changed, so all item graphs are stale. 811 // The boundaries changed, so all item graphs are stale.
936 this._updateDividersIfNeeded(); 812 this._updateDividersIfNeeded();
937 var nodes = this._nodesByRequestId.valuesArray(); 813 var nodes = this._nodesByRequestId.valuesArray();
938 for (var i = 0; i < nodes.length; ++i) 814 for (var i = 0; i < nodes.length; ++i)
939 nodes[i].refreshGraph(); 815 nodes[i].refreshGraph();
940 } 816 }
(...skipping 10 matching lines...) Expand all
951 this._shouldSetWaterfallWindow = Runtime.experiments.isEnabled("showPrim aryLoadWaterfallInNetworkTimeline") && WebInspector.settings.networkShowPrimaryL oadWaterfall.get(); 827 this._shouldSetWaterfallWindow = Runtime.experiments.isEnabled("showPrim aryLoadWaterfallInNetworkTimeline") && WebInspector.settings.networkShowPrimaryL oadWaterfall.get();
952 828
953 this._clearSearchMatchedList(); 829 this._clearSearchMatchedList();
954 if (this._popoverHelper) 830 if (this._popoverHelper)
955 this._popoverHelper.hidePopover(); 831 this._popoverHelper.hidePopover();
956 832
957 this._overview.reset(); 833 this._overview.reset();
958 this._timeFilter = null; 834 this._timeFilter = null;
959 this._calculator.reset(); 835 this._calculator.reset();
960 836
961 this._timeCalculator.setWindow(null); 837 this._calculator.setWindow(null);
962 838
963 var nodes = this._nodesByRequestId.valuesArray(); 839 var nodes = this._nodesByRequestId.valuesArray();
964 for (var i = 0; i < nodes.length; ++i) 840 for (var i = 0; i < nodes.length; ++i)
965 nodes[i].dispose(); 841 nodes[i].dispose();
966 842
967 this._nodesByRequestId.clear(); 843 this._nodesByRequestId.clear();
968 this._staleRequestIds = {}; 844 this._staleRequestIds = {};
969 this._resetSuggestionBuilder(); 845 this._resetSuggestionBuilder();
970 846
971 this._selectedFrameTime = -1; 847 this._selectedFrameTime = -1;
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
1159 */ 1035 */
1160 _showPopover: function(anchor, popover) 1036 _showPopover: function(anchor, popover)
1161 { 1037 {
1162 var content; 1038 var content;
1163 if (anchor.classList.contains("network-script-initiated")) { 1039 if (anchor.classList.contains("network-script-initiated")) {
1164 var request = /** @type {!WebInspector.NetworkRequest} */ (anchor.re quest); 1040 var request = /** @type {!WebInspector.NetworkRequest} */ (anchor.re quest);
1165 var initiator = /** @type {!NetworkAgent.Initiator} */ (request.init iator()); 1041 var initiator = /** @type {!NetworkAgent.Initiator} */ (request.init iator());
1166 content = WebInspector.DOMPresentationUtils.buildStackTracePreviewCo ntents(request.target(), this._popupLinkifier, initiator.stackTrace, initiator.a syncStackTrace); 1042 content = WebInspector.DOMPresentationUtils.buildStackTracePreviewCo ntents(request.target(), this._popupLinkifier, initiator.stackTrace, initiator.a syncStackTrace);
1167 popover.setCanShrink(true); 1043 popover.setCanShrink(true);
1168 } else { 1044 } else {
1169 content = WebInspector.RequestTimingView.createTimingTable(anchor.pa rentElement.request, this._timeCalculator.minimumBoundary()); 1045 content = WebInspector.RequestTimingView.createTimingTable(anchor.pa rentElement.request, this._calculator.minimumBoundary());
1170 popover.setCanShrink(false); 1046 popover.setCanShrink(false);
1171 } 1047 }
1172 popover.showForAnchor(content, anchor); 1048 popover.showForAnchor(content, anchor);
1173 }, 1049 },
1174 1050
1175 _onHidePopover: function() 1051 _onHidePopover: function()
1176 { 1052 {
1177 this._popupLinkifier.reset(); 1053 this._popupLinkifier.reset();
1178 }, 1054 },
1179 1055
(...skipping 856 matching lines...) Expand 10 before | Expand all | Expand 10 after
2036 return false; 1912 return false;
2037 return true; 1913 return true;
2038 } 1914 }
2039 1915
2040 WebInspector.NetworkLogView.EventTypes = { 1916 WebInspector.NetworkLogView.EventTypes = {
2041 RequestSelected: "RequestSelected", 1917 RequestSelected: "RequestSelected",
2042 SearchCountUpdated: "SearchCountUpdated", 1918 SearchCountUpdated: "SearchCountUpdated",
2043 SearchIndexUpdated: "SearchIndexUpdated", 1919 SearchIndexUpdated: "SearchIndexUpdated",
2044 TimeHovered: "TimeHovered" 1920 TimeHovered: "TimeHovered"
2045 }; 1921 };
OLDNEW
« no previous file with comments | « Source/devtools/front_end/network/NetworkDataGridNode.js ('k') | Source/devtools/front_end/network/NetworkOverview.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698