| Index: Source/devtools/front_end/network/NetworkLogView.js
|
| diff --git a/Source/devtools/front_end/network/NetworkLogView.js b/Source/devtools/front_end/network/NetworkLogView.js
|
| index 2f453ad464344ab995b8ce140590c107a071276c..4ccd4e23e8c02c787d296a6eb8aeaa31b94a156f 100644
|
| --- a/Source/devtools/front_end/network/NetworkLogView.js
|
| +++ b/Source/devtools/front_end/network/NetworkLogView.js
|
| @@ -90,6 +90,8 @@ WebInspector.NetworkLogView = function(overview, filterBar, progressBarContainer
|
|
|
| /** @type {number} */
|
| this._rowHeight = 0;
|
| + /** @type {!WebInspector.NetworkTimeCalculator} */
|
| + this._calculator = new WebInspector.NetworkTimeCalculator();
|
|
|
| this._addFilters();
|
| this._resetSuggestionBuilder();
|
| @@ -238,10 +240,10 @@ WebInspector.NetworkLogView.prototype = {
|
| var end = /** @type {number} */ (event.data.end);
|
| if (!start && !end) {
|
| this._timeFilter = null;
|
| - this._timeCalculator.setWindow(null);
|
| + this._calculator.setWindow(null);
|
| } else {
|
| this._timeFilter = WebInspector.NetworkLogView._requestTimeFilter.bind(null, start, end);
|
| - this._timeCalculator.setWindow(new WebInspector.NetworkTimeBoundary(start, end));
|
| + this._calculator.setWindow(new WebInspector.NetworkTimeBoundary(start, end));
|
| }
|
| this._updateDividersIfNeeded();
|
| this._filterRequests();
|
| @@ -301,7 +303,6 @@ WebInspector.NetworkLogView.prototype = {
|
| this.element.id = "network-container";
|
|
|
| this._createSortingFunctions();
|
| - this._createCalculators();
|
| this._createTable();
|
| this._createTimelineGrid();
|
| this._summaryBarElement = this.element.createChild("div", "network-summary-bar");
|
| @@ -465,7 +466,7 @@ WebInspector.NetworkLogView.prototype = {
|
| columns.push({
|
| id: "timeline",
|
| title: WebInspector.NetworkLogView._columnTitles["timeline"],
|
| - sortable: false,
|
| + sortable: true,
|
| weight: 40,
|
| sort: WebInspector.DataGrid.Order.Ascending
|
| });
|
| @@ -485,8 +486,7 @@ WebInspector.NetworkLogView.prototype = {
|
| this._dataGrid.addEventListener(WebInspector.DataGrid.Events.SortingChanged, this._sortItems, this);
|
| this._dataGrid.addEventListener(WebInspector.DataGrid.Events.ColumnsResized, this._updateDividersIfNeeded, this);
|
|
|
| - this._patchTimelineHeader();
|
| - this._dataGrid.sortNodes(this._sortingFunctions.startTime, false);
|
| + this._sortItems();
|
| },
|
|
|
| /**
|
| @@ -531,48 +531,6 @@ WebInspector.NetworkLogView.prototype = {
|
| return fragment;
|
| },
|
|
|
| - _patchTimelineHeader: function()
|
| - {
|
| - var timelineSorting = createElement("select");
|
| -
|
| - var option = createElement("option");
|
| - option.value = "startTime";
|
| - option.label = WebInspector.UIString("Timeline");
|
| - timelineSorting.appendChild(option);
|
| -
|
| - option = createElement("option");
|
| - option.value = "startTime";
|
| - option.label = WebInspector.UIString("Start Time");
|
| - timelineSorting.appendChild(option);
|
| -
|
| - option = createElement("option");
|
| - option.value = "responseTime";
|
| - option.label = WebInspector.UIString("Response Time");
|
| - timelineSorting.appendChild(option);
|
| -
|
| - option = createElement("option");
|
| - option.value = "endTime";
|
| - option.label = WebInspector.UIString("End Time");
|
| - timelineSorting.appendChild(option);
|
| -
|
| - option = createElement("option");
|
| - option.value = "duration";
|
| - option.label = WebInspector.UIString("Duration");
|
| - timelineSorting.appendChild(option);
|
| -
|
| - option = createElement("option");
|
| - option.value = "latency";
|
| - option.label = WebInspector.UIString("Latency");
|
| - timelineSorting.appendChild(option);
|
| -
|
| - var header = this._dataGrid.headerTableHeader("timeline");
|
| - header.replaceChild(timelineSorting, header.firstChild);
|
| -
|
| - timelineSorting.addEventListener("click", function(event) { event.consume(); }, false);
|
| - timelineSorting.addEventListener("change", this._sortByTimeline.bind(this), false);
|
| - this._timelineSortSelector = timelineSorting;
|
| - },
|
| -
|
| _createSortingFunctions: function()
|
| {
|
| this._sortingFunctions = {};
|
| @@ -591,47 +549,18 @@ WebInspector.NetworkLogView.prototype = {
|
| this._sortingFunctions.time = WebInspector.NetworkDataGridNode.RequestPropertyComparator.bind(null, "duration", false);
|
| this._sortingFunctions.connectionId = WebInspector.NetworkDataGridNode.RequestPropertyComparator.bind(null, "connectionId", false);
|
| this._sortingFunctions.timeline = WebInspector.NetworkDataGridNode.RequestPropertyComparator.bind(null, "startTime", false);
|
| - this._sortingFunctions.startTime = WebInspector.NetworkDataGridNode.RequestPropertyComparator.bind(null, "startTime", false);
|
| - this._sortingFunctions.endTime = WebInspector.NetworkDataGridNode.RequestPropertyComparator.bind(null, "endTime", false);
|
| - this._sortingFunctions.responseTime = WebInspector.NetworkDataGridNode.RequestPropertyComparator.bind(null, "responseReceivedTime", false);
|
| - this._sortingFunctions.duration = WebInspector.NetworkDataGridNode.RequestPropertyComparator.bind(null, "duration", true);
|
| - this._sortingFunctions.latency = WebInspector.NetworkDataGridNode.RequestPropertyComparator.bind(null, "latency", true);
|
| - },
|
| -
|
| - _createCalculators: function()
|
| - {
|
| - /** @type {!WebInspector.NetworkTransferTimeCalculator} */
|
| - this._timeCalculator = new WebInspector.NetworkTransferTimeCalculator();
|
| - /** @type {!WebInspector.NetworkTransferDurationCalculator} */
|
| - this._durationCalculator = new WebInspector.NetworkTransferDurationCalculator();
|
| -
|
| - /** @type {!Object.<string, !WebInspector.NetworkTimeCalculator>} */
|
| - this._calculators = {};
|
| - this._calculators.timeline = this._timeCalculator;
|
| - this._calculators.startTime = this._timeCalculator;
|
| - this._calculators.endTime = this._timeCalculator;
|
| - this._calculators.responseTime = this._timeCalculator;
|
| - this._calculators.duration = this._durationCalculator;
|
| - this._calculators.latency = this._durationCalculator;
|
| -
|
| - this._calculator = this._timeCalculator;
|
| },
|
|
|
| _sortItems: function()
|
| {
|
| this._removeAllNodeHighlights();
|
| var columnIdentifier = this._dataGrid.sortColumnIdentifier();
|
| - if (columnIdentifier === "timeline") {
|
| - this._sortByTimeline();
|
| - return;
|
| - }
|
| var sortingFunction = this._sortingFunctions[columnIdentifier];
|
| if (!sortingFunction)
|
| return;
|
|
|
| this._dataGrid.sortNodes(sortingFunction, !this._dataGrid.isSortOrderAscending());
|
| this._highlightNthMatchedRequestForSearch(this._updateMatchCountAndFindMatchIndex(this._currentMatchedRequestNode), false);
|
| - this._timelineSortSelector.selectedIndex = 0;
|
|
|
| WebInspector.notifications.dispatchEventToListeners(WebInspector.UserMetrics.UserAction, {
|
| action: WebInspector.UserMetrics.UserActionNames.NetworkSort,
|
| @@ -640,22 +569,6 @@ WebInspector.NetworkLogView.prototype = {
|
| });
|
| },
|
|
|
| - _sortByTimeline: function()
|
| - {
|
| - this._removeAllNodeHighlights();
|
| - var selectedIndex = this._timelineSortSelector.selectedIndex;
|
| - if (!selectedIndex)
|
| - selectedIndex = 1; // Sort by start time by default.
|
| - var selectedOption = this._timelineSortSelector[selectedIndex];
|
| - var value = selectedOption.value;
|
| -
|
| - this._setCalculator(this._calculators[value]);
|
| - var sortingFunction = this._sortingFunctions[value];
|
| - this._dataGrid.sortNodes(sortingFunction);
|
| - this._highlightNthMatchedRequestForSearch(this._updateMatchCountAndFindMatchIndex(this._currentMatchedRequestNode), false);
|
| - this._dataGrid.markColumnAsSortedBy("timeline", WebInspector.DataGrid.Order.Ascending);
|
| - },
|
| -
|
| _updateSummaryBar: function()
|
| {
|
| var requestsNumber = this._nodesByRequestId.size;
|
| @@ -762,13 +675,6 @@ WebInspector.NetworkLogView.prototype = {
|
| calculator.setDisplayWindow(this._timelineGrid.dividersElement.clientWidth);
|
| this._timelineGrid.updateDividers(calculator, 50);
|
|
|
| - if (calculator.startAtZero) {
|
| - // If our current sorting method starts at zero, that means it shows all
|
| - // requests starting at the same point, and so onLoad event and DOMContent
|
| - // event lines really wouldn't make much sense here, so don't render them.
|
| - return;
|
| - }
|
| -
|
| this._updateEventDividers();
|
| },
|
|
|
| @@ -807,39 +713,12 @@ WebInspector.NetworkLogView.prototype = {
|
| /**
|
| * @return {!WebInspector.NetworkTimeCalculator}
|
| */
|
| - timeCalculator: function()
|
| - {
|
| - return this._timeCalculator;
|
| - },
|
| -
|
| - /**
|
| - * @return {!WebInspector.NetworkTimeCalculator}
|
| - */
|
| calculator: function()
|
| {
|
| return this._calculator;
|
| },
|
|
|
| /**
|
| - * @param {!WebInspector.NetworkTimeCalculator} x
|
| - */
|
| - _setCalculator: function(x)
|
| - {
|
| - if (!x || this._calculator === x)
|
| - return;
|
| -
|
| - this._calculator = x;
|
| - this._calculator.reset();
|
| -
|
| - if (this._calculator.startAtZero)
|
| - this._timelineGrid.hideEventDividers();
|
| - else
|
| - this._timelineGrid.showEventDividers();
|
| -
|
| - this._invalidateAllItems();
|
| - },
|
| -
|
| - /**
|
| * @param {!WebInspector.Event} event
|
| */
|
| _loadEventFired: function(event)
|
| @@ -887,10 +766,8 @@ WebInspector.NetworkLogView.prototype = {
|
| this._removeAllNodeHighlights();
|
|
|
| var oldBoundary = this.calculator().boundary();
|
| - this._timeCalculator.updateBoundariesForEventTime(this._mainRequestLoadTime);
|
| - this._durationCalculator.updateBoundariesForEventTime(this._mainRequestLoadTime);
|
| - this._timeCalculator.updateBoundariesForEventTime(this._mainRequestDOMContentLoadedTime);
|
| - this._durationCalculator.updateBoundariesForEventTime(this._mainRequestDOMContentLoadedTime);
|
| + this._calculator.updateBoundariesForEventTime(this._mainRequestLoadTime);
|
| + this._calculator.updateBoundariesForEventTime(this._mainRequestDOMContentLoadedTime);
|
|
|
| var dataGrid = this._dataGrid;
|
| var rootNode = dataGrid.rootNode();
|
| @@ -905,8 +782,7 @@ WebInspector.NetworkLogView.prototype = {
|
| if (!node[WebInspector.NetworkLogView._isFilteredOutSymbol])
|
| nodesToInsert.push(node);
|
| var request = node.request();
|
| - this._timeCalculator.updateBoundaries(request);
|
| - this._durationCalculator.updateBoundaries(request);
|
| + this._calculator.updateBoundaries(request);
|
| }
|
|
|
| for (var i = 0; i < nodesToInsert.length; ++i) {
|
| @@ -927,7 +803,7 @@ WebInspector.NetworkLogView.prototype = {
|
| if (waterfallEnd <= waterfallWindow.maximum) {
|
| waterfallWindow.maximum = waterfallEnd;
|
| this._shouldSetWaterfallWindow = false;
|
| - this._timeCalculator.setWindow(waterfallWindow);
|
| + this._calculator.setWindow(waterfallWindow);
|
| }
|
| }
|
|
|
| @@ -958,7 +834,7 @@ WebInspector.NetworkLogView.prototype = {
|
| this._timeFilter = null;
|
| this._calculator.reset();
|
|
|
| - this._timeCalculator.setWindow(null);
|
| + this._calculator.setWindow(null);
|
|
|
| var nodes = this._nodesByRequestId.valuesArray();
|
| for (var i = 0; i < nodes.length; ++i)
|
| @@ -1166,7 +1042,7 @@ WebInspector.NetworkLogView.prototype = {
|
| content = WebInspector.DOMPresentationUtils.buildStackTracePreviewContents(request.target(), this._popupLinkifier, initiator.stackTrace, initiator.asyncStackTrace);
|
| popover.setCanShrink(true);
|
| } else {
|
| - content = WebInspector.RequestTimingView.createTimingTable(anchor.parentElement.request, this._timeCalculator.minimumBoundary());
|
| + content = WebInspector.RequestTimingView.createTimingTable(anchor.parentElement.request, this._calculator.minimumBoundary());
|
| popover.setCanShrink(false);
|
| }
|
| popover.showForAnchor(content, anchor);
|
|
|