Commit b8b3294c authored by yurys@chromium.org's avatar yurys@chromium.org

Do not coalesce events from different threads having same name

There are may well be several threads with same name, e.g. all worker threads will be called "WebCore: Worker". Such threads should be displayed as separate threads on tracing based timeline.

BUG=401895

Review URL: https://codereview.chromium.org/463033002

git-svn-id: svn://svn.chromium.org/blink/trunk@180049 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent a5aa4b8f
...@@ -165,9 +165,9 @@ WebInspector.TimelineFlameChartDataProvider.prototype = { ...@@ -165,9 +165,9 @@ WebInspector.TimelineFlameChartDataProvider.prototype = {
this._appendFrameBars(this._frameModel.frames()); this._appendFrameBars(this._frameModel.frames());
this._appendThreadTimelineData(WebInspector.UIString("Main Thread"), this._model.mainThreadEvents()); this._appendThreadTimelineData(WebInspector.UIString("Main Thread"), this._model.mainThreadEvents());
var threads = this._model.virtualThreads(); var threads = this._model.virtualThreads();
for (var threadName in threads) { for (var i = 0; i < threads.length; i++) {
if (threadName !== WebInspector.TimelineModel.MainThreadName) var thread = threads[i];
this._appendThreadTimelineData(threadName, threads[threadName]); this._appendThreadTimelineData(thread.name, thread.events);
} }
return this._timelineData; return this._timelineData;
}, },
......
...@@ -98,6 +98,17 @@ WebInspector.TracingTimelineModel.RecordType = { ...@@ -98,6 +98,17 @@ WebInspector.TracingTimelineModel.RecordType = {
PictureSnapshot: "cc::Picture" PictureSnapshot: "cc::Picture"
}; };
/**
* @constructor
* @param {string} name
*/
WebInspector.TracingTimelineModel.VirtualThread = function(name)
{
this.name = name;
/** @type {!Array.<!WebInspector.TracingModel.Event>} */
this.events = [];
}
WebInspector.TracingTimelineModel.prototype = { WebInspector.TracingTimelineModel.prototype = {
/** /**
* @param {boolean} captureStacks * @param {boolean} captureStacks
...@@ -259,7 +270,7 @@ WebInspector.TracingTimelineModel.prototype = { ...@@ -259,7 +270,7 @@ WebInspector.TracingTimelineModel.prototype = {
*/ */
mainThreadEvents: function() mainThreadEvents: function()
{ {
return this._virtualThreads[WebInspector.TimelineModel.MainThreadName] || []; return this._mainThreadEvents;
}, },
/** /**
...@@ -267,11 +278,11 @@ WebInspector.TracingTimelineModel.prototype = { ...@@ -267,11 +278,11 @@ WebInspector.TracingTimelineModel.prototype = {
*/ */
_setMainThreadEvents: function(events) _setMainThreadEvents: function(events)
{ {
this._virtualThreads[WebInspector.TimelineModel.MainThreadName] = events; this._mainThreadEvents = events;
}, },
/** /**
* @return {!Object.<string, !Array.<!WebInspector.TracingModel.Event>>} * @return {!Array.<!WebInspector.TracingTimelineModel.VirtualThread>}
*/ */
virtualThreads: function() virtualThreads: function()
{ {
...@@ -300,7 +311,8 @@ WebInspector.TracingTimelineModel.prototype = { ...@@ -300,7 +311,8 @@ WebInspector.TracingTimelineModel.prototype = {
reset: function() reset: function()
{ {
this._virtualThreads = {}; this._virtualThreads = [];
this._mainThreadEvents = [];
this._inspectedTargetEvents = []; this._inspectedTargetEvents = [];
WebInspector.TimelineModel.prototype.reset.call(this); WebInspector.TimelineModel.prototype.reset.call(this);
}, },
...@@ -375,18 +387,21 @@ WebInspector.TracingTimelineModel.prototype = { ...@@ -375,18 +387,21 @@ WebInspector.TracingTimelineModel.prototype = {
var length = events.length; var length = events.length;
var i = events.lowerBound(startTime, function (time, event) { return time - event.startTime }); var i = events.lowerBound(startTime, function (time, event) { return time - event.startTime });
var threadEvents;
if (thread === mainThread) {
threadEvents = this._mainThreadEvents;
} else {
var virtualThread = new WebInspector.TracingTimelineModel.VirtualThread(thread.name());
threadEvents = virtualThread.events;
this._virtualThreads.push(virtualThread);
}
this._eventStack = []; this._eventStack = [];
for (; i < length; i++) { for (; i < length; i++) {
var event = events[i]; var event = events[i];
if (endTime && event.startTime >= endTime) if (endTime && event.startTime >= endTime)
break; break;
this._processEvent(event); this._processEvent(event);
var threadName = thread === mainThread ? WebInspector.TimelineModel.MainThreadName : thread.name();
var threadEvents = this._virtualThreads[threadName];
if (!threadEvents) {
threadEvents = [];
this._virtualThreads[threadName] = threadEvents;
}
threadEvents.push(event); threadEvents.push(event);
this._inspectedTargetEvents.push(event); this._inspectedTargetEvents.push(event);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment