Diff
Modified: trunk/Source/WebCore/ChangeLog (109215 => 109216)
--- trunk/Source/WebCore/ChangeLog 2012-02-29 15:46:12 UTC (rev 109215)
+++ trunk/Source/WebCore/ChangeLog 2012-02-29 15:59:30 UTC (rev 109216)
@@ -1,3 +1,39 @@
+2012-02-29 Pavel Feldman <[email protected]>
+
+ Web Inspector: remove calculator's updateBoundaries in the timeline panel.
+ https://bugs.webkit.org/show_bug.cgi?id=79907
+
+ Reviewed by Yury Semikhatsky.
+
+ * inspector/front-end/NetworkPanel.js:
+ (WebInspector.NetworkBaseCalculator.prototype.computeBarGraphLabels):
+ (WebInspector.NetworkBaseCalculator.prototype.formatTime):
+ (WebInspector.NetworkTimeCalculator.prototype.computeBarGraphLabels):
+ (WebInspector.NetworkTimeCalculator.prototype.formatTime):
+ (WebInspector.NetworkTransferTimeCalculator.prototype.formatTime):
+ (WebInspector.NetworkTransferDurationCalculator.prototype.formatTime):
+ * inspector/front-end/TimelineGrid.js:
+ (WebInspector.TimelineGrid.prototype.updateDividers):
+ * inspector/front-end/TimelineOverviewPane.js:
+ (WebInspector.TimelineOverviewCalculator.prototype.formatTime):
+ (WebInspector.TimelineStartAtZeroOverview):
+ (WebInspector.TimelineStartAtZeroOverview.prototype.update):
+ * inspector/front-end/TimelinePanel.js:
+ (WebInspector.TimelinePanel):
+ (WebInspector.TimelinePanel.prototype._toggleStartAtZeroButtonClicked):
+ (WebInspector.TimelinePanel.prototype._refresh):
+ (WebInspector.TimelinePanel.prototype._refreshRecords):
+ (WebInspector.TimelinePanel.prototype.get timelinePaddingLeft):
+ (WebInspector.TimelineCalculator):
+ (WebInspector.TimelineCalculator.prototype.setWindow):
+ (WebInspector.TimelineCalculator.prototype.setRecords):
+ (WebInspector.TimelineCalculator.prototype.formatTime):
+ (WebInspector.TimelineFitInWindowCalculator):
+ (WebInspector.TimelineFitInWindowCalculator.prototype.setWindow):
+ (WebInspector.TimelineFitInWindowCalculator.prototype.setRecords):
+ * inspector/front-end/TimelinePresentationModel.js:
+ (WebInspector.TimelinePresentationModel.Record.prototype.generatePopupContent):
+
2012-02-29 Yury Semikhatsky <[email protected]>
Web Inspector: enable Profiles panel for workers
Modified: trunk/Source/WebCore/inspector/front-end/NetworkPanel.js (109215 => 109216)
--- trunk/Source/WebCore/inspector/front-end/NetworkPanel.js 2012-02-29 15:46:12 UTC (rev 109215)
+++ trunk/Source/WebCore/inspector/front-end/NetworkPanel.js 2012-02-29 15:59:30 UTC (rev 109216)
@@ -1451,7 +1451,7 @@
computeBarGraphLabels: function(item)
{
- const label = this.formatValue(this._value(item));
+ const label = this.formatTime(this._value(item));
return {left: label, right: label, tooltip: label};
},
@@ -1483,7 +1483,7 @@
return 0;
},
- formatValue: function(value)
+ formatTime: function(value)
{
return value.toString();
}
@@ -1553,11 +1553,11 @@
{
var rightLabel = "";
if (resource.responseReceivedTime !== -1 && resource.endTime !== -1)
- rightLabel = this.formatValue(resource.endTime - resource.responseReceivedTime);
+ rightLabel = this.formatTime(resource.endTime - resource.responseReceivedTime);
var hasLatency = resource.latency > 0;
if (hasLatency)
- var leftLabel = this.formatValue(resource.latency);
+ var leftLabel = this.formatTime(resource.latency);
else
var leftLabel = rightLabel;
@@ -1565,7 +1565,7 @@
return {left: leftLabel, right: rightLabel};
if (hasLatency && rightLabel) {
- var total = this.formatValue(resource.duration);
+ var total = this.formatTime(resource.duration);
var tooltip = WebInspector.UIString("%s latency, %s download (%s total)", leftLabel, rightLabel, total);
} else if (hasLatency)
var tooltip = WebInspector.UIString("%s latency", leftLabel);
@@ -1601,7 +1601,7 @@
return didChange;
},
- formatValue: function(value)
+ formatTime: function(value)
{
return Number.secondsToString(value);
},
@@ -1629,7 +1629,7 @@
}
WebInspector.NetworkTransferTimeCalculator.prototype = {
- formatValue: function(value)
+ formatTime: function(value)
{
return Number.secondsToString(value);
},
@@ -1657,7 +1657,7 @@
}
WebInspector.NetworkTransferDurationCalculator.prototype = {
- formatValue: function(value)
+ formatTime: function(value)
{
return Number.secondsToString(value);
},
Modified: trunk/Source/WebCore/inspector/front-end/TimelineGrid.js (109215 => 109216)
--- trunk/Source/WebCore/inspector/front-end/TimelineGrid.js 2012-02-29 15:46:12 UTC (rev 109215)
+++ trunk/Source/WebCore/inspector/front-end/TimelineGrid.js 2012-02-29 15:59:30 UTC (rev 109216)
@@ -119,7 +119,7 @@
this._setDividerAndBarLeft(divider, dividerLabelBar, percentLeft);
if (!isNaN(slice))
- dividerLabelBar._labelElement.textContent = calculator.formatValue(slice * i);
+ dividerLabelBar._labelElement.textContent = calculator.formatTime(slice * i);
else
dividerLabelBar._labelElement.textContent = "";
Modified: trunk/Source/WebCore/inspector/front-end/TimelineOverviewPane.js (109215 => 109216)
--- trunk/Source/WebCore/inspector/front-end/TimelineOverviewPane.js 2012-02-29 15:46:12 UTC (rev 109215)
+++ trunk/Source/WebCore/inspector/front-end/TimelineOverviewPane.js 2012-02-29 15:59:30 UTC (rev 109216)
@@ -543,7 +543,7 @@
return this.maximumBoundary - this.minimumBoundary;
},
- formatValue: function(value)
+ formatTime: function(value)
{
return Number.secondsToString(value);
}
@@ -774,7 +774,6 @@
this._overviewWindow = new WebInspector.TimelineOverviewWindow(this.element);
this._overviewWindow.addEventListener(WebInspector.TimelineOverviewWindow.Events.WindowChanged, this._onWindowChanged, this);
this._recordsPerBar = 1;
- this._calculator = new WebInspector.TimelineStartAtZeroCalculator();
}
WebInspector.TimelineStartAtZeroOverview.prototype = {
@@ -786,12 +785,16 @@
update: function(records)
{
- this._calculator.reset();
records = this._filterRecords(records);
- records.forEach(this._calculator.updateBoundaries, this._calculator);
- this._calculator.calculateWindow();
-
- var scale = (this._overviewElement.clientHeight - 4) / this._calculator.boundarySpan;
+ var boundarySpan = 0;
+ for (var i = 0; i < records.length; ++i) {
+ var record = records[i];
+ var duration = record.endTime - record.startTime;
+ if (boundarySpan < duration)
+ boundarySpan = duration;
+ }
+
+ var scale = (this._overviewElement.clientHeight - 4) / boundarySpan;
this._recordsPerBar = Math.max(1, records.length * 4 / this.element.clientWidth);
var numberOfBars = Math.ceil(records.length / this._recordsPerBar);
Modified: trunk/Source/WebCore/inspector/front-end/TimelinePanel.js (109215 => 109216)
--- trunk/Source/WebCore/inspector/front-end/TimelinePanel.js 2012-02-29 15:46:12 UTC (rev 109215)
+++ trunk/Source/WebCore/inspector/front-end/TimelinePanel.js 2012-02-29 15:59:30 UTC (rev 109216)
@@ -94,7 +94,7 @@
this._expandElements.id = "orphan-expand-elements";
this._itemsGraphsElement.appendChild(this._expandElements);
- this._calculator = new WebInspector.TimelineCalculator();
+ this._calculator = new WebInspector.TimelineCalculator(this._presentationModel);
var shortRecordThresholdTitle = Number.secondsToString(WebInspector.TimelinePresentationModel.shortRecordThreshold);
this._showShortRecordsTitleText = WebInspector.UIString("Show the records that are shorter than %s", shortRecordThresholdTitle);
this._hideShortRecordsTitleText = WebInspector.UIString("Hide the records that are shorter than %s", shortRecordThresholdTitle);
@@ -425,7 +425,7 @@
var toggled = !this.toggleStartAtZeroButton.toggled
this._glueParentButton.disabled = toggled;
this.toggleStartAtZeroButton.toggled = toggled;
- this._calculator = toggled ? new WebInspector.TimelineStartAtZeroCalculator() : new WebInspector.TimelineCalculator();
+ this._calculator = toggled ? new WebInspector.TimelineFitInWindowCalculator(this._presentationModel) : new WebInspector.TimelineCalculator(this._presentationModel);
this._presentationModel.setGlueRecords(this._glueParentButton.toggled && !this.toggleStartAtZeroButton.toggled);
this._repopulateRecords();
this._overviewPane.setStartAtZero(toggled);
@@ -556,8 +556,12 @@
this._overviewPane.update(this._rootRecord().children, this._showShortEvents);
- if (!this._boundariesAreValid)
- this._updateBoundaries();
+ if (!this._boundariesAreValid) {
+ var min = this._presentationModel.minimumRecordTime();
+ var max = this._presentationModel.maximumRecordTime();
+ this._calculator.setWindow(min + (max - min) * this._overviewPane.windowLeft(), min + (max - min) * this._overviewPane.windowRight());
+ }
+
var recordsInWindowCount = this._refreshRecords(!this._boundariesAreValid);
this._updateRecordsCounter(recordsInWindowCount);
if(!this._boundariesAreValid)
@@ -567,18 +571,6 @@
this._boundariesAreValid = true;
},
- _updateBoundaries: function()
- {
- this._calculator.reset();
- this._calculator.windowLeft = this._overviewPane.windowLeft();
- this._calculator.windowRight = this._overviewPane.windowRight();
-
- for (var i = 0; i < this._rootRecord().children.length; ++i)
- this._calculator.updateBoundaries(this._rootRecord().children[i]);
-
- this._calculator.calculateWindow();
- },
-
revealRecordAt: function(time)
{
if (this._startAtZero)
@@ -612,6 +604,7 @@
_refreshRecords: function(updateBoundaries)
{
var recordsInWindow = this._presentationModel.filteredRecords();
+ this._calculator.setRecords(recordsInWindow);
// Calculate the visible area.
this._scrollTop = this._containerElement.scrollTop;
@@ -693,7 +686,7 @@
get timelinePaddingLeft()
{
- return this._calculator.windowLeft === 0 ? this._expandOffset : 0;
+ return !this._overviewPane.windowLeft() ? this._expandOffset : 0;
},
_adjustScrollPosition: function(totalHeight)
@@ -755,12 +748,11 @@
/**
* @constructor
+ * @param {WebInspector.TimelinePresentationModel} presentationModel
*/
-WebInspector.TimelineCalculator = function()
+WebInspector.TimelineCalculator = function(presentationModel)
{
- this.reset();
- this.windowLeft = 0.0;
- this.windowRight = 1.0;
+ this._presentationModel = presentationModel;
}
WebInspector.TimelineCalculator.prototype = {
@@ -789,106 +781,57 @@
return {left: left, width: width, widthWithChildren: widthWithChildren, cpuWidth: cpuWidth};
},
- calculateWindow: function()
+ setWindow: function(minimumBoundary, maximumBoundary)
{
- this.minimumBoundary = this._absoluteMinimumBoundary + this.windowLeft * (this._absoluteMaximumBoundary - this._absoluteMinimumBoundary);
- this.maximumBoundary = this._absoluteMinimumBoundary + this.windowRight * (this._absoluteMaximumBoundary - this._absoluteMinimumBoundary);
+ this.minimumBoundary = minimumBoundary;
+ this.maximumBoundary = maximumBoundary;
this.boundarySpan = this.maximumBoundary - this.minimumBoundary;
},
- reset: function()
+ setRecords: function(records)
{
- this._absoluteMinimumBoundary = -1;
- this._absoluteMaximumBoundary = -1;
},
- updateBoundaries: function(record)
+ formatTime: function(value)
{
- var lowerBound = record.startTime;
- if (this._absoluteMinimumBoundary === -1 || lowerBound < this._absoluteMinimumBoundary)
- this._absoluteMinimumBoundary = lowerBound;
-
- const minimumTimeFrame = 0.1;
- const minimumDeltaForZeroSizeEvents = 0.01;
- var upperBound = Math.max(record.lastChildEndTime + minimumDeltaForZeroSizeEvents, lowerBound + minimumTimeFrame);
- if (this._absoluteMaximumBoundary === -1 || upperBound > this._absoluteMaximumBoundary)
- this._absoluteMaximumBoundary = upperBound;
- },
-
- formatValue: function(value)
- {
- return Number.secondsToString(value + this.minimumBoundary - this._absoluteMinimumBoundary);
+ return Number.secondsToString(value + this.minimumBoundary - this._presentationModel.minimumRecordTime());
}
}
/**
* @constructor
+ * @param {WebInspector.TimelinePresentationModel} presentationModel
* @extends WebInspector.TimelineCalculator
*/
-WebInspector.TimelineStartAtZeroCalculator = function()
+WebInspector.TimelineFitInWindowCalculator = function(presentationModel)
{
- this.reset();
- this.windowLeft = 0.0;
- this.windowRight = 1.0;
+ WebInspector.TimelineCalculator.call(this, presentationModel);
}
-WebInspector.TimelineStartAtZeroCalculator.prototype = {
- computeBarGraphPercentages: function(record)
+WebInspector.TimelineFitInWindowCalculator.prototype = {
+ setWindow: function(minimumBoundary, maximumBoundary)
{
- var scale = 100 / this.maximumBoundary;
- return {
- start: record._initiatorOffset * scale,
- end: (record._initiatorOffset + record.endTime - record.startTime) * scale,
- endWithChildren: (record._initiatorOffset + record.lastChildEndTime - record.startTime) * scale
- };
},
- computeBarGraphWindowPosition: function(record, clientWidth)
+ setRecords: function(records)
{
- const minWidth = 5;
- const borderWidth = 4;
- var workingArea = clientWidth - minWidth - borderWidth;
- var percentages = this.computeBarGraphPercentages(record);
- var left = percentages.start / 100 * workingArea;
- var width = (percentages.end - percentages.start) / 100 * workingArea + minWidth;
- var widthWithChildren = (percentages.endWithChildren - percentages.start) / 100 * workingArea;
- if (percentages.endWithChildren > percentages.end)
- widthWithChildren += borderWidth + minWidth;
+ this.minimumBoundary = -1;
+ this.maximumBoundary = -1;
- return {left: left, width: width, widthWithChildren: widthWithChildren};
- },
-
- calculateWindow: function()
- {
- this.minimumBoundary = this._absoluteMinimumBoundary;
- this.maximumBoundary = this._absoluteMaximumBoundary * 1.05;
- this.boundarySpan = this.maximumBoundary >= 0 ? this.maximumBoundary : 0;
- },
-
- reset: function()
- {
- this._absoluteMinimumBoundary = -1;
- this._absoluteMaximumBoundary = -1;
- },
-
- updateBoundaries: function(record)
- {
- var lowerBound = record.startTime;
- if (this._absoluteMinimumBoundary === -1 || lowerBound < this._absoluteMinimumBoundary)
- this._absoluteMinimumBoundary = lowerBound;
-
- const minimumTimeFrame = 0.001;
- var upperBound = Math.max(record.endTime - record.startTime, minimumTimeFrame);
- if (this._absoluteMaximumBoundary === -1 || upperBound > this._absoluteMaximumBoundary)
- this._absoluteMaximumBoundary = upperBound;
- },
-
- formatValue: function(value)
- {
- return Number.secondsToString(value, true);
+ var boundarySpan = 0;
+ for (var i = 0; i < records.length; ++i) {
+ var record = records[i];
+ if (this.minimumBoundary == -1 || record.startTime < this.minimumBoundary)
+ this.minimumBoundary = record.startTime;
+ if (this.maximumBoundary == -1 || record.endTime > this.maximumBoundary)
+ this.maximumBoundary = record.endTime;
+ }
+ this.boundarySpan = this.maximumBoundary - this.minimumBoundary;
}
-};
+}
+WebInspector.TimelineFitInWindowCalculator.prototype.__proto__ = WebInspector.TimelineCalculator.prototype;
+
/**
* @constructor
*/
Modified: trunk/Source/WebCore/inspector/front-end/TimelinePresentationModel.js (109215 => 109216)
--- trunk/Source/WebCore/inspector/front-end/TimelinePresentationModel.js 2012-02-29 15:46:12 UTC (rev 109215)
+++ trunk/Source/WebCore/inspector/front-end/TimelinePresentationModel.js 2012-02-29 15:59:30 UTC (rev 109216)
@@ -431,7 +431,7 @@
contentHelper._appendElementRow(WebInspector.UIString("Aggregated Time"), this._generateAggregatedInfo());
}
var text = WebInspector.UIString("%s (at %s)", Number.secondsToString(this._lastChildEndTime - this.startTime, true),
- calculator.formatValue(this.startTime - calculator.minimumBoundary));
+ Number.secondsToString(this.startTime - this._presentationModel.minimumRecordTime()));
contentHelper._appendTextRow(WebInspector.UIString("Duration"), text);
const recordTypes = WebInspector.TimelineModel.RecordType;