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

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

Issue 391373008: DevTools: Show JS callstacks on tracing-based timeline (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/timeline/TracingTimelineModel.js
diff --git a/Source/devtools/front_end/timeline/TracingTimelineModel.js b/Source/devtools/front_end/timeline/TracingTimelineModel.js
index ba539129b15c658676489cf81855768ee29cb4bc..1abcfd35828ad8e9f5fa3815af574b746de56d76 100644
--- a/Source/devtools/front_end/timeline/TracingTimelineModel.js
+++ b/Source/devtools/front_end/timeline/TracingTimelineModel.js
@@ -179,6 +179,8 @@ WebInspector.TracingTimelineModel.prototype = {
this._resetProcessingState();
this._inspectedTargetEvents.sort(WebInspector.TracingModel.Event.compareStartTime);
+ if (WebInspector.experimentsSettings.timelineJSCPUProfile.isEnabled())
+ this._injectJSFrameEvents();
this._buildTimelineRecords();
this.dispatchEventToListeners(WebInspector.TimelineModel.Events.RecordingStopped);
@@ -217,6 +219,14 @@ WebInspector.TracingTimelineModel.prototype = {
},
/**
+ * @param {!Array.<!WebInspector.TracingModel.Event>} events
+ */
+ _setMainThreadEvents: function(events)
+ {
+ return this._virtualThreads[WebInspector.TimelineModel.MainThreadName] = events;
+ },
+
+ /**
* @return {!Object.<string, !Array.<!WebInspector.TracingModel.Event>>}
*/
virtualThreads: function()
@@ -231,6 +241,33 @@ WebInspector.TracingTimelineModel.prototype = {
WebInspector.TimelineModel.prototype.reset.call(this);
},
+ _injectJSFrameEvents: function()
+ {
+ var jsFrameEvents = [];
+ var mainThreadEvents = this.mainThreadEvents();
+ for (var i = 0; i < mainThreadEvents.length; ++i) {
+ var event = mainThreadEvents[i];
+ if (!event.stackTrace)
+ continue;
+ for (var j = event.stackTrace.length - 1; j >= 0; --j) {
+ var payload = /** @type {!WebInspector.TracingModel.EventPayload} */ ({
+ ph: WebInspector.TracingModel.Phase.Complete,
+ cat: WebInspector.TracingModel.DevToolsMetadataEventCategory,
+ name: WebInspector.TracingTimelineModel.RecordType.JSFrame,
yurys 2014/07/17 14:32:40 I'd rather add this on the flame chart directly wi
alph 2014/07/17 15:48:43 Done.
+ ts: event.startTime * 1000,
+ dur: event.duration * 1000,
+ args: {
+ data: event.stackTrace[j]
+ }
+ });
+ var jsFrameEvent = new WebInspector.TracingModel.Event(payload, 0, event.thread);
+ jsFrameEvents.push(jsFrameEvent);
+ }
+ }
+ this._setMainThreadEvents(jsFrameEvents.mergeOrdered(mainThreadEvents, WebInspector.TracingModel.Event.orderedCompareStartTime));
+ this._inspectedTargetEvents = jsFrameEvents.mergeOrdered(this._inspectedTargetEvents, WebInspector.TracingModel.Event.orderedCompareStartTime);
+ },
+
_buildTimelineRecords: function()
{
var recordStack = [];

Powered by Google App Engine
This is Rietveld 408576698