Chromium Code Reviews| Index: Source/devtools/front_end/timeline/TracingModel.js |
| diff --git a/Source/devtools/front_end/timeline/TracingModel.js b/Source/devtools/front_end/timeline/TracingModel.js |
| index 4e85d189b2151de8e3f3f62cb0c2495b549cdbf0..b9d0873cf6da22b5c80dbb79271d73d13443cdc1 100644 |
| --- a/Source/devtools/front_end/timeline/TracingModel.js |
| +++ b/Source/devtools/front_end/timeline/TracingModel.js |
| @@ -71,34 +71,13 @@ WebInspector.TracingModel.FrameLifecycleEventCategory = "cc,devtools"; |
| WebInspector.TracingModel.DevToolsMetadataEvent = { |
| TracingStartedInPage: "TracingStartedInPage", |
| - SetLayerTreeId: "SetLayerTreeId" |
| -}; |
| - |
| -WebInspector.TracingModel.TraceEventName = { |
| - ActivateLayerTree: "ActivateLayerTree", |
| - BeginFrame: "BeginFrame", |
| - BeginMainThreadFrame: "BeginMainThreadFrame", |
| - CompositeLayers: "CompositeLayers", |
| - DrawFrame: "DrawFrame", |
| - PaintSetup: "PaintSetup", |
| - RasterTask: "RasterTask", |
| - RequestMainThreadFrame: "RequestMainThreadFrame", |
| - LayerTreeHostImplSnapshot: "cc::LayerTreeHostImpl" |
| }; |
| WebInspector.TracingModel.prototype = { |
| /** |
| * @return {!Array.<!WebInspector.TracingModel.Event>} |
| */ |
| - inspectedTargetMainThreadEvents: function() |
| - { |
| - return this._inspectedTargetMainThreadEvents; |
| - }, |
| - |
| - /** |
| - * @return {!Array.<!WebInspector.TracingModel.Event>} |
| - */ |
| - frameLifecycleEvents: function() |
| + inspectedTargetEvents: function() |
| { |
| /** |
| * @param {!WebInspector.TracingModel.Event} a |
| @@ -108,7 +87,12 @@ WebInspector.TracingModel.prototype = { |
| { |
| return a.startTime - b.startTime; |
| } |
| - return this._frameLifecycleEvents.sort(compareStartTime); |
| + |
| + if (this._needToSortInspectedTargetEvents) { |
|
yurys
2014/05/27 15:41:32
Can we just sort them once after all events have b
|
| + this._inspectedTargetEvents.sort(compareStartTime); |
| + this._needToSortInspectedTargetEvents = false; |
| + } |
| + return this._inspectedTargetEvents; |
| }, |
| /** |
| @@ -197,10 +181,7 @@ WebInspector.TracingModel.prototype = { |
| this._maximumRecordTime = null; |
| this._sessionId = null; |
| this._inspectedTargetProcessId = null; |
| - this._inspectedTargetMainThread = null; |
| - this._inspectedTargetMainThreadEvents = []; |
| - this._inspectedTargetLayerTreeHostId = 0; |
| - this._frameLifecycleEvents = []; |
| + this._inspectedTargetEvents = []; |
| }, |
| /** |
| @@ -215,8 +196,8 @@ WebInspector.TracingModel.prototype = { |
| } |
| if (payload.ph === WebInspector.TracingModel.Phase.SnapshotObject) { |
| process.addObject(payload); |
| - if (payload.pid === this._inspectedTargetProcessId && payload.name === "cc::LayerTreeHostImpl" && parseInt(payload.id, 0) === this._inspectedTargetLayerTreeId) |
| - this._frameLifecycleEvents.push(new WebInspector.TracingModel.Event(payload, 0)); |
| + if (payload.pid === this._inspectedTargetProcessId) |
| + this._inspectedTargetEvents.push(new WebInspector.TracingModel.Event(payload, 0)); |
| return; |
| } |
| var thread = process.threadById(payload.tid); |
| @@ -231,12 +212,10 @@ WebInspector.TracingModel.prototype = { |
| if (payload.cat === WebInspector.TracingModel.DevToolsMetadataEventCategory) |
| this._processDevToolsMetadataEvent(payload); |
| var event = thread.addEvent(payload); |
| - if (!event) |
| - return; |
| - if (thread === this._inspectedTargetMainThread) |
| - this._inspectedTargetMainThreadEvents.push(event); |
| - if (payload.cat === WebInspector.TracingModel.FrameLifecycleEventCategory && payload.pid === this._inspectedTargetProcessId && payload.args && payload.args["layerTreeId"] === this._inspectedTargetLayerTreeId) |
| - this._frameLifecycleEvents.push(event); |
| + if (event && payload.pid === this._inspectedTargetProcessId) { |
| + this._needToSortInspectedTargetEvents = this._needToSortInspectedTargetEvents || (this._inspectedTargetEvents.length && this._inspectedTargetEvents.peekLast().startTime > event.startTime); |
| + this._inspectedTargetEvents.push(event); |
| + } |
| return; |
| } |
| switch (payload.name) { |
| @@ -260,16 +239,9 @@ WebInspector.TracingModel.prototype = { |
| */ |
| _processDevToolsMetadataEvent: function(payload) |
| { |
| - if (payload.args["sessionId"] !== this._sessionId) |
| + if (payload.args["sessionId"] !== this._sessionId || payload.name !== WebInspector.TracingModel.DevToolsMetadataEvent.TracingStartedInPage) |
| return; |
| - if (payload.name === WebInspector.TracingModel.DevToolsMetadataEvent.TracingStartedInPage) { |
| - var thread = this._processById[payload.pid].threadById(payload.tid) |
| - this._inspectedTargetProcessId = payload.pid; |
| - this._inspectedTargetMainThread = thread; |
| - this._inspectedTargetMainThreadEvents = this._inspectedTargetMainThreadEvents.concat(thread.events()); |
| - } else if (payload.name === WebInspector.TracingModel.DevToolsMetadataEvent.SetLayerTreeId) { |
| - this._inspectedTargetLayerTreeId = payload.args["layerTreeId"]; |
| - } |
| + this._inspectedTargetProcessId = payload.pid; |
| }, |
| /** |
| @@ -313,6 +285,10 @@ WebInspector.TracingModel.Event = function(payload, level) |
| this.phase = payload.ph; |
| this.level = level; |
| + this.thread = payload.tid; |
|
yurys
2014/05/27 15:41:32
thread -> tid? or we could store a reference to th
|
| + if (payload.id) |
| + this.id = payload.id; |
| + |
| /** @type {?string} */ |
| this.warning = null; |
| /** @type {?WebInspector.TracingModel.Event} */ |