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

Unified Diff: Source/devtools/front_end/TimelinePanel.js

Issue 183893010: DevTools: extract TimelineModel.Record from TimelinePresentationModel.Record. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: For landing Created 6 years, 10 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
Index: Source/devtools/front_end/TimelinePanel.js
diff --git a/Source/devtools/front_end/TimelinePanel.js b/Source/devtools/front_end/TimelinePanel.js
index 1cef496cf6266abb2f21adc78361d682696bb8d1..449cdc2271b9a9fb05ff53aac0c057be7f04cc69 100644
--- a/Source/devtools/front_end/TimelinePanel.js
+++ b/Source/devtools/front_end/TimelinePanel.js
@@ -236,7 +236,7 @@ WebInspector.TimelinePanel.prototype = {
views.overviewView = new WebInspector.TimelineMemoryOverview(this._model);
var timelineView = new WebInspector.TimelineView(this, this._model, this._presentationModel, null);
views.mainViews = [timelineView];
- var memoryStatistics = new WebInspector.CountersGraph(this, this._presentationModel);
+ var memoryStatistics = new WebInspector.CountersGraph(this, this._model);
views.mainViews.push(memoryStatistics);
break;
case WebInspector.TimelinePanel.Mode.FlameChart:
@@ -360,12 +360,6 @@ WebInspector.TimelinePanel.prototype = {
this._presentationModel.setSearchFilter(null);
delete this._searchFilter;
- function cleanRecord(record)
- {
- delete record.clicked;
- }
- WebInspector.TimelinePresentationModel.forAllRecords(this._presentationModel.rootRecord().children, cleanRecord);
-
this.searchCanceled();
if (searchQuery) {
this._searchFilter = new WebInspector.TimelineSearchFilter(createPlainTextSearchRegex(searchQuery, "i"));
@@ -608,21 +602,19 @@ WebInspector.TimelinePanel.prototype = {
_onRecordAdded: function(event)
{
- this._addRecord(/** @type {!TimelineAgent.TimelineEvent} */(event.data));
+ this._addRecord(/** @type {!WebInspector.TimelineModel.Record} */(event.data));
},
/**
- * @param {!TimelineAgent.TimelineEvent} record
+ * @param {!WebInspector.TimelineModel.Record} record
*/
_addRecord: function(record)
{
- var presentationRecords = this._presentationModel.addRecord(record);
-
+ this._presentationModel.addRecord(record);
if (this._frameModel)
this._frameModel.addRecord(record);
for (var i = 0; i < this._currentViews.length; ++i)
- this._currentViews[i].addRecord(record, presentationRecords);
-
+ this._currentViews[i].addRecord(record);
this._overviewPane.addRecord(record);
this._updateSearchHighlight(false, true);
@@ -708,13 +700,16 @@ WebInspector.TimelinePanel.prototype = {
var matches = [];
var presentationModel = this._presentationModel;
+ /**
+ * @param {!WebInspector.TimelineModel.Record} record
+ */
function processRecord(record)
{
if (presentationModel.isVisible(record) && record.testContentMatching(searchRegExp))
matches.push(record);
return false;
}
- WebInspector.TimelinePresentationModel.forAllRecords(presentationModel.rootRecord().children, processRecord);
+ this._model.forAllRecords(processRecord);
var matchesCount = matches.length;
if (matchesCount) {
@@ -762,7 +757,7 @@ WebInspector.TimelinePanel.prototype = {
/**
* @param {number} value
- * @param {!TimelineAgent.TimelineEvent} task
+ * @param {!WebInspector.TimelineModel.Record} task
* @return {number}
*/
function compareEndTime(value, task)
@@ -771,15 +766,15 @@ WebInspector.TimelinePanel.prototype = {
}
/**
- * @param {!TimelineAgent.TimelineEvent} rawRecord
+ * @param {!WebInspector.TimelineModel.Record} record
*/
- function aggregateTimeForRecordWithinWindow(rawRecord)
+ function aggregateTimeForRecordWithinWindow(record)
{
- if (!rawRecord.endTime || rawRecord.endTime < startTime || rawRecord.startTime > endTime)
+ if (!record.endTime || record.endTime < startTime || record.startTime > endTime)
return;
var childrenTime = 0;
- var children = rawRecord.children || [];
+ var children = record.children || [];
for (var i = 0; i < children.length; ++i) {
var child = children[i];
if (!child.endTime || child.endTime < startTime || child.startTime > endTime)
@@ -787,8 +782,8 @@ WebInspector.TimelinePanel.prototype = {
childrenTime += Math.min(endTime, child.endTime) - Math.max(startTime, child.startTime);
aggregateTimeForRecordWithinWindow(child);
}
- var categoryName = WebInspector.TimelineUIUtils.categoryForRecord(rawRecord).name;
- var ownTime = Math.min(endTime, rawRecord.endTime) - Math.max(startTime, rawRecord.startTime) - childrenTime;
+ var categoryName = WebInspector.TimelineUIUtils.categoryForRecord(record).name;
+ var ownTime = Math.min(endTime, record.endTime) - Math.max(startTime, record.startTime) - childrenTime;
aggregatedStats[categoryName] = (aggregatedStats[categoryName] || 0) + ownTime;
}
@@ -815,7 +810,7 @@ WebInspector.TimelinePanel.prototype = {
},
/**
- * @param {?WebInspector.TimelinePresentationModel.Record} record
+ * @param {?WebInspector.TimelineModel.Record} record
*/
selectRecord: function(record)
{
@@ -907,13 +902,12 @@ WebInspector.TimelineModeView.prototype = {
refreshRecords: function() {},
/**
- * @param {!TimelineAgent.TimelineEvent} record
- * @param {!Array.<!WebInspector.TimelinePresentationModel.Record>} presentationRecords
+ * @param {!WebInspector.TimelineModel.Record} record
*/
- addRecord: function(record, presentationRecords) {},
+ addRecord: function(record) {},
/**
- * @param {?WebInspector.TimelinePresentationModel.Record} record
+ * @param {?WebInspector.TimelineModel.Record} record
* @param {string=} regex
* @param {boolean=} selectRecord
*/
@@ -931,7 +925,7 @@ WebInspector.TimelineModeView.prototype = {
setSidebarSize: function(width) {},
/**
- * @param {?WebInspector.TimelinePresentationModel.Record} record
+ * @param {?WebInspector.TimelineModel.Record} record
*/
setSelectedRecord: function(record) {}
}
@@ -949,7 +943,7 @@ WebInspector.TimelineModeViewDelegate.prototype = {
requestWindowTimes: function(startTime, endTime) {},
/**
- * @param {?WebInspector.TimelinePresentationModel.Record} record
+ * @param {?WebInspector.TimelineModel.Record} record
*/
selectRecord: function(record) {}
}
@@ -964,7 +958,7 @@ WebInspector.TimelineCategoryFilter = function()
WebInspector.TimelineCategoryFilter.prototype = {
/**
- * @param {!WebInspector.TimelinePresentationModel.Record} record
+ * @param {!WebInspector.TimelineModel.Record} record
* @return {boolean}
*/
accept: function(record)
@@ -992,7 +986,7 @@ WebInspector.TimelineIsLongFilter.prototype = {
},
/**
- * @param {!WebInspector.TimelinePresentationModel.Record} record
+ * @param {!WebInspector.TimelineModel.Record} record
* @return {boolean}
*/
accept: function(record)
@@ -1013,7 +1007,7 @@ WebInspector.TimelineSearchFilter = function(regExp)
WebInspector.TimelineSearchFilter.prototype = {
/**
- * @param {!WebInspector.TimelinePresentationModel.Record} record
+ * @param {!WebInspector.TimelineModel.Record} record
* @return {boolean}
*/
accept: function(record)
@@ -1045,7 +1039,7 @@ WebInspector.TimelineWindowFilter.prototype = {
},
/**
- * @param {!WebInspector.TimelinePresentationModel.Record} record
+ * @param {!WebInspector.TimelineModel.Record} record
* @return {boolean}
*/
accept: function(record)
« no previous file with comments | « Source/devtools/front_end/TimelineOverviewPane.js ('k') | Source/devtools/front_end/TimelinePresentationModel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698