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 = {
this._appendFrameBars(this._frameModel.frames());
this._appendThreadTimelineData(WebInspector.UIString("Main Thread"), this._model.mainThreadEvents());
var threads = this._model.virtualThreads();
for (var threadName in threads) {
if (threadName !== WebInspector.TimelineModel.MainThreadName)
this._appendThreadTimelineData(threadName, threads[threadName]);
for (var i = 0; i < threads.length; i++) {
var thread = threads[i];
this._appendThreadTimelineData(thread.name, thread.events);
}
return this._timelineData;
},
......
......@@ -98,6 +98,17 @@ WebInspector.TracingTimelineModel.RecordType = {
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 = {
/**
* @param {boolean} captureStacks
......@@ -259,7 +270,7 @@ WebInspector.TracingTimelineModel.prototype = {
*/
mainThreadEvents: function()
{
return this._virtualThreads[WebInspector.TimelineModel.MainThreadName] || [];
return this._mainThreadEvents;
},
/**
......@@ -267,11 +278,11 @@ WebInspector.TracingTimelineModel.prototype = {
*/
_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()
{
......@@ -300,7 +311,8 @@ WebInspector.TracingTimelineModel.prototype = {
reset: function()
{
this._virtualThreads = {};
this._virtualThreads = [];
this._mainThreadEvents = [];
this._inspectedTargetEvents = [];
WebInspector.TimelineModel.prototype.reset.call(this);
},
......@@ -375,18 +387,21 @@ WebInspector.TracingTimelineModel.prototype = {
var length = events.length;
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 = [];
for (; i < length; i++) {
var event = events[i];
if (endTime && event.startTime >= endTime)
break;
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);
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