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

Unified 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, 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 side-by-side diff with in-line comments
Download patch
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 8c71421c186c5f42abe989e9a0f7a017752a2a46..025ac0f03459dba266a8d2dd8efa0c772b4ab346 100644
--- a/Source/devtools/front_end/network/NetworkLogView.js
+++ b/Source/devtools/front_end/network/NetworkLogView.js
@@ -92,6 +92,8 @@ WebInspector.NetworkLogView = function(overview, filterBar, progressBarContainer
/** @type {number} */
this._rowHeight = 0;
+ /** @type {!WebInspector.NetworkTimeCalculator} */
+ this._calculator = new WebInspector.NetworkTimeCalculator();
this._addFilters();
this._resetSuggestionBuilder();
@@ -222,10 +224,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();
@@ -285,7 +287,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");
@@ -447,7 +448,7 @@ WebInspector.NetworkLogView.prototype = {
columns.push({
id: "timeline",
title: WebInspector.NetworkLogView._columnTitles["timeline"],
- sortable: false,
+ sortable: true,
weight: 40,
sort: WebInspector.DataGrid.Order.Ascending
});
@@ -466,8 +467,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();
},
/**
@@ -493,48 +493,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 = {};
@@ -553,63 +511,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;
- },
-
- _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()
@@ -718,13 +631,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();
},
@@ -758,39 +664,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)
@@ -838,10 +717,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();
@@ -856,8 +733,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) {
@@ -878,7 +754,7 @@ WebInspector.NetworkLogView.prototype = {
if (waterfallEnd <= waterfallWindow.maximum) {
waterfallWindow.maximum = waterfallEnd;
this._shouldSetWaterfallWindow = false;
- this._timeCalculator.setWindow(waterfallWindow);
+ this._calculator.setWindow(waterfallWindow);
}
}
@@ -909,7 +785,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)
@@ -1116,7 +992,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);
« 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