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

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

Issue 1163403006: DevTools: Tweak frames band overview drawing (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 - 2 * WebInspector.TimelineEventOverview._smallStripHeight; 80 - 2 * WebInspector.TimelineEventOverview._smallStripHeight;
81 var position = 0; 81 var position = 0;
82 if (Runtime.experiments.isEnabled("inputEventsOnTimelineOverview")) { 82 if (Runtime.experiments.isEnabled("inputEventsOnTimelineOverview")) {
83 var inputHeight = this._drawInputEvents(mainThreadEvents, position, WebInspector.TimelineEventOverview._smallStripHeight); 83 var inputHeight = this._drawInputEvents(mainThreadEvents, position, WebInspector.TimelineEventOverview._smallStripHeight);
84 position += inputHeight; 84 position += inputHeight;
85 networkHeight -= inputHeight; 85 networkHeight -= inputHeight;
86 } 86 }
87 if (Runtime.experiments.isEnabled("frameRateOnEventsOverview")) 87 if (Runtime.experiments.isEnabled("frameRateOnEventsOverview"))
88 networkHeight -= WebInspector.TimelineEventOverview._fullStripHeight ; 88 networkHeight -= WebInspector.TimelineEventOverview._fullStripHeight ;
89 position += this._drawNetwork(mainThreadEvents, position, networkHeight) ; 89 position += this._drawNetwork(mainThreadEvents, position, networkHeight) ;
90 if (Runtime.experiments.isEnabled("frameRateOnEventsOverview"))
91 position += this._drawFrames(position, WebInspector.TimelineEventOve rview._fullStripHeight);
92 position += this._drawStackedUtilizationChart(mainThreadEvents, position , WebInspector.TimelineEventOverview._fullStripHeight); 90 position += this._drawStackedUtilizationChart(mainThreadEvents, position , WebInspector.TimelineEventOverview._fullStripHeight);
93 for (var thread of threads.filter(function(thread) { return !thread.isWo rker(); })) 91 for (var thread of threads.filter(function(thread) { return !thread.isWo rker(); }))
94 this._drawEvents(thread.events, position, WebInspector.TimelineEvent Overview._smallStripHeight); 92 this._drawEvents(thread.events, position, WebInspector.TimelineEvent Overview._smallStripHeight);
95 position += WebInspector.TimelineEventOverview._smallStripHeight; 93 position += WebInspector.TimelineEventOverview._smallStripHeight;
96 for (var thread of threads.filter(function(thread) { return thread.isWor ker(); })) 94 for (var thread of threads.filter(function(thread) { return thread.isWor ker(); }))
97 this._drawEvents(thread.events, position, WebInspector.TimelineEvent Overview._smallStripHeight); 95 this._drawEvents(thread.events, position, WebInspector.TimelineEvent Overview._smallStripHeight);
98 position += WebInspector.TimelineEventOverview._smallStripHeight; 96 position += WebInspector.TimelineEventOverview._smallStripHeight;
97 if (Runtime.experiments.isEnabled("frameRateOnEventsOverview"))
98 position += this._drawFrames(position, WebInspector.TimelineEventOve rview._fullStripHeight);
99 console.assert(position === this._canvas.clientHeight); 99 console.assert(position === this._canvas.clientHeight);
100 }, 100 },
101 101
102 /** 102 /**
103 * @param {!Array.<!WebInspector.TracingModel.Event>} events 103 * @param {!Array.<!WebInspector.TracingModel.Event>} events
104 * @param {number} position 104 * @param {number} position
105 * @param {number} height 105 * @param {number} height
106 * @return {number} 106 * @return {number}
107 */ 107 */
108 _drawInputEvents: function(events, position, height) 108 _drawInputEvents: function(events, position, height)
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 var baseY = (position + height) * window.devicePixelRatio; 334 var baseY = (position + height) * window.devicePixelRatio;
335 var y = baseY + 10; 335 var y = baseY + 10;
336 var ctx = this._context; 336 var ctx = this._context;
337 ctx.save(); 337 ctx.save();
338 ctx.beginPath(); 338 ctx.beginPath();
339 ctx.rect(0, position * window.devicePixelRatio, this._canvas.width, heig ht * window.devicePixelRatio); 339 ctx.rect(0, position * window.devicePixelRatio, this._canvas.width, heig ht * window.devicePixelRatio);
340 ctx.clip(); 340 ctx.clip();
341 ctx.beginPath(); 341 ctx.beginPath();
342 ctx.lineWidth = 1 * window.devicePixelRatio; 342 ctx.lineWidth = 1 * window.devicePixelRatio;
343 ctx.strokeStyle = "hsl(110, 50%, 60%)"; 343 ctx.strokeStyle = "hsl(110, 50%, 60%)";
344 ctx.fillStyle = "hsl(110, 50%, 80%)"; 344 ctx.fillStyle = "hsl(110, 50%, 88%)";
345 ctx.moveTo(0, y); 345 ctx.moveTo(0, y);
346 for (var i = 0; i < frames.length; ++i) { 346 for (var i = 0; i < frames.length; ++i) {
347 var frame = frames[i]; 347 var frame = frames[i];
348 var x = Math.round((frame.startTime - timeOffset) * scale) + 0.5; 348 var x = Math.round((frame.startTime - timeOffset) * scale) + 0.5;
349 ctx.lineTo(x, y); 349 ctx.lineTo(x, y);
350 ctx.lineTo(x, y + 1.5);
350 y = frame.idle ? baseY + 0.5 : Math.round(baseY - visualHeight * Mat h.min(baseFrameDurationMs / frame.duration, 1)) - 0.5; 351 y = frame.idle ? baseY + 0.5 : Math.round(baseY - visualHeight * Mat h.min(baseFrameDurationMs / frame.duration, 1)) - 0.5;
352 ctx.lineTo(x, y + 1.5);
351 ctx.lineTo(x, y); 353 ctx.lineTo(x, y);
352 } 354 }
353 ctx.lineTo(this._canvas.width, y); 355 if (frames.length) {
354 ctx.lineTo(this._canvas.width, baseY + 10); 356 var lastFrame = frames.peekLast();
357 var x = Math.round((lastFrame.startTime + lastFrame.duration - timeO ffset) * scale) + 0.5;
358 ctx.lineTo(x, y);
359 }
360 ctx.lineTo(x, baseY + 10);
355 ctx.closePath(); 361 ctx.closePath();
362 ctx.fill();
356 ctx.stroke(); 363 ctx.stroke();
357 ctx.fill();
358 ctx.restore(); 364 ctx.restore();
359 return height; 365 return height;
360 }, 366 },
361 367
362 _onCategoryVisibilityChanged: function() 368 _onCategoryVisibilityChanged: function()
363 { 369 {
364 this.update(); 370 this.update();
365 }, 371 },
366 372
367 /** 373 /**
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 counters[group] = this._quantDuration; 504 counters[group] = this._quantDuration;
499 this._callback(counters); 505 this._callback(counters);
500 interval -= this._quantDuration; 506 interval -= this._quantDuration;
501 } 507 }
502 this._counters = []; 508 this._counters = [];
503 this._counters[group] = interval; 509 this._counters[group] = interval;
504 this._lastTime = time; 510 this._lastTime = time;
505 this._remainder = this._quantDuration - interval; 511 this._remainder = this._quantDuration - interval;
506 } 512 }
507 } 513 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698