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

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 90%
rename from Source/devtools/front_end/sdk/TracingModel.js
rename to Source/devtools/front_end/timeline/TracingModel.js
index 16c48114103a4da315c1eeb9229d0070b01d62cd..43d5ac9311417e6121dc07db219bedea7665bd14 100644
--- a/Source/devtools/front_end/sdk/TracingModel.js
+++ b/Source/devtools/front_end/timeline/TracingModel.js
@@ -174,6 +174,7 @@ WebInspector.TracingModel.prototype = {
_tracingComplete: function()
{
+ this._bindings = new WebInspector.TracingModel.EventBindings(this);
this._active = false;
if (!this._pendingStopCallback)
return;
@@ -181,6 +182,14 @@ WebInspector.TracingModel.prototype = {
this._pendingStopCallback = null;
},
+ /**
+ * @return {!WebInspector.TracingModel.EventBindings}
+ */
+ bindings: function()
+ {
+ return this._bindings;
+ },
+
reset: function()
{
this._processById = {};
@@ -192,6 +201,7 @@ WebInspector.TracingModel.prototype = {
this._inspectedTargetMainThreadEvents = [];
this._inspectedTargetLayerTreeHostId = 0;
this._frameLifecycleEvents = [];
+ this._eventToWarning = new Map();
caseq 2014/05/08 09:03:53 remove?
yurys 2014/05/08 09:47:31 Done.
},
/**
@@ -291,6 +301,42 @@ WebInspector.TracingModel.prototype = {
}
/**
+ * @param {!WebInspector.TracingModel} model
+ * @constructor
+ */
+WebInspector.TracingModel.EventBindings = function(model) {
+ this._eventToWarning = new Map();
+ this._model = model;
+ this._calculateWarnings();
+}
+
+WebInspector.TracingModel.EventBindings.prototype = {
+ /**
+ * @param {!WebInspector.TracingModel.Event} event
+ * @return {string|undefined}
+ */
+ eventWarning: function(event)
+ {
+ return this._eventToWarning.get(event);
+ },
+
+ _calculateWarnings: function()
+ {
+ var events = this._model.inspectedTargetMainThreadEvents();
+ var currentScriptEvent = null;
+ for (var i = 0, l = events.length; i < l; i++) {
caseq 2014/05/08 09:03:53 Lowercase l looks bad as identifier, let's use jus
yurys 2014/05/08 09:47:31 Done.
+ var event = events[i];
+ if (currentScriptEvent && event.startTime > currentScriptEvent.endTime)
caseq 2014/05/08 09:03:53 Are script events never nested?
yurys 2014/05/08 09:47:31 They are but we just need to know if there is at l
+ 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)
+ currentScriptEvent = event;
+ }
+ }
+}
+
+/**
* @constructor
* @param {!WebInspector.TracingModel.EventPayload} payload
* @param {number} level
« 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