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

Unified Diff: third_party/WebKit/Source/devtools/front_end/sources/UISourceCodeFrame.js

Issue 1748993002: DevTools: Initial implementation of line-level CPU profile. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove JSSF to sdk dependency Created 4 years, 10 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/sources/UISourceCodeFrame.js
diff --git a/third_party/WebKit/Source/devtools/front_end/sources/UISourceCodeFrame.js b/third_party/WebKit/Source/devtools/front_end/sources/UISourceCodeFrame.js
index df56d748899a2be33b825c6110a4fb8679790baa..03b913534cb7a1c5bc4e979a9a85628667851d40 100644
--- a/third_party/WebKit/Source/devtools/front_end/sources/UISourceCodeFrame.js
+++ b/third_party/WebKit/Source/devtools/front_end/sources/UISourceCodeFrame.js
@@ -41,6 +41,7 @@ WebInspector.UISourceCodeFrame = function(uiSourceCode)
this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.WorkingCopyCommitted, this._onWorkingCopyCommitted, this);
this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.MessageAdded, this._onMessageAdded, this);
this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.MessageRemoved, this._onMessageRemoved, this);
+ this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.ProfileInfoUpdated, this._updateProfileInfo, this);
this._updateStyle();
this._errorPopoverHelper = new WebInspector.PopoverHelper(this.element, this._getErrorAnchor.bind(this), this._showErrorPopover.bind(this));
@@ -118,6 +119,7 @@ WebInspector.UISourceCodeFrame.prototype = {
WebInspector.SourceFrame.prototype.onTextEditorContentLoaded.call(this);
for (var message of this._uiSourceCode.messages())
this._addMessageToSource(message);
+ this._updateProfileInfo();
},
/**
@@ -330,6 +332,20 @@ WebInspector.UISourceCodeFrame.prototype = {
}
},
+ _updateProfileInfo: function()
+ {
+ this._textEditor.resetProfileInfo();
+ var profileInfo = this._uiSourceCode.profileInfo();
+ if (!profileInfo)
+ return;
+ for (var lineInfo of profileInfo) {
+ var lineNumber = lineInfo[0] - 1;
+ var time = lineInfo[1];
+ var intensity = Number.constrain(Math.log10(1 + 2 * time) / 5, 0.02, 1);
lushnikov 2016/03/02 03:19:13 A thought: maybe consider intensity relative to th
alph 2016/03/02 18:34:34 I'll consider it for the next patch. Not sure thou
+ this._textEditor.addProfileInfo(lineNumber, WebInspector.UIString("%.1f\xa0ms", time), intensity);
+ }
+ },
+
__proto__: WebInspector.SourceFrame.prototype
}

Powered by Google App Engine
This is Rietveld 408576698