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

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: addressing comments. 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.type = "performance";
2114
2115 WebInspector.TimelineUIUtils.PerformanceLineDecorator.prototype = {
2116 /**
2117 * @override
2118 * @param {!WebInspector.UISourceCode} uiSourceCode
2119 * @param {!WebInspector.CodeMirrorTextEditor} textEditor
2120 */
2121 decorate: function(uiSourceCode, textEditor)
2122 {
2123 var type = WebInspector.TimelineUIUtils.PerformanceLineDecorator.type;
2124 var decorations = uiSourceCode.lineDecorations(type) || [];
2125 textEditor.resetGutterDecorations(type);
2126 for (var decoration of decorations) {
2127 var time = /** @type {number} */ (decoration.data());
2128 var text = WebInspector.UIString("%.1f\xa0ms", time);
2129 var intensity = Number.constrain(Math.log10(1 + 2 * time) / 5, 0.02, 1);
2130 var element = createElementWithClass("div", "text-editor-line-marker -performance");
2131 element.textContent = text;
2132 element.style.backgroundColor = `rgba(255, 0, 0, ${intensity.toFixed (3)})`;
2133 textEditor.setGutterDecoration(decoration.line(), decoration.type(), element);
2134 }
2135 }
2136 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698