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

Side by Side 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * Copyright (C) 2012 Intel Inc. All rights reserved. 3 * Copyright (C) 2012 Intel Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 2083 matching lines...) Expand 10 before | Expand all | Expand 10 after
2094 case warnings.V8Deopt: 2094 case warnings.V8Deopt:
2095 span.appendChild(WebInspector.linkifyURLAsNode("https://github.com/Googl eChrome/devtools-docs/issues/53", 2095 span.appendChild(WebInspector.linkifyURLAsNode("https://github.com/Googl eChrome/devtools-docs/issues/53",
2096 WebInspector.UIString("Not optimized"), undefined, true)); 2096 WebInspector.UIString("Not optimized"), undefined, true));
2097 span.createTextChild(WebInspector.UIString(": %s", eventData["deoptReaso n"])); 2097 span.createTextChild(WebInspector.UIString(": %s", eventData["deoptReaso n"]));
2098 break; 2098 break;
2099 default: 2099 default:
2100 console.assert(false, "Unhandled TimelineModel.WarningType"); 2100 console.assert(false, "Unhandled TimelineModel.WarningType");
2101 } 2101 }
2102 return span; 2102 return span;
2103 } 2103 }
2104
2105 /**
2106 * @constructor
2107 * @implements {WebInspector.UISourceCodeFrame.LineDecorator}
2108 */
2109 WebInspector.TimelineUIUtils.PerformanceLineDecorator = function()
2110 {
2111 }
2112
2113 WebInspector.TimelineUIUtils.PerformanceLineDecorator.prototype = {
2114 /**
2115 * @override
2116 * @param {!WebInspector.UISourceCode} uiSourceCode
2117 * @param {!WebInspector.CodeMirrorTextEditor} textEditor
2118 */
2119 decorate: function(uiSourceCode, textEditor)
2120 {
2121 var type = "performance";
caseq 2016/03/11 22:52:06 nit: decoratorType. Also, consider @const.
alph 2016/03/12 00:47:54 Done.
2122 var decorations = uiSourceCode.lineDecorations(type) || [];
2123 textEditor.operation(() => {
caseq 2016/03/11 22:52:05 nit: extract named function?
alph 2016/03/12 00:47:54 Done.
2124 textEditor.resetGutterDecorations(type);
2125 for (var decoration of decorations) {
2126 var data = /** @type {!{text: string, intensity: number}} */ (de coration.data());
2127 var element = createElementWithClass("div", "text-editor-line-ma rker-performance");
2128 element.textContent = data.text;
2129 element.style.backgroundColor = `rgba(255, 0, 0, ${data.intensit y.toFixed(3)})`;
2130 textEditor.setGutterDecoration(decoration.line(), type, element) ;
2131 }
2132 });
2133 }
2134 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698