Index: Source/devtools/front_end/timeline/TimelineModel.js |
diff --git a/Source/devtools/front_end/timeline/TimelineModel.js b/Source/devtools/front_end/timeline/TimelineModel.js |
index 9fb5dd44fd5d8144923be0ea6b879acb5e6759c9..35ebfb508f4abf7979b4da5c3ed17af72e566416 100644 |
--- a/Source/devtools/front_end/timeline/TimelineModel.js |
+++ b/Source/devtools/front_end/timeline/TimelineModel.js |
@@ -30,13 +30,13 @@ |
/** |
* @constructor |
- * @extends {WebInspector.Object} |
+ * @extends {WebInspector.TargetAwareObject} |
* @param {!WebInspector.Target} target |
*/ |
WebInspector.TimelineModel = function(target) |
{ |
+ WebInspector.TargetAwareObject.call(this, target); |
this._filters = []; |
- this._target = target; |
} |
WebInspector.TimelineModel.RecordType = { |
@@ -143,14 +143,6 @@ WebInspector.TimelineModel.forAllRecords = function(recordsArray, preOrderCallba |
WebInspector.TimelineModel.prototype = { |
/** |
- * @return {!WebInspector.Target} |
- */ |
- target: function() |
- { |
- return this._target; |
- }, |
- |
- /** |
* @return {boolean} |
*/ |
loadedFromFile: function() |
@@ -224,52 +216,6 @@ WebInspector.TimelineModel.prototype = { |
this.dispatchEventToListeners(WebInspector.TimelineModel.Events.RecordFilterChanged); |
}, |
- willStartRecordingTraceEvents: function() |
- { |
- this.reset(); |
- this.dispatchEventToListeners(WebInspector.TimelineModel.Events.RecordingStarted); |
- }, |
- |
- /** |
- * @param {!Array.<!WebInspector.TracingModel.Event>} mainThreadEvents |
- */ |
- didStopRecordingTraceEvents: function(mainThreadEvents) |
- { |
- var recordStack = []; |
- for (var i = 0, size = mainThreadEvents.length; i < size; ++i) { |
- var event = mainThreadEvents[i]; |
- while (recordStack.length) { |
- var top = recordStack.peekLast(); |
- if (top._event.endTime >= event.startTime) |
- break; |
- recordStack.pop(); |
- } |
- var parentRecord = recordStack.peekLast() || null; |
- var record = new WebInspector.TimelineModel.TraceEventRecord(this, event, parentRecord); |
- if (WebInspector.TimelineUIUtils.isEventDivider(record)) |
- this._eventDividerRecords.push(record); |
- if (!recordStack.length) |
- this._addTopLevelRecord(record); |
- if (event.endTime) |
- recordStack.push(record); |
- } |
- this.dispatchEventToListeners(WebInspector.TimelineModel.Events.RecordingStopped); |
- }, |
- |
- /** |
- * @param {!WebInspector.TimelineModel.TraceEventRecord} record |
- */ |
- _addTopLevelRecord: function(record) |
- { |
- this._updateBoundaries(record); |
- this._records.push(record); |
- if (record.type() === WebInspector.TimelineModel.RecordType.Program) |
- this._mainThreadTasks.push(record); |
- if (record.type() === WebInspector.TimelineModel.RecordType.GPUTask) |
- this._gpuThreadTasks.push(record); |
- this.dispatchEventToListeners(WebInspector.TimelineModel.Events.RecordAdded, record); |
- }, |
- |
/** |
* @return {!Array.<!WebInspector.TimelineModel.Record>} |
*/ |
@@ -370,7 +316,7 @@ WebInspector.TimelineModel.prototype = { |
return this._eventDividerRecords; |
}, |
- __proto__: WebInspector.Object.prototype |
+ __proto__: WebInspector.TargetAwareObject.prototype |
} |
/** |
@@ -485,216 +431,6 @@ WebInspector.TimelineModel.Record.prototype = { |
testContentMatching: function(regExp) { } |
} |
- |
-/** |
- * @constructor |
- * @implements {WebInspector.TimelineModel.Record} |
- * @param {!WebInspector.TimelineModel} model |
- * @param {!WebInspector.TracingModel.Event} traceEvent |
- * @param {?WebInspector.TimelineModel.TraceEventRecord} parentRecord |
- */ |
-WebInspector.TimelineModel.TraceEventRecord = function(model, traceEvent, parentRecord) |
-{ |
- this._model = model; |
- this._event = traceEvent; |
- traceEvent._timelineRecord = this; |
- if (parentRecord) { |
- this.parent = parentRecord; |
- parentRecord._children.push(this); |
- } |
- this._children = []; |
-} |
- |
-WebInspector.TimelineModel.TraceEventRecord.prototype = { |
- /** |
- * @return {?Array.<!ConsoleAgent.CallFrame>} |
- */ |
- callSiteStackTrace: function() |
- { |
- var initiator = this._event.initiator; |
- return initiator ? initiator.stackTrace : null; |
- }, |
- |
- /** |
- * @return {?WebInspector.TimelineModel.Record} |
- */ |
- initiator: function() |
- { |
- var initiator = this._event.initiator; |
- return initiator ? initiator._timelineRecord : null; |
- }, |
- |
- /** |
- * @return {!WebInspector.Target} |
- */ |
- target: function() |
- { |
- return this._model.target(); |
- }, |
- |
- /** |
- * @return {number} |
- */ |
- selfTime: function() |
- { |
- return this._event.selfTime; |
- }, |
- |
- /** |
- * @return {!Array.<!WebInspector.TimelineModel.Record>} |
- */ |
- children: function() |
- { |
- return this._children; |
- }, |
- |
- /** |
- * @return {!WebInspector.TimelineCategory} |
- */ |
- category: function() |
- { |
- var style = WebInspector.TimelineUIUtils.styleForTimelineEvent(this._event.name); |
- return style.category; |
- }, |
- |
- /** |
- * @return {string} |
- */ |
- title: function() |
- { |
- return WebInspector.TimelineUIUtils.recordTitle(this, this._model); |
- }, |
- |
- /** |
- * @return {number} |
- */ |
- startTime: function() |
- { |
- return this._event.startTime; |
- }, |
- |
- /** |
- * @return {string|undefined} |
- */ |
- thread: function() |
- { |
- return "CPU"; |
- }, |
- |
- /** |
- * @return {number} |
- */ |
- endTime: function() |
- { |
- return this._event.endTime || this._event.startTime; |
- }, |
- |
- /** |
- * @param {number} endTime |
- */ |
- setEndTime: function(endTime) |
- { |
- throw new Error("Unsupported operation setEndTime"); |
- }, |
- |
- /** |
- * @return {!Object} |
- */ |
- data: function() |
- { |
- return this._event.args.data; |
- }, |
- |
- /** |
- * @return {string} |
- */ |
- type: function() |
- { |
- return this._event.name; |
- }, |
- |
- /** |
- * @return {string} |
- */ |
- frameId: function() |
- { |
- switch (this._event.name) { |
- case WebInspector.TracingTimelineModel.RecordType.ScheduleStyleRecalculation: |
- case WebInspector.TracingTimelineModel.RecordType.RecalculateStyles: |
- case WebInspector.TracingTimelineModel.RecordType.InvalidateLayout: |
- return this._event.args["frameId"]; |
- case WebInspector.TracingTimelineModel.RecordType.Layout: |
- return this._event.args["beginData"]["frameId"]; |
- default: |
- var data = this._event.args.data; |
- return (data && data["frame"]) || ""; |
- } |
- }, |
- |
- /** |
- * @return {?Array.<!ConsoleAgent.CallFrame>} |
- */ |
- stackTrace: function() |
- { |
- return this._event.stackTrace; |
- }, |
- |
- /** |
- * @param {string} key |
- * @return {?Object} |
- */ |
- getUserObject: function(key) |
- { |
- if (key === "TimelineUIUtils::preview-element") |
- return this._event.previewElement; |
- throw new Error("Unexpected key: " + key); |
- }, |
- |
- /** |
- * @param {string} key |
- * @param {?Object|undefined} value |
- */ |
- setUserObject: function(key, value) |
- { |
- if (key !== "TimelineUIUtils::preview-element") |
- throw new Error("Unexpected key: " + key); |
- this._event.previewElement = /** @type {?Element} */ (value); |
- }, |
- |
- /** |
- * @return {!Object.<string, number>} |
- */ |
- aggregatedStats: function() |
- { |
- return {}; |
- }, |
- |
- /** |
- * @return {?Array.<string>} |
- */ |
- warnings: function() |
- { |
- if (this._event.warning) |
- return [this._event.warning]; |
- return null; |
- }, |
- |
- /** |
- * @param {!RegExp} regExp |
- * @return {boolean} |
- */ |
- testContentMatching: function(regExp) |
- { |
- var tokens = [this.title()]; |
- var data = this._event.args.data; |
- if (data) { |
- for (var key in data) |
- tokens.push(data[key]); |
- } |
- return regExp.test(tokens.join("|")); |
- } |
-} |
- |
/** |
* @constructor |
*/ |