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

Unified Diff: Source/devtools/front_end/timeline/TracingModel.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: 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/timeline/TimelinePanel.js ('k') | Source/devtools/scripts/frontend_modules.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/timeline/TracingModel.js
diff --git a/Source/devtools/front_end/sdk/TracingModel.js b/Source/devtools/front_end/timeline/TracingModel.js
similarity index 93%
rename from Source/devtools/front_end/sdk/TracingModel.js
rename to Source/devtools/front_end/timeline/TracingModel.js
index 16c48114103a4da315c1eeb9229d0070b01d62cd..b08a0b506aefa4299c854d7f8561c64036d6a9a5 100644
--- a/Source/devtools/front_end/sdk/TracingModel.js
+++ b/Source/devtools/front_end/timeline/TracingModel.js
@@ -174,12 +174,38 @@ WebInspector.TracingModel.prototype = {
_tracingComplete: function()
{
+ this._calculateWarnings();
+
this._active = false;
if (!this._pendingStopCallback)
return;
this._pendingStopCallback();
this._pendingStopCallback = null;
},
+
+ _calculateWarnings: function()
+ {
+ var events = this._inspectedTargetMainThreadEvents;
+ var currentScriptEvent = null;
+ for (var i = 0, l = events.length; i < l; i++) {
+ var event = events[i];
+ if (currentScriptEvent && event.startTime > currentScriptEvent.endTime)
+ currentScriptEvent = null;
+ if (event.name === WebInspector.TimelineModel.RecordType.Layout && currentScriptEvent)
+ this._eventToWarning.put(event, WebInspector.UIString("Forced synchronous layout is a possible performance bottleneck."));
+ if (event.name === WebInspector.TimelineModel.RecordType.EvaluateScript || event.name === WebInspector.TimelineModel.RecordType.FunctionCall)
caseq 2014/05/07 15:44:33 Looks like this belongs to a higher level than tra
yurys 2014/05/08 07:46:46 Done. Extracted this code into TracingModel.EventB
+ currentScriptEvent = event;
+ }
+ },
+
+ /**
+ * @param {!WebInspector.TracingModel.Event} event
+ * @return {?string}
+ */
+ eventWarning: function(event)
+ {
+ return this._eventToWarning.get(event);
+ },
reset: function()
{
@@ -192,6 +218,7 @@ WebInspector.TracingModel.prototype = {
this._inspectedTargetMainThreadEvents = [];
this._inspectedTargetLayerTreeHostId = 0;
this._frameLifecycleEvents = [];
+ this._eventToWarning = new Map();
},
/**
« no previous file with comments | « Source/devtools/front_end/timeline/TimelinePanel.js ('k') | Source/devtools/scripts/frontend_modules.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698