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

Side by Side Diff: Source/devtools/front_end/timeline/TracingTimelineUIUtils.js

Issue 402113002: Draw marker events on Timeline flame chart (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @constructor 6 * @constructor
7 * @extends {WebInspector.TimelineUIUtils} 7 * @extends {WebInspector.TimelineUIUtils}
8 */ 8 */
9 WebInspector.TracingTimelineUIUtils = function() 9 WebInspector.TracingTimelineUIUtils = function()
10 { 10 {
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 eventStyles[recordTypes.RequestMainThreadFrame] = new WebInspector.TimelineR ecordStyle(WebInspector.UIString("Request Main Thread Frame"), categories["rende ring"], true); 205 eventStyles[recordTypes.RequestMainThreadFrame] = new WebInspector.TimelineR ecordStyle(WebInspector.UIString("Request Main Thread Frame"), categories["rende ring"], true);
206 eventStyles[recordTypes.BeginFrame] = new WebInspector.TimelineRecordStyle(W ebInspector.UIString("Frame Start"), categories["rendering"], true); 206 eventStyles[recordTypes.BeginFrame] = new WebInspector.TimelineRecordStyle(W ebInspector.UIString("Frame Start"), categories["rendering"], true);
207 eventStyles[recordTypes.BeginMainThreadFrame] = new WebInspector.TimelineRec ordStyle(WebInspector.UIString("Frame Start (main thread)"), categories["renderi ng"], true); 207 eventStyles[recordTypes.BeginMainThreadFrame] = new WebInspector.TimelineRec ordStyle(WebInspector.UIString("Frame Start (main thread)"), categories["renderi ng"], true);
208 eventStyles[recordTypes.DrawFrame] = new WebInspector.TimelineRecordStyle(We bInspector.UIString("Draw Frame"), categories["rendering"], true); 208 eventStyles[recordTypes.DrawFrame] = new WebInspector.TimelineRecordStyle(We bInspector.UIString("Draw Frame"), categories["rendering"], true);
209 eventStyles[recordTypes.ScheduleStyleRecalculation] = new WebInspector.Timel ineRecordStyle(WebInspector.UIString("Schedule Style Recalculation"), categories ["rendering"], true); 209 eventStyles[recordTypes.ScheduleStyleRecalculation] = new WebInspector.Timel ineRecordStyle(WebInspector.UIString("Schedule Style Recalculation"), categories ["rendering"], true);
210 eventStyles[recordTypes.RecalculateStyles] = new WebInspector.TimelineRecord Style(WebInspector.UIString("Recalculate Style"), categories["rendering"]); 210 eventStyles[recordTypes.RecalculateStyles] = new WebInspector.TimelineRecord Style(WebInspector.UIString("Recalculate Style"), categories["rendering"]);
211 eventStyles[recordTypes.InvalidateLayout] = new WebInspector.TimelineRecordS tyle(WebInspector.UIString("Invalidate Layout"), categories["rendering"], true); 211 eventStyles[recordTypes.InvalidateLayout] = new WebInspector.TimelineRecordS tyle(WebInspector.UIString("Invalidate Layout"), categories["rendering"], true);
212 eventStyles[recordTypes.Layout] = new WebInspector.TimelineRecordStyle(WebIn spector.UIString("Layout"), categories["rendering"]); 212 eventStyles[recordTypes.Layout] = new WebInspector.TimelineRecordStyle(WebIn spector.UIString("Layout"), categories["rendering"]);
213 eventStyles[recordTypes.PaintSetup] = new WebInspector.TimelineRecordStyle(W ebInspector.UIString("Paint Setup"), categories["painting"]); 213 eventStyles[recordTypes.PaintSetup] = new WebInspector.TimelineRecordStyle(W ebInspector.UIString("Paint Setup"), categories["painting"]);
214 eventStyles[recordTypes.UpdateLayer] = new WebInspector.TimelineRecordStyle( WebInspector.UIString("Update Layer"), categories["painting"], true); 214 eventStyles[recordTypes.UpdateLayer] = new WebInspector.TimelineRecordStyle( WebInspector.UIString("Update Layer"), categories["painting"], true);
215 eventStyles[recordTypes.UpdateLayerTree] = { title: WebInspector.UIString("U pdate Layer Tree"), category: categories["rendering"] }; 215 eventStyles[recordTypes.UpdateLayerTree] = new WebInspector.TimelineRecordSt yle(WebInspector.UIString("Update Layer Tree"), categories["rendering"], true);
216 eventStyles[recordTypes.Paint] = new WebInspector.TimelineRecordStyle(WebIns pector.UIString("Paint"), categories["painting"]); 216 eventStyles[recordTypes.Paint] = new WebInspector.TimelineRecordStyle(WebIns pector.UIString("Paint"), categories["painting"]);
217 eventStyles[recordTypes.Rasterize] = new WebInspector.TimelineRecordStyle(We bInspector.UIString("Paint"), categories["painting"]); 217 eventStyles[recordTypes.Rasterize] = new WebInspector.TimelineRecordStyle(We bInspector.UIString("Paint"), categories["painting"]);
218 eventStyles[recordTypes.RasterTask] = new WebInspector.TimelineRecordStyle(W ebInspector.UIString("Paint"), categories["painting"]); 218 eventStyles[recordTypes.RasterTask] = new WebInspector.TimelineRecordStyle(W ebInspector.UIString("Paint"), categories["painting"]);
219 eventStyles[recordTypes.ScrollLayer] = new WebInspector.TimelineRecordStyle( WebInspector.UIString("Scroll"), categories["rendering"]); 219 eventStyles[recordTypes.ScrollLayer] = new WebInspector.TimelineRecordStyle( WebInspector.UIString("Scroll"), categories["rendering"]);
220 eventStyles[recordTypes.CompositeLayers] = new WebInspector.TimelineRecordSt yle(WebInspector.UIString("Composite Layers"), categories["painting"]); 220 eventStyles[recordTypes.CompositeLayers] = new WebInspector.TimelineRecordSt yle(WebInspector.UIString("Composite Layers"), categories["painting"]);
221 eventStyles[recordTypes.ParseHTML] = new WebInspector.TimelineRecordStyle(We bInspector.UIString("Parse HTML"), categories["loading"]); 221 eventStyles[recordTypes.ParseHTML] = new WebInspector.TimelineRecordStyle(We bInspector.UIString("Parse HTML"), categories["loading"]);
222 eventStyles[recordTypes.TimerInstall] = new WebInspector.TimelineRecordStyle (WebInspector.UIString("Install Timer"), categories["scripting"]); 222 eventStyles[recordTypes.TimerInstall] = new WebInspector.TimelineRecordStyle (WebInspector.UIString("Install Timer"), categories["scripting"]);
223 eventStyles[recordTypes.TimerRemove] = new WebInspector.TimelineRecordStyle( WebInspector.UIString("Remove Timer"), categories["scripting"]); 223 eventStyles[recordTypes.TimerRemove] = new WebInspector.TimelineRecordStyle( WebInspector.UIString("Remove Timer"), categories["scripting"]);
224 eventStyles[recordTypes.TimerFire] = new WebInspector.TimelineRecordStyle(We bInspector.UIString("Timer Fired"), categories["scripting"]); 224 eventStyles[recordTypes.TimerFire] = new WebInspector.TimelineRecordStyle(We bInspector.UIString("Timer Fired"), categories["scripting"]);
225 eventStyles[recordTypes.XHRReadyStateChange] = new WebInspector.TimelineReco rdStyle(WebInspector.UIString("XHR Ready State Change"), categories["scripting"] ); 225 eventStyles[recordTypes.XHRReadyStateChange] = new WebInspector.TimelineReco rdStyle(WebInspector.UIString("XHR Ready State Change"), categories["scripting"] );
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 var eventStyles = WebInspector.TracingTimelineUIUtils._initEventStyles(); 276 var eventStyles = WebInspector.TracingTimelineUIUtils._initEventStyles();
277 var result = eventStyles[name]; 277 var result = eventStyles[name];
278 if (!result) { 278 if (!result) {
279 result = new WebInspector.TimelineRecordStyle(WebInspector.UIString("Unk nown: %s", name), WebInspector.TimelineUIUtils.categories()["other"]); 279 result = new WebInspector.TimelineRecordStyle(WebInspector.UIString("Unk nown: %s", name), WebInspector.TimelineUIUtils.categories()["other"]);
280 eventStyles[name] = result; 280 eventStyles[name] = result;
281 } 281 }
282 return result; 282 return result;
283 } 283 }
284 284
285 /** 285 /**
286 * @param {string} eventName
287 * @return {string}
288 */
289 WebInspector.TimelineUIUtilsImpl.markerEventColor = function(eventName)
290 {
291 var red = "rgb(255, 0, 0)";
292 var blue = "rgb(0, 0, 255)";
293 var orange = "rgb(255, 178, 23)";
294 var green = "rgb(0, 130, 0)";
295
296 var recordTypes = WebInspector.TracingTimelineModel.RecordType;
297 if (eventName === recordTypes.MarkDOMContent)
alph 2014/07/21 12:05:30 switch?
yurys 2014/07/21 13:49:48 Done.
298 return blue;
299 if (eventName === recordTypes.MarkLoad)
300 return red;
301 if (eventName === recordTypes.MarkFirstPaint)
302 return green;
303 if (eventName === recordTypes.TimeStamp)
304 return orange;
305 //else if (eventName === recordTypes.BeginFrame)
alph 2014/07/21 12:05:30 nuke?
yurys 2014/07/21 13:49:48 Done.
306 return green;
307 }
308
309 /**
286 * @param {!WebInspector.TracingTimelineModel.TraceEventRecord} record 310 * @param {!WebInspector.TracingTimelineModel.TraceEventRecord} record
287 * @return {string} 311 * @return {string}
288 */ 312 */
289 WebInspector.TracingTimelineUIUtils._recordTitle = function(record) 313 WebInspector.TracingTimelineUIUtils._recordTitle = function(record)
290 { 314 {
291 var event = record.traceEvent(); 315 var event = record.traceEvent();
292 if (event.name === WebInspector.TracingTimelineModel.RecordType.TimeStamp) 316 if (event.name === WebInspector.TracingTimelineModel.RecordType.TimeStamp)
293 return event.args.data["message"]; 317 return event.args.data["message"];
294 var title = WebInspector.TracingTimelineUIUtils.eventStyle(event).title; 318 var title = WebInspector.TracingTimelineUIUtils.eventStyle(event).title;
295 if (WebInspector.TracingTimelineUIUtils.isEventDivider(record)) { 319 if (WebInspector.TracingTimelineUIUtils.isEventDivider(record)) {
296 var startTime = Number.millisToString(record.startTime() - record.timeli neModel().minimumRecordTime()); 320 var startTime = Number.millisToString(record.startTime() - record.timeli neModel().minimumRecordTime());
297 return WebInspector.UIString("%s at %s", title, startTime); 321 return WebInspector.UIString("%s at %s", title, startTime);
298 } 322 }
299 return title; 323 return title;
300 } 324 }
301 325
302 /** 326 /**
327 * @param {!WebInspector.TracingModel.Event} event
328 * @param {!WebInspector.TracingTimelineModel} model
329 * @return {string}
330 */
331 WebInspector.TracingTimelineUIUtils.eventTitle = function(event, model)
332 {
333 if (event.name === WebInspector.TracingTimelineModel.RecordType.TimeStamp)
334 return event.args.data["message"];
335 var title = WebInspector.TracingTimelineUIUtils.eventStyle(event).title;
336 if (WebInspector.TracingTimelineUIUtils.isMarkerEvent(event)) {
337 var startTime = Number.millisToString(event.startTime - model.minimumRec ordTime());
338 return WebInspector.UIString("%s at %s", title, startTime);
339 }
340 return title;
341 }
342
343 /**
303 * @param {!WebInspector.TimelineModel.Record} record 344 * @param {!WebInspector.TimelineModel.Record} record
304 * @return {boolean} 345 * @return {boolean}
305 */ 346 */
306 WebInspector.TracingTimelineUIUtils.isEventDivider = function(record) 347 WebInspector.TracingTimelineUIUtils.isEventDivider = function(record)
307 { 348 {
308 var recordTypes = WebInspector.TracingTimelineModel.RecordType; 349 var recordTypes = WebInspector.TracingTimelineModel.RecordType;
309 if (record.type() === recordTypes.TimeStamp) 350 if (record.type() === recordTypes.TimeStamp)
310 return true; 351 return true;
311 if (record.type() === recordTypes.MarkFirstPaint) 352 if (record.type() === recordTypes.MarkFirstPaint)
312 return true; 353 return true;
313 if (record.type() === recordTypes.MarkDOMContent || record.type() === record Types.MarkLoad) 354 if (record.type() === recordTypes.MarkDOMContent || record.type() === record Types.MarkLoad)
314 return record.data()["isMainFrame"]; 355 return record.data()["isMainFrame"];
315 return false; 356 return false;
316 } 357 }
317 358
318 /** 359 /**
319 * @param {!WebInspector.TracingModel.Event} event 360 * @param {!WebInspector.TracingModel.Event} event
361 * @return {boolean}
362 */
363 WebInspector.TracingTimelineUIUtils.isMarkerEvent = function(event)
364 {
365 var recordTypes = WebInspector.TracingTimelineModel.RecordType;
366 var name = event.name;
367 if (name === recordTypes.TimeStamp)
368 return true;
369 if (name === recordTypes.MarkFirstPaint)
370 return true;
371 if (name === recordTypes.MarkDOMContent || name === recordTypes.MarkLoad)
372 return event.args.data["isMainFrame"];
373 return false;
374 }
375
376 /**
377 * @param {!WebInspector.TracingModel.Event} event
320 * @param {!WebInspector.Linkifier} linkifier 378 * @param {!WebInspector.Linkifier} linkifier
321 * @return {?Node} 379 * @return {?Node}
322 */ 380 */
323 WebInspector.TracingTimelineUIUtils.buildDetailsNodeForTraceEvent = function(eve nt, linkifier) 381 WebInspector.TracingTimelineUIUtils.buildDetailsNodeForTraceEvent = function(eve nt, linkifier)
324 { 382 {
325 var recordType = WebInspector.TracingTimelineModel.RecordType; 383 var recordType = WebInspector.TracingTimelineModel.RecordType;
326 var target = event.thread.target(); 384 var target = event.thread.target();
327 var details; 385 var details;
328 var detailsText; 386 var detailsText;
329 var eventData = event.args.data; 387 var eventData = event.args.data;
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 return result; 842 return result;
785 } 843 }
786 844
787 /** 845 /**
788 * @return {!WebInspector.TracingTimelineModel.Filter} 846 * @return {!WebInspector.TracingTimelineModel.Filter}
789 */ 847 */
790 WebInspector.TracingTimelineUIUtils.hiddenEventsFilter = function() 848 WebInspector.TracingTimelineUIUtils.hiddenEventsFilter = function()
791 { 849 {
792 return new WebInspector.TracingTimelineModel.InclusiveEventNameFilter(WebIns pector.TracingTimelineUIUtils._visibleTypes()); 850 return new WebInspector.TracingTimelineModel.InclusiveEventNameFilter(WebIns pector.TracingTimelineUIUtils._visibleTypes());
793 } 851 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698