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

Unified Diff: Source/devtools/front_end/components/TimelineGrid.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 side-by-side diff with in-line comments
Download patch
Index: Source/devtools/front_end/components/TimelineGrid.js
diff --git a/Source/devtools/front_end/components/TimelineGrid.js b/Source/devtools/front_end/components/TimelineGrid.js
index 146ecc10495fbbc626d56de295dc4155552f1128..0daae14b8ddb3ff414f13978433d27f6476b7477 100644
--- a/Source/devtools/front_end/components/TimelineGrid.js
+++ b/Source/devtools/front_end/components/TimelineGrid.js
@@ -155,6 +155,33 @@ WebInspector.TimelineGrid.drawCanvasGrid = function(canvas, calculator, dividerO
context.restore();
},
+/**
+ * @param {!Object} canvas
+ * @param {!WebInspector.TimelineGrid.Calculator} calculator
+ * @param {?Array.<!WebInspector.FlameChartDataProvider.Marker>} markers
+ */
+WebInspector.TimelineGrid.drawTimelineMarkers = function(canvas, calculator, markers)
+{
+ var context = canvas.getContext("2d");
+ context.save();
+ var ratio = window.devicePixelRatio;
+ context.scale(ratio, ratio);
+ var height = WebInspector.FlameChart.DividersBarHeight - 1;
+ context.lineWidth = 2;
alph 2014/07/21 12:05:30 it should depend on devicePixelRatio
yurys 2014/07/21 13:49:47 There is already a call to context.scale above.
+ context.translate(0.5, 0.5);
alph 2014/07/21 12:05:30 You need to translate by 0.5 iff lineWidth is odd.
yurys 2014/07/21 13:49:47 Done.
+ for (var i = 0; i < markers.length; ++i) {
+ var marker = markers[i];
+ var position = calculator.computePosition(marker.timestamp);
+ context.strokeStyle = marker.color;
+ context.beginPath();
+ context.moveTo(position, 0);
+ context.lineTo(position, height);
+ context.stroke();
+ }
+ context.restore();
+},
+
+
WebInspector.TimelineGrid.prototype = {
get dividersElement()
{

Powered by Google App Engine
This is Rietveld 408576698