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

Unified Diff: third_party/WebKit/Source/devtools/front_end/timeline/TimelineUIUtils.js

Issue 1811773002: DevTools: Use live location for line level profile presentation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressing comments. Created 4 years, 9 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: third_party/WebKit/Source/devtools/front_end/timeline/TimelineUIUtils.js
diff --git a/third_party/WebKit/Source/devtools/front_end/timeline/TimelineUIUtils.js b/third_party/WebKit/Source/devtools/front_end/timeline/TimelineUIUtils.js
index 8cc41a4eb080f232f614668f6593c6f6015a3eaf..f9edcfb1d3fb5502c069fb4e8e397558bde1d7d8 100644
--- a/third_party/WebKit/Source/devtools/front_end/timeline/TimelineUIUtils.js
+++ b/third_party/WebKit/Source/devtools/front_end/timeline/TimelineUIUtils.js
@@ -2110,6 +2110,31 @@ WebInspector.TimelineUIUtils.eventWarning = function(event, warningType)
/**
* @constructor
+ * @param {!WebInspector.DebuggerModel.Location} rawLocation
+ * @param {number} time
+ */
+WebInspector.TimelineUIUtils.LineLevelProfilePresentation = function(rawLocation, time)
+{
+ this._time = time;
+ WebInspector.debuggerWorkspaceBinding.createLiveLocation(rawLocation, this.updateLocation.bind(this));
+}
+
+WebInspector.TimelineUIUtils.LineLevelProfilePresentation.prototype = {
+ /**
+ * @param {!WebInspector.LiveLocation} liveLocation
+ */
+ updateLocation: function(liveLocation)
+ {
+ if (this._uiLocation)
+ this._uiLocation.uiSourceCode.removeLineDecoration(this._uiLocation.lineNumber, WebInspector.TimelineUIUtils.PerformanceLineDecorator.type);
+ this._uiLocation = liveLocation.uiLocation();
+ if (this._uiLocation)
+ this._uiLocation.uiSourceCode.addLineDecoration(this._uiLocation.lineNumber, WebInspector.TimelineUIUtils.PerformanceLineDecorator.type, this._time);
+ }
+}
+
+/**
+ * @constructor
* @implements {WebInspector.UISourceCodeFrame.LineDecorator}
*/
WebInspector.TimelineUIUtils.PerformanceLineDecorator = function()
@@ -2127,9 +2152,11 @@ WebInspector.TimelineUIUtils.PerformanceLineDecorator.prototype = {
decorate: function(uiSourceCode, textEditor)
{
var type = WebInspector.TimelineUIUtils.PerformanceLineDecorator.type;
- var decorations = uiSourceCode.lineDecorations(type) || [];
+ var decorations = uiSourceCode.lineDecorations(type);
textEditor.resetGutterDecorations(type);
- for (var decoration of decorations) {
+ if (!decorations)
+ return;
+ for (var decoration of decorations.values()) {
var time = /** @type {number} */ (decoration.data());
var text = WebInspector.UIString("%.1f\xa0ms", time);
var intensity = Number.constrain(Math.log10(1 + 2 * time) / 5, 0.02, 1);

Powered by Google App Engine
This is Rietveld 408576698