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

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

Issue 1116003002: [DevTools] Simplify getting back to default network order. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2008, 2009 Anthony Ricaud <rik@webkit.org> 3 * Copyright (C) 2008, 2009 Anthony Ricaud <rik@webkit.org>
4 * Copyright (C) 2011 Google Inc. All rights reserved. 4 * Copyright (C) 2011 Google Inc. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 9 *
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 this._popupLinkifier = new WebInspector.Linkifier(); 85 this._popupLinkifier = new WebInspector.Linkifier();
86 /** @type {!WebInspector.Linkifier} */ 86 /** @type {!WebInspector.Linkifier} */
87 this.linkifier = new WebInspector.Linkifier(); 87 this.linkifier = new WebInspector.Linkifier();
88 88
89 this._gridMode = true; 89 this._gridMode = true;
90 this._recording = false; 90 this._recording = false;
91 this._preserveLog = false; 91 this._preserveLog = false;
92 92
93 /** @type {number} */ 93 /** @type {number} */
94 this._rowHeight = 0; 94 this._rowHeight = 0;
95 /** @type {!WebInspector.NetworkTimeCalculator} */
96 this._calculator = new WebInspector.NetworkTimeCalculator();
95 97
96 this._addFilters(); 98 this._addFilters();
97 this._resetSuggestionBuilder(); 99 this._resetSuggestionBuilder();
98 this._initializeView(); 100 this._initializeView();
99 101
100 this._overview.addEventListener(WebInspector.NetworkOverview.Events.WindowCh anged, this._onWindowChanged, this); 102 this._overview.addEventListener(WebInspector.NetworkOverview.Events.WindowCh anged, this._onWindowChanged, this);
101 103
102 WebInspector.moduleSetting("networkColorCodeResourceTypes").addChangeListene r(this._invalidateAllItems, this); 104 WebInspector.moduleSetting("networkColorCodeResourceTypes").addChangeListene r(this._invalidateAllItems, this);
103 this._networkLogLargeRowsSetting.addChangeListener(this._updateRowsSize, thi s); 105 this._networkLogLargeRowsSetting.addChangeListener(this._updateRowsSize, thi s);
104 106
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 217
216 /** 218 /**
217 * @param {!WebInspector.Event} event 219 * @param {!WebInspector.Event} event
218 */ 220 */
219 _onWindowChanged: function(event) 221 _onWindowChanged: function(event)
220 { 222 {
221 var start = /** @type {number} */ (event.data.start); 223 var start = /** @type {number} */ (event.data.start);
222 var end = /** @type {number} */ (event.data.end); 224 var end = /** @type {number} */ (event.data.end);
223 if (!start && !end) { 225 if (!start && !end) {
224 this._timeFilter = null; 226 this._timeFilter = null;
225 this._timeCalculator.setWindow(null); 227 this._calculator.setWindow(null);
226 } else { 228 } else {
227 this._timeFilter = WebInspector.NetworkLogView._requestTimeFilter.bi nd(null, start, end); 229 this._timeFilter = WebInspector.NetworkLogView._requestTimeFilter.bi nd(null, start, end);
228 this._timeCalculator.setWindow(new WebInspector.NetworkTimeBoundary( start, end)); 230 this._calculator.setWindow(new WebInspector.NetworkTimeBoundary(star t, end));
229 } 231 }
230 this._updateDividersIfNeeded(); 232 this._updateDividersIfNeeded();
231 this._filterRequests(); 233 this._filterRequests();
232 }, 234 },
233 235
234 clearSelection: function() 236 clearSelection: function()
235 { 237 {
236 if (this._dataGrid.selectedNode) 238 if (this._dataGrid.selectedNode)
237 this._dataGrid.selectedNode.deselect(); 239 this._dataGrid.selectedNode.deselect();
238 }, 240 },
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 this._removeAllNodeHighlights(); 280 this._removeAllNodeHighlights();
279 this._parseFilterQuery(this._textFilterUI.value()); 281 this._parseFilterQuery(this._textFilterUI.value());
280 this._filterRequests(); 282 this._filterRequests();
281 }, 283 },
282 284
283 _initializeView: function() 285 _initializeView: function()
284 { 286 {
285 this.element.id = "network-container"; 287 this.element.id = "network-container";
286 288
287 this._createSortingFunctions(); 289 this._createSortingFunctions();
288 this._createCalculators();
289 this._createTable(); 290 this._createTable();
290 this._createTimelineGrid(); 291 this._createTimelineGrid();
291 this._summaryBarElement = this.element.createChild("div", "network-summa ry-bar"); 292 this._summaryBarElement = this.element.createChild("div", "network-summa ry-bar");
292 293
293 this._updateRowsSize(); 294 this._updateRowsSize();
294 295
295 this._popoverHelper = new WebInspector.PopoverHelper(this.element, this. _getPopoverAnchor.bind(this), this._showPopover.bind(this), this._onHidePopover. bind(this)); 296 this._popoverHelper = new WebInspector.PopoverHelper(this.element, this. _getPopoverAnchor.bind(this), this._showPopover.bind(this), this._onHidePopover. bind(this));
296 // Enable faster hint. 297 // Enable faster hint.
297 this._popoverHelper.setTimeout(250, 250); 298 this._popoverHelper.setTimeout(250, 250);
298 299
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 weight: 6 441 weight: 6
441 }; 442 };
442 if (headerName === "Content-Length") 443 if (headerName === "Content-Length")
443 descriptor.align = WebInspector.DataGrid.Align.Right; 444 descriptor.align = WebInspector.DataGrid.Align.Right;
444 columns.push(descriptor); 445 columns.push(descriptor);
445 } 446 }
446 447
447 columns.push({ 448 columns.push({
448 id: "timeline", 449 id: "timeline",
449 title: WebInspector.NetworkLogView._columnTitles["timeline"], 450 title: WebInspector.NetworkLogView._columnTitles["timeline"],
450 sortable: false, 451 sortable: true,
451 weight: 40, 452 weight: 40,
452 sort: WebInspector.DataGrid.Order.Ascending 453 sort: WebInspector.DataGrid.Order.Ascending
453 }); 454 });
454 455
455 this._dataGrid = new WebInspector.SortableDataGrid(columns); 456 this._dataGrid = new WebInspector.SortableDataGrid(columns);
456 this._dataGrid.setStickToBottom(true); 457 this._dataGrid.setStickToBottom(true);
457 this._updateColumns(); 458 this._updateColumns();
458 this._dataGrid.setName("networkLog"); 459 this._dataGrid.setName("networkLog");
459 this._dataGrid.setResizeMethod(WebInspector.DataGrid.ResizeMethod.Last); 460 this._dataGrid.setResizeMethod(WebInspector.DataGrid.ResizeMethod.Last);
460 this._dataGrid.element.classList.add("network-log-grid"); 461 this._dataGrid.element.classList.add("network-log-grid");
461 this._dataGrid.element.addEventListener("contextmenu", this._contextMenu .bind(this), true); 462 this._dataGrid.element.addEventListener("contextmenu", this._contextMenu .bind(this), true);
462 this._dataGrid.element.addEventListener("mousedown", this._dataGridMouse Down.bind(this), true); 463 this._dataGrid.element.addEventListener("mousedown", this._dataGridMouse Down.bind(this), true);
463 this._dataGrid.show(this.element); 464 this._dataGrid.show(this.element);
464 465
465 // Event listeners need to be added _after_ we attach to the document, s o that owner document is properly update. 466 // Event listeners need to be added _after_ we attach to the document, s o that owner document is properly update.
466 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.SortingChan ged, this._sortItems, this); 467 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.SortingChan ged, this._sortItems, this);
467 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.ColumnsResi zed, this._updateDividersIfNeeded, this); 468 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.ColumnsResi zed, this._updateDividersIfNeeded, this);
468 469
469 this._patchTimelineHeader(); 470 this._sortItems();
470 this._dataGrid.sortNodes(this._sortingFunctions.startTime, false);
471 }, 471 },
472 472
473 /** 473 /**
474 * @param {!Event} event 474 * @param {!Event} event
475 */ 475 */
476 _dataGridMouseDown: function(event) 476 _dataGridMouseDown: function(event)
477 { 477 {
478 if ((!this._dataGrid.selectedNode && event.button) || event.target.enclo singNodeOrSelfWithNodeName("a")) 478 if ((!this._dataGrid.selectedNode && event.button) || event.target.enclo singNodeOrSelfWithNodeName("a"))
479 event.consume(); 479 event.consume();
480 }, 480 },
481 481
482 /** 482 /**
483 * @param {string} title 483 * @param {string} title
484 * @param {string} subtitle 484 * @param {string} subtitle
485 * @return {!DocumentFragment} 485 * @return {!DocumentFragment}
486 */ 486 */
487 _makeHeaderFragment: function(title, subtitle) 487 _makeHeaderFragment: function(title, subtitle)
488 { 488 {
489 var fragment = createDocumentFragment(); 489 var fragment = createDocumentFragment();
490 fragment.createTextChild(title); 490 fragment.createTextChild(title);
491 var subtitleDiv = fragment.createChild("div", "network-header-subtitle") ; 491 var subtitleDiv = fragment.createChild("div", "network-header-subtitle") ;
492 subtitleDiv.createTextChild(subtitle); 492 subtitleDiv.createTextChild(subtitle);
493 return fragment; 493 return fragment;
494 }, 494 },
495 495
496 _patchTimelineHeader: function()
497 {
498 var timelineSorting = createElement("select");
499
500 var option = createElement("option");
501 option.value = "startTime";
502 option.label = WebInspector.UIString("Timeline");
503 timelineSorting.appendChild(option);
504
505 option = createElement("option");
506 option.value = "startTime";
507 option.label = WebInspector.UIString("Start Time");
508 timelineSorting.appendChild(option);
509
510 option = createElement("option");
511 option.value = "responseTime";
512 option.label = WebInspector.UIString("Response Time");
513 timelineSorting.appendChild(option);
514
515 option = createElement("option");
516 option.value = "endTime";
517 option.label = WebInspector.UIString("End Time");
518 timelineSorting.appendChild(option);
519
520 option = createElement("option");
521 option.value = "duration";
522 option.label = WebInspector.UIString("Duration");
523 timelineSorting.appendChild(option);
524
525 option = createElement("option");
526 option.value = "latency";
527 option.label = WebInspector.UIString("Latency");
528 timelineSorting.appendChild(option);
529
530 var header = this._dataGrid.headerTableHeader("timeline");
531 header.replaceChild(timelineSorting, header.firstChild);
532
533 timelineSorting.addEventListener("click", function(event) { event.consum e(); }, false);
534 timelineSorting.addEventListener("change", this._sortByTimeline.bind(thi s), false);
535 this._timelineSortSelector = timelineSorting;
536 },
537
538 _createSortingFunctions: function() 496 _createSortingFunctions: function()
539 { 497 {
540 this._sortingFunctions = {}; 498 this._sortingFunctions = {};
541 this._sortingFunctions.name = WebInspector.NetworkDataGridNode.NameCompa rator; 499 this._sortingFunctions.name = WebInspector.NetworkDataGridNode.NameCompa rator;
542 this._sortingFunctions.method = WebInspector.NetworkDataGridNode.Request PropertyComparator.bind(null, "method", false); 500 this._sortingFunctions.method = WebInspector.NetworkDataGridNode.Request PropertyComparator.bind(null, "method", false);
543 this._sortingFunctions.status = WebInspector.NetworkDataGridNode.Request PropertyComparator.bind(null, "statusCode", false); 501 this._sortingFunctions.status = WebInspector.NetworkDataGridNode.Request PropertyComparator.bind(null, "statusCode", false);
544 this._sortingFunctions.protocol = WebInspector.NetworkDataGridNode.Reque stPropertyComparator.bind(null, "protocol", false); 502 this._sortingFunctions.protocol = WebInspector.NetworkDataGridNode.Reque stPropertyComparator.bind(null, "protocol", false);
545 this._sortingFunctions.scheme = WebInspector.NetworkDataGridNode.Request PropertyComparator.bind(null, "scheme", false); 503 this._sortingFunctions.scheme = WebInspector.NetworkDataGridNode.Request PropertyComparator.bind(null, "scheme", false);
546 this._sortingFunctions.domain = WebInspector.NetworkDataGridNode.Request PropertyComparator.bind(null, "domain", false); 504 this._sortingFunctions.domain = WebInspector.NetworkDataGridNode.Request PropertyComparator.bind(null, "domain", false);
547 this._sortingFunctions.remoteAddress = WebInspector.NetworkDataGridNode. RemoteAddressComparator; 505 this._sortingFunctions.remoteAddress = WebInspector.NetworkDataGridNode. RemoteAddressComparator;
548 this._sortingFunctions.type = WebInspector.NetworkDataGridNode.RequestPr opertyComparator.bind(null, "mimeType", false); 506 this._sortingFunctions.type = WebInspector.NetworkDataGridNode.RequestPr opertyComparator.bind(null, "mimeType", false);
549 this._sortingFunctions.initiator = WebInspector.NetworkDataGridNode.Init iatorComparator; 507 this._sortingFunctions.initiator = WebInspector.NetworkDataGridNode.Init iatorComparator;
550 this._sortingFunctions.cookies = WebInspector.NetworkDataGridNode.Reques tCookiesCountComparator; 508 this._sortingFunctions.cookies = WebInspector.NetworkDataGridNode.Reques tCookiesCountComparator;
551 this._sortingFunctions.setCookies = WebInspector.NetworkDataGridNode.Res ponseCookiesCountComparator; 509 this._sortingFunctions.setCookies = WebInspector.NetworkDataGridNode.Res ponseCookiesCountComparator;
552 this._sortingFunctions.size = WebInspector.NetworkDataGridNode.SizeCompa rator; 510 this._sortingFunctions.size = WebInspector.NetworkDataGridNode.SizeCompa rator;
553 this._sortingFunctions.time = WebInspector.NetworkDataGridNode.RequestPr opertyComparator.bind(null, "duration", false); 511 this._sortingFunctions.time = WebInspector.NetworkDataGridNode.RequestPr opertyComparator.bind(null, "duration", false);
554 this._sortingFunctions.connectionId = WebInspector.NetworkDataGridNode.R equestPropertyComparator.bind(null, "connectionId", false); 512 this._sortingFunctions.connectionId = WebInspector.NetworkDataGridNode.R equestPropertyComparator.bind(null, "connectionId", false);
555 this._sortingFunctions.timeline = WebInspector.NetworkDataGridNode.Reque stPropertyComparator.bind(null, "startTime", false); 513 this._sortingFunctions.timeline = WebInspector.NetworkDataGridNode.Reque stPropertyComparator.bind(null, "startTime", false);
556 this._sortingFunctions.startTime = WebInspector.NetworkDataGridNode.Requ estPropertyComparator.bind(null, "startTime", false);
557 this._sortingFunctions.endTime = WebInspector.NetworkDataGridNode.Reques tPropertyComparator.bind(null, "endTime", false);
558 this._sortingFunctions.responseTime = WebInspector.NetworkDataGridNode.R equestPropertyComparator.bind(null, "responseReceivedTime", false);
559 this._sortingFunctions.duration = WebInspector.NetworkDataGridNode.Reque stPropertyComparator.bind(null, "duration", true);
560 this._sortingFunctions.latency = WebInspector.NetworkDataGridNode.Reques tPropertyComparator.bind(null, "latency", true);
561 },
562
563 _createCalculators: function()
564 {
565 /** @type {!WebInspector.NetworkTransferTimeCalculator} */
566 this._timeCalculator = new WebInspector.NetworkTransferTimeCalculator();
567 /** @type {!WebInspector.NetworkTransferDurationCalculator} */
568 this._durationCalculator = new WebInspector.NetworkTransferDurationCalcu lator();
569
570 /** @type {!Object.<string, !WebInspector.NetworkTimeCalculator>} */
571 this._calculators = {};
572 this._calculators.timeline = this._timeCalculator;
573 this._calculators.startTime = this._timeCalculator;
574 this._calculators.endTime = this._timeCalculator;
575 this._calculators.responseTime = this._timeCalculator;
576 this._calculators.duration = this._durationCalculator;
577 this._calculators.latency = this._durationCalculator;
578
579 this._calculator = this._timeCalculator;
580 }, 514 },
581 515
582 _sortItems: function() 516 _sortItems: function()
583 { 517 {
584 this._removeAllNodeHighlights(); 518 this._removeAllNodeHighlights();
585 var columnIdentifier = this._dataGrid.sortColumnIdentifier(); 519 var columnIdentifier = this._dataGrid.sortColumnIdentifier();
586 if (columnIdentifier === "timeline") {
587 this._sortByTimeline();
588 return;
589 }
590 var sortingFunction = this._sortingFunctions[columnIdentifier]; 520 var sortingFunction = this._sortingFunctions[columnIdentifier];
591 if (!sortingFunction) 521 if (!sortingFunction)
592 return; 522 return;
593 523
594 this._dataGrid.sortNodes(sortingFunction, !this._dataGrid.isSortOrderAsc ending()); 524 this._dataGrid.sortNodes(sortingFunction, !this._dataGrid.isSortOrderAsc ending());
595 this._highlightNthMatchedRequestForSearch(this._updateMatchCountAndFindM atchIndex(this._currentMatchedRequestNode), false); 525 this._highlightNthMatchedRequestForSearch(this._updateMatchCountAndFindM atchIndex(this._currentMatchedRequestNode), false);
596 this._timelineSortSelector.selectedIndex = 0;
597 },
598
599 _sortByTimeline: function()
600 {
601 this._removeAllNodeHighlights();
602 var selectedIndex = this._timelineSortSelector.selectedIndex;
603 if (!selectedIndex)
604 selectedIndex = 1; // Sort by start time by default.
605 var selectedOption = this._timelineSortSelector[selectedIndex];
606 var value = selectedOption.value;
607
608 this._setCalculator(this._calculators[value]);
609 var sortingFunction = this._sortingFunctions[value];
610 this._dataGrid.sortNodes(sortingFunction);
611 this._highlightNthMatchedRequestForSearch(this._updateMatchCountAndFindM atchIndex(this._currentMatchedRequestNode), false);
612 this._dataGrid.markColumnAsSortedBy("timeline", WebInspector.DataGrid.Or der.Ascending);
613 }, 526 },
614 527
615 _updateSummaryBar: function() 528 _updateSummaryBar: function()
616 { 529 {
617 var requestsNumber = this._nodesByRequestId.size; 530 var requestsNumber = this._nodesByRequestId.size;
618 531
619 if (!requestsNumber) { 532 if (!requestsNumber) {
620 if (this._summaryBarElement._isDisplayingWarning) 533 if (this._summaryBarElement._isDisplayingWarning)
621 return; 534 return;
622 this._summaryBarElement._isDisplayingWarning = true; 535 this._summaryBarElement._isDisplayingWarning = true;
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
711 624
712 var timelineOffset = this._dataGrid.columnOffset("timeline"); 625 var timelineOffset = this._dataGrid.columnOffset("timeline");
713 // Position timline grid location. 626 // Position timline grid location.
714 if (timelineOffset) 627 if (timelineOffset)
715 this._timelineGrid.element.style.left = timelineOffset + "px"; 628 this._timelineGrid.element.style.left = timelineOffset + "px";
716 629
717 var calculator = this.calculator(); 630 var calculator = this.calculator();
718 calculator.setDisplayWindow(this._timelineGrid.dividersElement.clientWid th); 631 calculator.setDisplayWindow(this._timelineGrid.dividersElement.clientWid th);
719 this._timelineGrid.updateDividers(calculator, 50); 632 this._timelineGrid.updateDividers(calculator, 50);
720 633
721 if (calculator.startAtZero) {
722 // If our current sorting method starts at zero, that means it shows all
723 // requests starting at the same point, and so onLoad event and DOMC ontent
724 // event lines really wouldn't make much sense here, so don't render them.
725 return;
726 }
727
728 this._updateEventDividers(); 634 this._updateEventDividers();
729 }, 635 },
730 636
731 _updateEventDividers: function() 637 _updateEventDividers: function()
732 { 638 {
733 var calculator = this.calculator(); 639 var calculator = this.calculator();
734 640
735 var loadTimePercent = calculator.computePercentageFromEventTime(this._ma inRequestLoadTime); 641 var loadTimePercent = calculator.computePercentageFromEventTime(this._ma inRequestLoadTime);
736 this._loadDivider.classList.toggle("invisible", this._mainRequestLoadTim e === -1 || loadTimePercent < 0); 642 this._loadDivider.classList.toggle("invisible", this._mainRequestLoadTim e === -1 || loadTimePercent < 0);
737 this._loadDivider.style.left = loadTimePercent + "%"; 643 this._loadDivider.style.left = loadTimePercent + "%";
(...skipping 13 matching lines...) Expand all
751 { 657 {
752 var requestIds = this._nodesByRequestId.keysArray(); 658 var requestIds = this._nodesByRequestId.keysArray();
753 for (var i = 0; i < requestIds.length; ++i) 659 for (var i = 0; i < requestIds.length; ++i)
754 this._staleRequestIds[requestIds[i]] = true; 660 this._staleRequestIds[requestIds[i]] = true;
755 this.refresh(); 661 this.refresh();
756 }, 662 },
757 663
758 /** 664 /**
759 * @return {!WebInspector.NetworkTimeCalculator} 665 * @return {!WebInspector.NetworkTimeCalculator}
760 */ 666 */
761 timeCalculator: function()
762 {
763 return this._timeCalculator;
764 },
765
766 /**
767 * @return {!WebInspector.NetworkTimeCalculator}
768 */
769 calculator: function() 667 calculator: function()
770 { 668 {
771 return this._calculator; 669 return this._calculator;
772 }, 670 },
773 671
774 /** 672 /**
775 * @param {!WebInspector.NetworkTimeCalculator} x
776 */
777 _setCalculator: function(x)
778 {
779 if (!x || this._calculator === x)
780 return;
781
782 this._calculator = x;
783 this._calculator.reset();
784
785 if (this._calculator.startAtZero)
786 this._timelineGrid.hideEventDividers();
787 else
788 this._timelineGrid.showEventDividers();
789
790 this._invalidateAllItems();
791 },
792
793 /**
794 * @param {!WebInspector.Event} event 673 * @param {!WebInspector.Event} event
795 */ 674 */
796 _loadEventFired: function(event) 675 _loadEventFired: function(event)
797 { 676 {
798 if (!this._recording) 677 if (!this._recording)
799 return; 678 return;
800 679
801 var data = /** @type {number} */ (event.data); 680 var data = /** @type {number} */ (event.data);
802 this._mainRequestLoadTime = data || -1; 681 this._mainRequestLoadTime = data || -1;
803 // Schedule refresh to update boundaries and draw the new line. 682 // Schedule refresh to update boundaries and draw the new line.
(...skipping 27 matching lines...) Expand all
831 { 710 {
832 this._needsRefresh = false; 711 this._needsRefresh = false;
833 if (this._refreshTimeout) { 712 if (this._refreshTimeout) {
834 clearTimeout(this._refreshTimeout); 713 clearTimeout(this._refreshTimeout);
835 delete this._refreshTimeout; 714 delete this._refreshTimeout;
836 } 715 }
837 716
838 this._removeAllNodeHighlights(); 717 this._removeAllNodeHighlights();
839 718
840 var oldBoundary = this.calculator().boundary(); 719 var oldBoundary = this.calculator().boundary();
841 this._timeCalculator.updateBoundariesForEventTime(this._mainRequestLoadT ime); 720 this._calculator.updateBoundariesForEventTime(this._mainRequestLoadTime) ;
842 this._durationCalculator.updateBoundariesForEventTime(this._mainRequestL oadTime); 721 this._calculator.updateBoundariesForEventTime(this._mainRequestDOMConten tLoadedTime);
843 this._timeCalculator.updateBoundariesForEventTime(this._mainRequestDOMCo ntentLoadedTime);
844 this._durationCalculator.updateBoundariesForEventTime(this._mainRequestD OMContentLoadedTime);
845 722
846 var dataGrid = this._dataGrid; 723 var dataGrid = this._dataGrid;
847 var rootNode = dataGrid.rootNode(); 724 var rootNode = dataGrid.rootNode();
848 var nodesToInsert = []; 725 var nodesToInsert = [];
849 for (var requestId in this._staleRequestIds) { 726 for (var requestId in this._staleRequestIds) {
850 var node = this._nodesByRequestId.get(requestId); 727 var node = this._nodesByRequestId.get(requestId);
851 if (!node) 728 if (!node)
852 continue; 729 continue;
853 if (!node[WebInspector.NetworkLogView._isFilteredOutSymbol]) 730 if (!node[WebInspector.NetworkLogView._isFilteredOutSymbol])
854 rootNode.removeChild(node); 731 rootNode.removeChild(node);
855 node[WebInspector.NetworkLogView._isFilteredOutSymbol] = !this._appl yFilter(node); 732 node[WebInspector.NetworkLogView._isFilteredOutSymbol] = !this._appl yFilter(node);
856 if (!node[WebInspector.NetworkLogView._isFilteredOutSymbol]) 733 if (!node[WebInspector.NetworkLogView._isFilteredOutSymbol])
857 nodesToInsert.push(node); 734 nodesToInsert.push(node);
858 var request = node.request(); 735 var request = node.request();
859 this._timeCalculator.updateBoundaries(request); 736 this._calculator.updateBoundaries(request);
860 this._durationCalculator.updateBoundaries(request);
861 } 737 }
862 738
863 for (var i = 0; i < nodesToInsert.length; ++i) { 739 for (var i = 0; i < nodesToInsert.length; ++i) {
864 var node = nodesToInsert[i]; 740 var node = nodesToInsert[i];
865 var request = node.request(); 741 var request = node.request();
866 node.refresh(); 742 node.refresh();
867 dataGrid.insertChild(node); 743 dataGrid.insertChild(node);
868 node[WebInspector.NetworkLogView._isMatchingSearchQuerySymbol] = thi s._matchRequest(request); 744 node[WebInspector.NetworkLogView._isMatchingSearchQuerySymbol] = thi s._matchRequest(request);
869 } 745 }
870 746
871 this._highlightNthMatchedRequestForSearch(this._updateMatchCountAndFindM atchIndex(this._currentMatchedRequestNode), false); 747 this._highlightNthMatchedRequestForSearch(this._updateMatchCountAndFindM atchIndex(this._currentMatchedRequestNode), false);
872 748
873 if (this._shouldSetWaterfallWindow && this._mainRequestLoadTime !== -1) { 749 if (this._shouldSetWaterfallWindow && this._mainRequestLoadTime !== -1) {
874 var waterfallWindow = this.calculator().boundary(); 750 var waterfallWindow = this.calculator().boundary();
875 var overtime = this._mainRequestLoadTime - waterfallWindow.minimum; 751 var overtime = this._mainRequestLoadTime - waterfallWindow.minimum;
876 overtime = Number.constrain(overtime, WebInspector.NetworkLogView._w aterfallMinOvertime, WebInspector.NetworkLogView._waterfallMaxOvertime) 752 overtime = Number.constrain(overtime, WebInspector.NetworkLogView._w aterfallMinOvertime, WebInspector.NetworkLogView._waterfallMaxOvertime)
877 var waterfallEnd = this._mainRequestLoadTime + overtime; 753 var waterfallEnd = this._mainRequestLoadTime + overtime;
878 if (waterfallEnd <= waterfallWindow.maximum) { 754 if (waterfallEnd <= waterfallWindow.maximum) {
879 waterfallWindow.maximum = waterfallEnd; 755 waterfallWindow.maximum = waterfallEnd;
880 this._shouldSetWaterfallWindow = false; 756 this._shouldSetWaterfallWindow = false;
881 this._timeCalculator.setWindow(waterfallWindow); 757 this._calculator.setWindow(waterfallWindow);
882 } 758 }
883 } 759 }
884 760
885 if (!this.calculator().boundary().equals(oldBoundary)) { 761 if (!this.calculator().boundary().equals(oldBoundary)) {
886 // The boundaries changed, so all item graphs are stale. 762 // The boundaries changed, so all item graphs are stale.
887 this._updateDividersIfNeeded(); 763 this._updateDividersIfNeeded();
888 var nodes = this._nodesByRequestId.valuesArray(); 764 var nodes = this._nodesByRequestId.valuesArray();
889 for (var i = 0; i < nodes.length; ++i) 765 for (var i = 0; i < nodes.length; ++i)
890 nodes[i].refreshGraph(); 766 nodes[i].refreshGraph();
891 } 767 }
(...skipping 10 matching lines...) Expand all
902 this._shouldSetWaterfallWindow = Runtime.experiments.isEnabled("showPrim aryLoadWaterfallInNetworkTimeline") && this._networkShowPrimaryLoadWaterfallSett ing.get(); 778 this._shouldSetWaterfallWindow = Runtime.experiments.isEnabled("showPrim aryLoadWaterfallInNetworkTimeline") && this._networkShowPrimaryLoadWaterfallSett ing.get();
903 779
904 this._clearSearchMatchedList(); 780 this._clearSearchMatchedList();
905 if (this._popoverHelper) 781 if (this._popoverHelper)
906 this._popoverHelper.hidePopover(); 782 this._popoverHelper.hidePopover();
907 783
908 this._overview.reset(); 784 this._overview.reset();
909 this._timeFilter = null; 785 this._timeFilter = null;
910 this._calculator.reset(); 786 this._calculator.reset();
911 787
912 this._timeCalculator.setWindow(null); 788 this._calculator.setWindow(null);
913 789
914 var nodes = this._nodesByRequestId.valuesArray(); 790 var nodes = this._nodesByRequestId.valuesArray();
915 for (var i = 0; i < nodes.length; ++i) 791 for (var i = 0; i < nodes.length; ++i)
916 nodes[i].dispose(); 792 nodes[i].dispose();
917 793
918 this._nodesByRequestId.clear(); 794 this._nodesByRequestId.clear();
919 this._staleRequestIds = {}; 795 this._staleRequestIds = {};
920 this._resetSuggestionBuilder(); 796 this._resetSuggestionBuilder();
921 797
922 this._mainRequestLoadTime = -1; 798 this._mainRequestLoadTime = -1;
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
1109 */ 985 */
1110 _showPopover: function(anchor, popover) 986 _showPopover: function(anchor, popover)
1111 { 987 {
1112 var content; 988 var content;
1113 if (anchor.classList.contains("network-script-initiated")) { 989 if (anchor.classList.contains("network-script-initiated")) {
1114 var request = /** @type {!WebInspector.NetworkRequest} */ (anchor.re quest); 990 var request = /** @type {!WebInspector.NetworkRequest} */ (anchor.re quest);
1115 var initiator = /** @type {!NetworkAgent.Initiator} */ (request.init iator()); 991 var initiator = /** @type {!NetworkAgent.Initiator} */ (request.init iator());
1116 content = WebInspector.DOMPresentationUtils.buildStackTracePreviewCo ntents(request.target(), this._popupLinkifier, initiator.stackTrace, initiator.a syncStackTrace); 992 content = WebInspector.DOMPresentationUtils.buildStackTracePreviewCo ntents(request.target(), this._popupLinkifier, initiator.stackTrace, initiator.a syncStackTrace);
1117 popover.setCanShrink(true); 993 popover.setCanShrink(true);
1118 } else { 994 } else {
1119 content = WebInspector.RequestTimingView.createTimingTable(anchor.pa rentElement.request, this._timeCalculator.minimumBoundary()); 995 content = WebInspector.RequestTimingView.createTimingTable(anchor.pa rentElement.request, this._calculator.minimumBoundary());
1120 popover.setCanShrink(false); 996 popover.setCanShrink(false);
1121 } 997 }
1122 popover.showForAnchor(content, anchor); 998 popover.showForAnchor(content, anchor);
1123 }, 999 },
1124 1000
1125 _onHidePopover: function() 1001 _onHidePopover: function()
1126 { 1002 {
1127 this._popupLinkifier.reset(); 1003 this._popupLinkifier.reset();
1128 }, 1004 },
1129 1005
(...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after
1985 if (request.endTime !== -1 && request.endTime < windowStart) 1861 if (request.endTime !== -1 && request.endTime < windowStart)
1986 return false; 1862 return false;
1987 return true; 1863 return true;
1988 } 1864 }
1989 1865
1990 WebInspector.NetworkLogView.EventTypes = { 1866 WebInspector.NetworkLogView.EventTypes = {
1991 RequestSelected: "RequestSelected", 1867 RequestSelected: "RequestSelected",
1992 SearchCountUpdated: "SearchCountUpdated", 1868 SearchCountUpdated: "SearchCountUpdated",
1993 SearchIndexUpdated: "SearchIndexUpdated" 1869 SearchIndexUpdated: "SearchIndexUpdated"
1994 }; 1870 };
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