| Index: Source/devtools/front_end/network/NetworkPanel.js
|
| diff --git a/Source/devtools/front_end/network/NetworkPanel.js b/Source/devtools/front_end/network/NetworkPanel.js
|
| index f09e899c2783416c020b8356123dc94347c4cdbd..28ef9471e0777441832aafa894df62fa5bc8fd3a 100644
|
| --- a/Source/devtools/front_end/network/NetworkPanel.js
|
| +++ b/Source/devtools/front_end/network/NetworkPanel.js
|
| @@ -76,6 +76,8 @@ WebInspector.NetworkLogView = function(filterBar, coulmnsVisibilitySetting)
|
| this._createStatusBarItems();
|
| this._linkifier = new WebInspector.Linkifier();
|
|
|
| + this._allowPopover = true;
|
| +
|
| this._addFilters();
|
| this._resetSuggestionBuilder();
|
| this._initializeView();
|
| @@ -190,20 +192,22 @@ WebInspector.NetworkLogView.prototype = {
|
| this._createTimelineGrid();
|
| this._summaryBarElement = this.element.createChild("div", "network-summary-bar");
|
|
|
| - if (!this.useLargeRows)
|
| - this._setLargerRequests(this.useLargeRows);
|
| + if (!this.usesLargeRows())
|
| + this._setLargerRequests(false);
|
|
|
| - this._allowPopover = true;
|
| this._popoverHelper = new WebInspector.PopoverHelper(this.element, this._getPopoverAnchor.bind(this), this._showPopover.bind(this), this._onHidePopover.bind(this));
|
| // Enable faster hint.
|
| this._popoverHelper.setTimeout(100);
|
|
|
| - this.calculator = new WebInspector.NetworkTransferTimeCalculator();
|
| + this._setCalculator(new WebInspector.NetworkTransferTimeCalculator());
|
|
|
| this.switchToDetailedView();
|
| },
|
|
|
| - get statusBarItems()
|
| + /**
|
| + * @return {!Array.<!Element>}
|
| + */
|
| + statusBarItems: function()
|
| {
|
| return [
|
| this._recordButton.element,
|
| @@ -215,12 +219,18 @@ WebInspector.NetworkLogView.prototype = {
|
| this._progressBarContainer];
|
| },
|
|
|
| - get useLargeRows()
|
| + /**
|
| + * @return {boolean}
|
| + */
|
| + usesLargeRows: function()
|
| {
|
| - return WebInspector.settings.resourcesLargeRows.get();
|
| + return !!WebInspector.settings.resourcesLargeRows.get();
|
| },
|
|
|
| - set allowPopover(flag)
|
| + /**
|
| + * @param {boolean} flag
|
| + */
|
| + setAllowPopover: function(flag)
|
| {
|
| this._allowPopover = flag;
|
| },
|
| @@ -502,8 +512,9 @@ WebInspector.NetworkLogView.prototype = {
|
| var sortingFunction = this._sortingFunctions[value];
|
| this._dataGrid.sortNodes(sortingFunction);
|
| this._highlightNthMatchedRequestForSearch(this._updateMatchCountAndFindMatchIndex(this._currentMatchedRequestNode), false);
|
| - this.calculator = this._calculators[value];
|
| - if (this.calculator.startAtZero)
|
| + var calculator = this._calculators[value];
|
| + this._setCalculator(calculator);
|
| + if (calculator.startAtZero)
|
| this._timelineGrid.hideEventDividers();
|
| else
|
| this._timelineGrid.showEventDividers();
|
| @@ -590,18 +601,19 @@ WebInspector.NetworkLogView.prototype = {
|
| if (timelineOffset)
|
| this._timelineGrid.element.style.left = timelineOffset + "px";
|
|
|
| + var calculator = this.calculator();
|
| var proceed = true;
|
| if (!this.isShowing()) {
|
| this._scheduleRefresh();
|
| proceed = false;
|
| } else {
|
| - this.calculator.setDisplayWindow(this._timelineGrid.dividersElement.clientWidth);
|
| - proceed = this._timelineGrid.updateDividers(this.calculator);
|
| + calculator.setDisplayWindow(this._timelineGrid.dividersElement.clientWidth);
|
| + proceed = this._timelineGrid.updateDividers(calculator);
|
| }
|
| if (!proceed)
|
| return;
|
|
|
| - if (this.calculator.startAtZero || !this.calculator.computePercentageFromEventTime) {
|
| + if (calculator.startAtZero || !calculator.computePercentageFromEventTime) {
|
| // 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.
|
| @@ -613,7 +625,7 @@ WebInspector.NetworkLogView.prototype = {
|
|
|
| this._timelineGrid.removeEventDividers();
|
| if (this._mainRequestLoadTime !== -1) {
|
| - var percent = this.calculator.computePercentageFromEventTime(this._mainRequestLoadTime);
|
| + var percent = calculator.computePercentageFromEventTime(this._mainRequestLoadTime);
|
|
|
| var loadDivider = document.createElement("div");
|
| loadDivider.className = "network-event-divider network-red-divider";
|
| @@ -627,7 +639,7 @@ WebInspector.NetworkLogView.prototype = {
|
| }
|
|
|
| if (this._mainRequestDOMContentLoadedTime !== -1) {
|
| - var percent = this.calculator.computePercentageFromEventTime(this._mainRequestDOMContentLoadedTime);
|
| + var percent = calculator.computePercentageFromEventTime(this._mainRequestDOMContentLoadedTime);
|
|
|
| var domContentLoadedDivider = document.createElement("div");
|
| domContentLoadedDivider.className = "network-event-divider network-blue-divider";
|
| @@ -654,12 +666,18 @@ WebInspector.NetworkLogView.prototype = {
|
| this._staleRequestIds[requestIds[i]] = true;
|
| },
|
|
|
| - get calculator()
|
| + /**
|
| + * @return {!WebInspector.NetworkBaseCalculator}
|
| + */
|
| + calculator: function()
|
| {
|
| return this._calculator;
|
| },
|
|
|
| - set calculator(x)
|
| + /**
|
| + * @param {!WebInspector.NetworkBaseCalculator} x
|
| + */
|
| + _setCalculator: function(x)
|
| {
|
| if (!x || this._calculator === x)
|
| return;
|
| @@ -737,9 +755,10 @@ WebInspector.NetworkLogView.prototype = {
|
| this._removeAllNodeHighlights();
|
| var wasScrolledToLastRow = this._dataGrid.isScrolledToLastRow();
|
| var boundariesChanged = false;
|
| - if (this.calculator.updateBoundariesForEventTime) {
|
| - boundariesChanged = this.calculator.updateBoundariesForEventTime(this._mainRequestLoadTime) || boundariesChanged;
|
| - boundariesChanged = this.calculator.updateBoundariesForEventTime(this._mainRequestDOMContentLoadedTime) || boundariesChanged;
|
| + var calculator = this.calculator();
|
| + if (calculator.updateBoundariesForEventTime) {
|
| + boundariesChanged = calculator.updateBoundariesForEventTime(this._mainRequestLoadTime) || boundariesChanged;
|
| + boundariesChanged = calculator.updateBoundariesForEventTime(this._mainRequestDOMContentLoadedTime) || boundariesChanged;
|
| }
|
|
|
| var dataGrid = this._dataGrid;
|
| @@ -762,7 +781,7 @@ WebInspector.NetworkLogView.prototype = {
|
| node.refresh();
|
| dataGrid.insertChild(node);
|
| node._isMatchingSearchQuery = this._matchRequest(request);
|
| - if (this.calculator.updateBoundaries(request))
|
| + if (calculator.updateBoundaries(request))
|
| boundariesChanged = true;
|
| }
|
|
|
| @@ -773,7 +792,7 @@ WebInspector.NetworkLogView.prototype = {
|
| this._updateDividersIfNeeded();
|
| var nodes = this._nodesByRequestId.values();
|
| for (var i = 0; i < nodes.length; ++i)
|
| - nodes[i].refreshGraph(this.calculator);
|
| + nodes[i].refreshGraph(calculator);
|
| }
|
|
|
| this._staleRequestIds = {};
|
| @@ -1782,7 +1801,7 @@ WebInspector.NetworkPanel = function()
|
| var viewsContainerView = new WebInspector.VBox();
|
| this._viewsContainerElement = viewsContainerView.element;
|
| this._viewsContainerElement.id = "network-views";
|
| - if (!this._networkLogView.useLargeRows)
|
| + if (!this._networkLogView.usesLargeRows())
|
| this._viewsContainerElement.classList.add("small");
|
| viewsContainerView.show(this._splitView.mainElement());
|
|
|
| @@ -1797,8 +1816,9 @@ WebInspector.NetworkPanel = function()
|
| this._closeButtonElement.addEventListener("click", this._toggleGridMode.bind(this), false);
|
| this._viewsContainerElement.appendChild(this._closeButtonElement);
|
|
|
| - for (var i = 0; i < this._networkLogView.statusBarItems.length; ++i)
|
| - this._panelStatusBarElement.appendChild(this._networkLogView.statusBarItems[i]);
|
| + var statusBarItems = this._networkLogView.statusBarItems();
|
| + for (var i = 0; i < statusBarItems.length; ++i)
|
| + this._panelStatusBarElement.appendChild(statusBarItems[i]);
|
|
|
| /**
|
| * @this {WebInspector.NetworkPanel}
|
| @@ -1974,7 +1994,7 @@ WebInspector.NetworkPanel.prototype = {
|
| }
|
|
|
| this._networkLogView.switchToDetailedView();
|
| - this._networkLogView.allowPopover = true;
|
| + this._networkLogView.setAllowPopover(true);
|
| this._networkLogView._allowRequestSelection = false;
|
| },
|
|
|
| @@ -1986,7 +2006,7 @@ WebInspector.NetworkPanel.prototype = {
|
|
|
| this.element.classList.add("viewing-resource");
|
| this._splitView.showBoth();
|
| - this._networkLogView.allowPopover = false;
|
| + this._networkLogView.setAllowPopover(false);
|
| this._networkLogView._allowRequestSelection = true;
|
| this._networkLogView.switchToBriefView();
|
| },
|
| @@ -2510,7 +2530,7 @@ WebInspector.NetworkDataGridNode.prototype = {
|
|
|
| WebInspector.SortableDataGridNode.prototype.createCells.call(this);
|
|
|
| - this.refreshGraph(this._parentView.calculator);
|
| + this.refreshGraph(this._parentView.calculator());
|
| },
|
|
|
| /**
|
|
|