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

Unified Diff: Source/devtools/front_end/components/FlameChart.js

Issue 696703003: DevTools: implement search for CPUProfiler FlameChart view (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: comments addressed Created 6 years, 1 month 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/components/FlameChart.js
diff --git a/Source/devtools/front_end/components/FlameChart.js b/Source/devtools/front_end/components/FlameChart.js
index b90952a97cefe05933c975d3779304da0be7c624..15cd67d576ee0de431f622e800e0ec4aa246bd05 100644
--- a/Source/devtools/front_end/components/FlameChart.js
+++ b/Source/devtools/front_end/components/FlameChart.js
@@ -446,6 +446,31 @@ WebInspector.FlameChart.prototype = {
}
},
+ _revealEntry: function(entryIndex)
+ {
+ var timelineData = this._timelineData();
+ if (!timelineData)
+ return;
+ var entryStartTime = timelineData.entryStartTimes[entryIndex];
+ var entryTotalTime = timelineData.entryTotalTimes[entryIndex];
+ var entryEndTime = entryStartTime + entryTotalTime;
+ var minEntryTimeWindow = Math.min(entryTotalTime, this._timeWindowRight - this._timeWindowLeft);
+
+ var y = this._levelToHeight(timelineData.entryLevels[entryIndex]);
+ if (y < this._vScrollElement.scrollTop)
+ this._vScrollElement.scrollTop = y;
+ else if (y > this._vScrollElement.scrollTop + this._offsetHeight + this._barHeightDelta)
+ this._vScrollElement.scrollTop = y - this._offsetHeight - this._barHeightDelta;
+
+ if (this._timeWindowLeft > entryEndTime) {
+ var delta = this._timeWindowLeft - entryEndTime + minEntryTimeWindow;
+ this._flameChartDelegate.requestWindowTimes(this._timeWindowLeft - delta, this._timeWindowRight - delta);
+ } else if (this._timeWindowRight < entryStartTime) {
+ var delta = entryStartTime - this._timeWindowRight + minEntryTimeWindow;
+ this._flameChartDelegate.requestWindowTimes(this._timeWindowLeft + delta, this._timeWindowRight + delta);
+ }
+ },
+
/**
* @param {number} startTime
* @param {number} endTime
@@ -1110,6 +1135,7 @@ WebInspector.FlameChart.prototype = {
setSelectedEntry: function(entryIndex)
{
this._selectedEntryIndex = entryIndex;
+ this._revealEntry(entryIndex);
this._updateElementPosition(this._selectedElement, this._selectedEntryIndex);
},

Powered by Google App Engine
This is Rietveld 408576698