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

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

Issue 1748993002: DevTools: Initial implementation of line-level CPU profile. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: added a test. 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 7cdc39252c448b7e16b557380db3dcd374154e7e..03ec7e47982fce15d8cf3c7ac2dc6cd979ace6ac 100644
--- a/third_party/WebKit/Source/devtools/front_end/timeline/TimelineUIUtils.js
+++ b/third_party/WebKit/Source/devtools/front_end/timeline/TimelineUIUtils.js
@@ -2101,3 +2101,34 @@ WebInspector.TimelineUIUtils.eventWarning = function(event, warningType)
}
return span;
}
+
+/**
+ * @constructor
+ * @implements {WebInspector.UISourceCodeFrame.LineDecorator}
+ */
+WebInspector.TimelineUIUtils.PerformanceLineDecorator = function()
+{
+}
+
+WebInspector.TimelineUIUtils.PerformanceLineDecorator.prototype = {
+ /**
+ * @override
+ * @param {!WebInspector.UISourceCode} uiSourceCode
+ * @param {!WebInspector.CodeMirrorTextEditor} textEditor
+ */
+ decorate: function(uiSourceCode, textEditor)
+ {
+ var type = "performance";
caseq 2016/03/11 22:52:06 nit: decoratorType. Also, consider @const.
alph 2016/03/12 00:47:54 Done.
+ var decorations = uiSourceCode.lineDecorations(type) || [];
+ textEditor.operation(() => {
caseq 2016/03/11 22:52:05 nit: extract named function?
alph 2016/03/12 00:47:54 Done.
+ textEditor.resetGutterDecorations(type);
+ for (var decoration of decorations) {
+ var data = /** @type {!{text: string, intensity: number}} */ (decoration.data());
+ var element = createElementWithClass("div", "text-editor-line-marker-performance");
+ element.textContent = data.text;
+ element.style.backgroundColor = `rgba(255, 0, 0, ${data.intensity.toFixed(3)})`;
+ textEditor.setGutterDecoration(decoration.line(), type, element);
+ }
+ });
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698