Chromium Code Reviews| Index: Source/devtools/front_end/timeline/TracingTimelineUIUtils.js |
| diff --git a/Source/devtools/front_end/timeline/TracingTimelineUIUtils.js b/Source/devtools/front_end/timeline/TracingTimelineUIUtils.js |
| index 84bb4105ae56aa4a107002f2c4a89927f133e380..80ad6c8eed51d3cf2285f4bab570425ef031731b 100644 |
| --- a/Source/devtools/front_end/timeline/TracingTimelineUIUtils.js |
| +++ b/Source/devtools/front_end/timeline/TracingTimelineUIUtils.js |
| @@ -9,6 +9,95 @@ |
| WebInspector.TracingTimelineUIUtils = function() { } |
| /** |
| + * @return {!Object.<string, !{title: string, category: !WebInspector.TimelineCategory}>} |
| + */ |
| +WebInspector.TracingTimelineUIUtils._initEventStyles = function() |
| +{ |
| + if (WebInspector.TracingTimelineUIUtils._eventStylesMap) |
| + return WebInspector.TracingTimelineUIUtils._eventStylesMap; |
| + |
| + var recordTypes = WebInspector.TimelineTraceEventBindings.RecordType; |
| + var categories = WebInspector.TimelineUIUtils.categories(); |
| + |
| + var eventStyles = {}; |
| + eventStyles[recordTypes.Program] = { title: WebInspector.UIString("Other"), category: categories["other"] }; |
|
yurys
2014/06/04 06:56:52
Consider adding WebInspector.TracingTimelineUIUti
|
| + eventStyles[recordTypes.EventDispatch] = { title: WebInspector.UIString("Event"), category: categories["scripting"] }; |
| + eventStyles[recordTypes.RequestMainThreadFrame] = { title: WebInspector.UIString("Request Main Thread Frame"), category: categories["rendering"] }; |
| + eventStyles[recordTypes.BeginFrame] = { title: WebInspector.UIString("Frame Start"), category: categories["rendering"] }; |
| + eventStyles[recordTypes.BeginMainThreadFrame] = { title: WebInspector.UIString("Frame Start (main thread)"), category: categories["rendering"] }; |
| + eventStyles[recordTypes.DrawFrame] = { title: WebInspector.UIString("Draw Frame"), category: categories["rendering"] }; |
| + eventStyles[recordTypes.ScheduleStyleRecalculation] = { title: WebInspector.UIString("Schedule Style Recalculation"), category: categories["rendering"] }; |
| + eventStyles[recordTypes.RecalculateStyles] = { title: WebInspector.UIString("Recalculate Style"), category: categories["rendering"] }; |
| + eventStyles[recordTypes.InvalidateLayout] = { title: WebInspector.UIString("Invalidate Layout"), category: categories["rendering"] }; |
| + eventStyles[recordTypes.Layout] = { title: WebInspector.UIString("Layout"), category: categories["rendering"] }; |
| + eventStyles[recordTypes.PaintSetup] = { title: WebInspector.UIString("Paint Setup"), category: categories["painting"] }; |
| + eventStyles[recordTypes.Paint] = { title: WebInspector.UIString("Paint"), category: categories["painting"] }; |
| + eventStyles[recordTypes.Rasterize] = { title: WebInspector.UIString("Paint"), category: categories["painting"] }; |
| + eventStyles[recordTypes.RasterTask] = { title: WebInspector.UIString("Paint"), category: categories["painting"] }; |
| + eventStyles[recordTypes.ScrollLayer] = { title: WebInspector.UIString("Scroll"), category: categories["rendering"] }; |
| + eventStyles[recordTypes.CompositeLayers] = { title: WebInspector.UIString("Composite Layers"), category: categories["painting"] }; |
| + eventStyles[recordTypes.ParseHTML] = { title: WebInspector.UIString("Parse HTML"), category: categories["loading"] }; |
| + eventStyles[recordTypes.TimerInstall] = { title: WebInspector.UIString("Install Timer"), category: categories["scripting"] }; |
| + eventStyles[recordTypes.TimerRemove] = { title: WebInspector.UIString("Remove Timer"), category: categories["scripting"] }; |
| + eventStyles[recordTypes.TimerFire] = { title: WebInspector.UIString("Timer Fired"), category: categories["scripting"] }; |
| + eventStyles[recordTypes.XHRReadyStateChange] = { title: WebInspector.UIString("XHR Ready State Change"), category: categories["scripting"] }; |
| + eventStyles[recordTypes.XHRLoad] = { title: WebInspector.UIString("XHR Load"), category: categories["scripting"] }; |
| + eventStyles[recordTypes.EvaluateScript] = { title: WebInspector.UIString("Evaluate Script"), category: categories["scripting"] }; |
| + eventStyles[recordTypes.MarkLoad] = { title: WebInspector.UIString("Load event"), category: categories["scripting"] }; |
| + eventStyles[recordTypes.MarkDOMContent] = { title: WebInspector.UIString("DOMContentLoaded event"), category: categories["scripting"] }; |
| + eventStyles[recordTypes.MarkFirstPaint] = { title: WebInspector.UIString("First paint"), category: categories["painting"] }; |
| + eventStyles[recordTypes.TimeStamp] = { title: WebInspector.UIString("Stamp"), category: categories["scripting"] }; |
| + eventStyles[recordTypes.ConsoleTime] = { title: WebInspector.UIString("Console Time"), category: categories["scripting"] }; |
| + eventStyles[recordTypes.ResourceSendRequest] = { title: WebInspector.UIString("Send Request"), category: categories["loading"] }; |
| + eventStyles[recordTypes.ResourceReceiveResponse] = { title: WebInspector.UIString("Receive Response"), category: categories["loading"] }; |
| + eventStyles[recordTypes.ResourceFinish] = { title: WebInspector.UIString("Finish Loading"), category: categories["loading"] }; |
| + eventStyles[recordTypes.ResourceReceivedData] = { title: WebInspector.UIString("Receive Data"), category: categories["loading"] }; |
| + eventStyles[recordTypes.FunctionCall] = { title: WebInspector.UIString("Function Call"), category: categories["scripting"] }; |
| + eventStyles[recordTypes.GCEvent] = { title: WebInspector.UIString("GC Event"), category: categories["scripting"] }; |
| + eventStyles[recordTypes.JSFrame] = { title: WebInspector.UIString("JS Frame"), category: categories["scripting"] }; |
| + eventStyles[recordTypes.RequestAnimationFrame] = { title: WebInspector.UIString("Request Animation Frame"), category: categories["scripting"] }; |
| + eventStyles[recordTypes.CancelAnimationFrame] = { title: WebInspector.UIString("Cancel Animation Frame"), category: categories["scripting"] }; |
| + eventStyles[recordTypes.FireAnimationFrame] = { title: WebInspector.UIString("Animation Frame Fired"), category: categories["scripting"] }; |
| + eventStyles[recordTypes.WebSocketCreate] = { title: WebInspector.UIString("Create WebSocket"), category: categories["scripting"] }; |
| + eventStyles[recordTypes.WebSocketSendHandshakeRequest] = { title: WebInspector.UIString("Send WebSocket Handshake"), category: categories["scripting"] }; |
| + eventStyles[recordTypes.WebSocketReceiveHandshakeResponse] = { title: WebInspector.UIString("Receive WebSocket Handshake"), category: categories["scripting"] }; |
| + eventStyles[recordTypes.WebSocketDestroy] = { title: WebInspector.UIString("Destroy WebSocket"), category: categories["scripting"] }; |
| + eventStyles[recordTypes.EmbedderCallback] = { title: WebInspector.UIString("Embedder Callback"), category: categories["scripting"] }; |
| + eventStyles[recordTypes.DecodeImage] = { title: WebInspector.UIString("Image Decode"), category: categories["painting"] }; |
| + eventStyles[recordTypes.ResizeImage] = { title: WebInspector.UIString("Image Resize"), category: categories["painting"] }; |
| + |
| + WebInspector.TracingTimelineUIUtils._eventStylesMap = eventStyles; |
| + return eventStyles; |
| +} |
| + |
| +/** |
| + * @param {!WebInspector.TracingModel.Event} event |
| + * @return {!{title: string, category: !WebInspector.TimelineCategory}} |
| + */ |
| +WebInspector.TracingTimelineUIUtils.eventStyle = function(event) |
| +{ |
| + return WebInspector.TracingTimelineUIUtils.styleForTraceEvent(event.name); |
| +} |
| + |
| +/** |
| + * @param {string} name |
| + * @return {!{title: string, category: !WebInspector.TimelineCategory}} |
| + */ |
| +WebInspector.TracingTimelineUIUtils.styleForTraceEvent = function(name) |
| +{ |
| + var eventStyles = WebInspector.TracingTimelineUIUtils._initEventStyles(); |
| + var result = eventStyles[name]; |
| + if (!result) { |
| + result = { |
| + title: WebInspector.UIString("Unknown: %s", name), |
| + category: WebInspector.TimelineUIUtils.categories()["other"] |
| + }; |
| + eventStyles[name] = result; |
| + } |
| + return result; |
| +} |
| + |
| +/** |
| * @param {!WebInspector.TracingModel.Event} event |
| * @param {!WebInspector.Linkifier} linkifier |
| * @param {boolean} loadedFromFile |
| @@ -218,7 +307,7 @@ WebInspector.TracingTimelineUIUtils._buildTraceEventDetailsSynchronously = funct |
| var fragment = document.createDocumentFragment(); |
| var stats = WebInspector.TracingTimelineUIUtils._aggregatedStatsForTraceEvent(model, event); |
| var pieChart = stats.hasChildren ? |
| - WebInspector.TimelineUIUtils.generatePieChart(stats.aggregatedStats, WebInspector.TimelineUIUtils.styleForTimelineEvent(event.name).category, event.selfTime / 1000) : |
| + WebInspector.TimelineUIUtils.generatePieChart(stats.aggregatedStats, WebInspector.TracingTimelineUIUtils.styleForTraceEvent(event.name).category, event.selfTime / 1000) : |
| WebInspector.TimelineUIUtils.generatePieChart(stats.aggregatedStats); |
| fragment.appendChild(pieChart); |
| @@ -401,7 +490,7 @@ WebInspector.TracingTimelineUIUtils._aggregatedStatsForTraceEvent = function(mod |
| continue; |
| if (i > index) |
| hasChildren = true; |
| - var category = WebInspector.TimelineUIUtils.styleForTimelineEvent(nextEvent.name).category.name; |
| + var category = WebInspector.TracingTimelineUIUtils.styleForTraceEvent(nextEvent.name).category.name; |
| aggregatedStats[category] = (aggregatedStats[category] || 0) + nextEvent.selfTime / 1000; |
| } |
| } |