Index: Source/devtools/blink/chromeServerProfile/Default/Cache/f_000068 |
diff --git a/Source/devtools/front_end/FlameChart.js b/Source/devtools/blink/chromeServerProfile/Default/Cache/f_000068 |
similarity index 90% |
copy from Source/devtools/front_end/FlameChart.js |
copy to Source/devtools/blink/chromeServerProfile/Default/Cache/f_000068 |
index 6fbdcf63c199ed79bcb5e452d7f7ca9740d42dfd..464639d38855fa9c1fe83ac7eb792335eb545771 100644 |
--- a/Source/devtools/front_end/FlameChart.js |
+++ b/Source/devtools/blink/chromeServerProfile/Default/Cache/f_000068 |
@@ -38,7 +38,7 @@ WebInspector.FlameChartDelegate.prototype = { |
* @param {number} startTime |
* @param {number} endTime |
*/ |
- requestWindowTimes: function(startTime, endTime) { } |
+ requestWindowTimes: function(startTime, endTime) { }, |
} |
/** |
@@ -84,8 +84,6 @@ WebInspector.FlameChart = function(dataProvider, flameChartDelegate, isTopDown, |
this._barHeightDelta = this._isTopDown ? -this._barHeight : this._barHeight; |
this._minWidth = 1; |
this._paddingLeft = this._dataProvider.paddingLeft(); |
- this._markerPadding = 2; |
- this._markerRadius = this._barHeight / 2 - this._markerPadding; |
this._highlightedEntryIndex = -1; |
this._selectedEntryIndex = -1; |
this._textWidth = {}; |
@@ -214,7 +212,7 @@ WebInspector.FlameChartDataProvider.prototype = { |
/** |
* @return {number} |
*/ |
- paddingLeft: function() { }, |
+ paddingLeft: function() { } |
} |
WebInspector.FlameChart.Events = { |
@@ -487,30 +485,15 @@ WebInspector.FlameChart.prototype = { |
if (!timelineData) |
return -1; |
var cursorTimeOffset = this._cursorTime(x) - this._zeroTime; |
- var cursorLevel; |
- var offsetFromLevel; |
- if (this._isTopDown) { |
- cursorLevel = Math.floor((y - WebInspector.FlameChart.DividersBarHeight) / this._barHeight); |
- offsetFromLevel = y - WebInspector.FlameChart.DividersBarHeight - cursorLevel * this._barHeight; |
- } else { |
- cursorLevel = Math.floor((this._canvas.height / window.devicePixelRatio - y) / this._barHeight); |
- offsetFromLevel = this._canvas.height / window.devicePixelRatio - cursorLevel * this._barHeight; |
- } |
+ var cursorLevel = this._isTopDown ? Math.floor((y - WebInspector.FlameChart.DividersBarHeight) / this._barHeight) : Math.floor((this._canvas.height / window.devicePixelRatio - y) / this._barHeight); |
var entryOffsets = timelineData.entryOffsets; |
var entryTotalTimes = timelineData.entryTotalTimes; |
var entryLevels = timelineData.entryLevels; |
var length = entryOffsets.length; |
- var markerHitThreshold = Math.sqrt(Math.pow(this._markerRadius, 2) - Math.pow(this._barHeight / 2 - offsetFromLevel, 2)) * this._pixelToTime; |
for (var i = 0; i < length; ++i) { |
var entryLevel = entryLevels[i]; |
if (cursorLevel !== entryLevel) |
continue; |
- if (isNaN(entryTotalTimes[i])) { |
- if (Math.abs(cursorTimeOffset - entryOffsets[i]) < markerHitThreshold) |
- return i; |
- if (cursorTimeOffset < entryOffsets[i]) |
- return -1; |
- } |
if (cursorTimeOffset < entryOffsets[i]) |
return -1; |
if (cursorTimeOffset < (entryOffsets[i] + entryTotalTimes[i])) |
@@ -544,10 +527,8 @@ WebInspector.FlameChart.prototype = { |
var entryOffsets = timelineData.entryOffsets; |
var entryLevels = timelineData.entryLevels; |
- var titleIndices = new Uint32Array(timelineData.entryTotalTimes); |
- var nextTitleIndex = 0; |
- var markerIndices = new Uint32Array(timelineData.entryTotalTimes); |
- var nextMarkerIndex = 0; |
+ var titleIndexes = new Uint32Array(timelineData.entryTotalTimes); |
+ var lastTitleIndex = 0; |
var textPadding = this._dataProvider.textPadding(); |
this._minTextWidth = 2 * textPadding + this._measureWidth(context, "\u2026"); |
var minTextWidth = this._minTextWidth; |
@@ -586,7 +567,7 @@ WebInspector.FlameChart.prototype = { |
} |
// skip if it is not visible (left side). |
- var entryOffsetRight = entryOffset + (isNaN(entryTotalTimes[entryIndex]) ? 0 : entryTotalTimes[entryIndex]); |
+ var entryOffsetRight = entryOffset + entryTotalTimes[entryIndex]; |
if (entryOffsetRight < timeWindowLeft) |
continue; |
@@ -624,34 +605,17 @@ WebInspector.FlameChart.prototype = { |
var barWidth = Math.max(barRight - barX, minWidth); |
var barLevel = entryLevels[entryIndex]; |
var barY = this._levelToHeight(barLevel); |
- if (isNaN(entryTotalTimes[entryIndex])) { |
- context.arc(barX, barY + barHeight / 2, this._markerRadius, 0, Math.PI * 2); |
- markerIndices[nextMarkerIndex++] = entryIndex; |
- } else { |
- context.rect(barX, barY, barWidth, barHeight); |
- if (barWidth > minTextWidth || this._dataProvider.forceDecoration(entryIndex)) |
- titleIndices[nextTitleIndex++] = entryIndex; |
- } |
+ context.rect(barX, barY, barWidth, barHeight); |
+ if (barWidth > minTextWidth || this._dataProvider.forceDecoration(entryIndex)) |
+ titleIndexes[lastTitleIndex++] = entryIndex; |
} |
context.fill(); |
} |
- context.strokeStyle = "rgb(0, 0, 0)"; |
- for (var m = 0; m < nextMarkerIndex; ++m) { |
- var entryIndex = markerIndices[m]; |
- var entryOffset = entryOffsets[entryIndex]; |
- var barX = this._offsetToPosition(entryOffset); |
- var barLevel = entryLevels[entryIndex]; |
- var barY = this._levelToHeight(barLevel); |
- context.beginPath(); |
- context.arc(barX, barY + barHeight / 2, this._markerRadius, 0, Math.PI * 2); |
- context.stroke(); |
- } |
- |
context.textBaseline = "alphabetic"; |
- for (var i = 0; i < nextTitleIndex; ++i) { |
- var entryIndex = titleIndices[i]; |
+ for (var i = 0; i < lastTitleIndex; ++i) { |
+ var entryIndex = titleIndexes[i]; |
var entryOffset = entryOffsets[entryIndex]; |
var barX = this._offsetToPosition(entryOffset); |
var barRight = this._offsetToPosition(entryOffset + entryTotalTimes[entryIndex]); |
@@ -659,16 +623,16 @@ WebInspector.FlameChart.prototype = { |
var barLevel = entryLevels[entryIndex]; |
var barY = this._levelToHeight(barLevel); |
var text = this._dataProvider.entryTitle(entryIndex); |
- if (text && text.length) { |
- context.font = this._dataProvider.entryFont(entryIndex); |
+ if (text && text.length) |
text = this._prepareText(context, text, barWidth - 2 * textPadding); |
- } |
if (this._dataProvider.decorateEntry(entryIndex, context, text, barX, barY, barWidth, barHeight, offsetToPosition)) |
continue; |
+ |
if (!text || !text.length) |
continue; |
+ context.font = this._dataProvider.entryFont(entryIndex); |
context.fillStyle = this._dataProvider.textColor(entryIndex); |
context.fillText(text, barX + textPadding, textBaseHeight - barLevel * this._barHeightDelta); |
} |
@@ -772,16 +736,10 @@ WebInspector.FlameChart.prototype = { |
if (text.length > 20) |
return context.measureText(text).width; |
- var font = context.font; |
- var textWidths = this._textWidth[font]; |
- if (!textWidths) { |
- textWidths = {}; |
- this._textWidth[font] = textWidths; |
- } |
- var width = textWidths[text]; |
+ var width = this._textWidth[text]; |
if (!width) { |
width = context.measureText(text).width; |
- textWidths[text] = width; |
+ this._textWidth[text] = width; |
} |
return width; |
}, |