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

Unified Diff: third_party/WebKit/Source/devtools/front_end/source_frame/CodeMirrorTextEditor.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/source_frame/CodeMirrorTextEditor.js
diff --git a/third_party/WebKit/Source/devtools/front_end/source_frame/CodeMirrorTextEditor.js b/third_party/WebKit/Source/devtools/front_end/source_frame/CodeMirrorTextEditor.js
index 8b6730246bfd24ec7e530708cf48f232c02e88e4..5ef29d5014453ee66888e7c815bc44e9a77917c2 100644
--- a/third_party/WebKit/Source/devtools/front_end/source_frame/CodeMirrorTextEditor.js
+++ b/third_party/WebKit/Source/devtools/front_end/source_frame/CodeMirrorTextEditor.js
@@ -1118,6 +1118,32 @@ WebInspector.CodeMirrorTextEditor.prototype = {
/**
* @param {number} lineNumber
+ * @param {string} text
+ * @param {number} intensity
+ */
+ addProfileInfo: function(lineNumber, text, intensity)
+ {
+ if (!this._hasProfileInfo)
+ this._codeMirror.setOption("gutters", ["CodeMirror-linenumbers", "CodeMirror-profile-info"]);
lushnikov 2016/03/02 03:19:12 isn't refresh needed here as well?
alph 2016/03/02 18:34:34 It works without it, but I'll add one to be on the
+ this._hasProfileInfo = true;
+ var testElement = createElementWithClass("div", "CodeMirror-profile-line-info");
+ testElement.textContent = text;
+ testElement.style.backgroundColor = `rgba(255, 0, 0, ${intensity.toFixed(3)})`;
lushnikov 2016/03/02 03:19:12 yay, fancy strings!
+ this._codeMirror.setGutterMarker(lineNumber, "CodeMirror-profile-info", testElement);
+ },
+
+ resetProfileInfo: function()
+ {
+ if (!this._hasProfileInfo)
+ return;
+ this._hasProfileInfo = false;
+ this._codeMirror.clearGutter("CodeMirror-profile-info");
+ this._codeMirror.setOption("gutters", ["CodeMirror-linenumbers"]);
+ this._codeMirror.refresh();
+ },
+
+ /**
+ * @param {number} lineNumber
* @param {number} columnNumber
*/
setExecutionLocation: function(lineNumber, columnNumber)

Powered by Google App Engine
This is Rietveld 408576698