Chromium Code Reviews| 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); |
| + } |
| + }); |
| + } |
| +} |