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

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

Issue 319743002: Timeline: decouple TimelineFrameModel from TimelineModel (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebased Created 6 years, 6 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
« no previous file with comments | « no previous file | Source/devtools/front_end/timeline/TimelineModel.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/timeline/TimelineFrameModel.js
diff --git a/Source/devtools/front_end/timeline/TimelineFrameModel.js b/Source/devtools/front_end/timeline/TimelineFrameModel.js
index 91f2a666bdc3569a7bb880235eb79887ea40f28f..06410f8481dda59d6cc0ed67979940e3531b8505 100644
--- a/Source/devtools/front_end/timeline/TimelineFrameModel.js
+++ b/Source/devtools/front_end/timeline/TimelineFrameModel.js
@@ -30,17 +30,14 @@
/**
* @constructor
- * @extends {WebInspector.Object}
- * @param {!WebInspector.TimelineModel} model
+ * @extends {WebInspector.TargetAwareObject}
+ * @param {!WebInspector.Target} target
*/
-WebInspector.TimelineFrameModel = function(model)
+WebInspector.TimelineFrameModel = function(target)
{
- this._model = model;
+ WebInspector.TargetAwareObject.call(this, target);
this.reset();
- var records = model.records();
- for (var i = 0; i < records.length; ++i)
- this.addRecord(records[i]);
}
WebInspector.TimelineFrameModel.Events = {
@@ -56,14 +53,6 @@ WebInspector.TimelineFrameModel._mainFrameMarkers = [
WebInspector.TimelineFrameModel.prototype = {
/**
- * @return {!WebInspector.Target}
- */
- target: function()
- {
- return this._model.target();
- },
-
- /**
* @return {!Array.<!WebInspector.TimelineFrame>}
*/
frames: function()
@@ -102,8 +91,18 @@ WebInspector.TimelineFrameModel.prototype = {
return frames.slice(firstFrame, lastFrame);
},
+ /**
+ * @param {boolean} value
+ */
+ setMergeRecords: function(value)
+ {
+ this._mergeRecords = value;
+ },
+
reset: function()
{
+ this._mergeRecords = true;
+ this._minimumRecordTime = Infinity;
this._frames = [];
this._lastFrame = null;
this._lastLayerTree = null;
@@ -115,6 +114,19 @@ WebInspector.TimelineFrameModel.prototype = {
},
/**
+ * @param {!Array.<!WebInspector.TimelineModel.Record>} records
+ */
+ addRecords: function(records)
+ {
+ if (!records.length)
+ return;
+ if (records[0].startTime() < this._minimumRecordTime)
+ this._minimumRecordTime = records[0].startTime();
+ for (var i = 0; i < records.length; ++i)
+ this.addRecord(records[i]);
+ },
+
+ /**
* @param {!WebInspector.TimelineModel.Record} record
*/
addRecord: function(record)
@@ -129,7 +141,7 @@ WebInspector.TimelineFrameModel.prototype = {
}
/** type {Array.<!WebInspector.TimelineModel.Record>} */
var records = [];
- if (this._model.bufferEvents())
+ if (!this._mergeRecords)
records = [record];
else
records = this._mergingBuffer.process(record.thread(), /** type {Array.<!WebInspector.TimelineModel.Record>} */(programRecord ? record.children() || [] : [record]));
@@ -328,7 +340,7 @@ WebInspector.TimelineFrameModel.prototype = {
if (this._lastFrame)
this._flushFrame(this._lastFrame, startTime);
- this._lastFrame = new WebInspector.TimelineFrame(startTime, startTime - this._model.minimumRecordTime());
+ this._lastFrame = new WebInspector.TimelineFrame(startTime, startTime - this._minimumRecordTime);
},
/**
@@ -338,7 +350,7 @@ WebInspector.TimelineFrameModel.prototype = {
{
if (this._lastFrame)
this._flushFrame(this._lastFrame, startTime);
- this._lastFrame = new WebInspector.TimelineFrame(startTime, startTime - this._model.minimumRecordTime());
+ this._lastFrame = new WebInspector.TimelineFrame(startTime, startTime - this._minimumRecordTime);
},
/**
@@ -372,7 +384,7 @@ WebInspector.TimelineFrameModel.prototype = {
return null;
},
- __proto__: WebInspector.Object.prototype
+ __proto__: WebInspector.TargetAwareObject.prototype
}
/**
« no previous file with comments | « no previous file | Source/devtools/front_end/timeline/TimelineModel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698