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

Unified Diff: Source/devtools/front_end/timeline/TimelineFlameChart.js

Issue 270553005: Support warning decorations in Timeline flame chart based on trace events (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed timeline tests Created 6 years, 7 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
« no previous file with comments | « Source/devtools/front_end/sdk/TracingModel.js ('k') | Source/devtools/front_end/timeline/TimelinePanel.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/timeline/TimelineFlameChart.js
diff --git a/Source/devtools/front_end/timeline/TimelineFlameChart.js b/Source/devtools/front_end/timeline/TimelineFlameChart.js
index 76c776e1c910667ba379984fe22445ecbaed482b..668b8e07200682035bd335819d57e052b6b2febf 100644
--- a/Source/devtools/front_end/timeline/TimelineFlameChart.js
+++ b/Source/devtools/front_end/timeline/TimelineFlameChart.js
@@ -620,7 +620,43 @@ WebInspector.TracingBasedTimelineFlameChartDataProvider.prototype = {
*/
decorateEntry: function(entryIndex, context, text, barX, barY, barWidth, barHeight, offsetToPosition)
{
- return false;
+ if (barWidth < 5)
+ return false;
+
+ var record = this._records[entryIndex];
+ var timelineData = this._timelineData;
+
+ var category = WebInspector.TimelineUIUtils.styleForTimelineEvent(record.name).category;
+ // Paint text using white color on dark background.
+ if (text) {
+ context.save();
+ context.fillStyle = "white";
+ context.shadowColor = "rgba(0, 0, 0, 0.1)";
+ context.shadowOffsetX = 1;
+ context.shadowOffsetY = 1;
+ context.font = this._font;
+ context.fillText(text, barX + this.textPadding(), barY + barHeight - this.textBaseline());
+ context.restore();
+ }
+
+ var bindings = this._model.bindings();
+ if (bindings && bindings.eventWarning(record)) {
+ context.save();
+
+ context.rect(barX, barY, barWidth, this.barHeight());
+ context.clip();
+
+ context.beginPath();
+ context.fillStyle = "red";
+ context.moveTo(barX + barWidth - 15, barY + 1);
+ context.lineTo(barX + barWidth - 1, barY + 1);
+ context.lineTo(barX + barWidth - 1, barY + 15);
+ context.fill();
+
+ context.restore();
+ }
+
+ return true;
},
/**
@@ -629,10 +665,12 @@ WebInspector.TracingBasedTimelineFlameChartDataProvider.prototype = {
*/
forceDecoration: function(entryIndex)
{
- return false;
+ var record = this._records[entryIndex];
+ var bindings = this._model.bindings();
+ return !!bindings && !!bindings.eventWarning(record);
},
- /**
+ /**
* @param {number} entryIndex
* @return {?{startTimeOffset: number, endTimeOffset: number}}
*/
« no previous file with comments | « Source/devtools/front_end/sdk/TracingModel.js ('k') | Source/devtools/front_end/timeline/TimelinePanel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698