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

Side by Side Diff: Source/devtools/front_end/TimelineFlameChart.js

Issue 183893010: DevTools: extract TimelineModel.Record from TimelinePresentationModel.Record. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 offsets.push(frames[i].startTimeOffset); 91 offsets.push(frames[i].startTimeOffset);
92 return frames.length ? offsets : null; 92 return frames.length ? offsets : null;
93 }, 93 },
94 94
95 reset: function() 95 reset: function()
96 { 96 {
97 this._invalidate(); 97 this._invalidate();
98 }, 98 },
99 99
100 /** 100 /**
101 * @param {!TimelineAgent.TimelineEvent} record 101 * @param {!WebInspector.TimelineModel.Record} record
102 */ 102 */
103 addRecord: function(record) 103 addRecord: function(record)
104 { 104 {
105 this._invalidate(); 105 this._invalidate();
106 }, 106 },
107 107
108 _invalidate: function() 108 _invalidate: function()
109 { 109 {
110 this._timelineData = null; 110 this._timelineData = null;
111 }, 111 },
112 112
113 /** 113 /**
114 * @return {!WebInspector.FlameChart.ColorGenerator} 114 * @return {!WebInspector.FlameChart.ColorGenerator}
115 */ 115 */
116 colorGenerator: function() 116 colorGenerator: function()
117 { 117 {
118 return this._colorGenerator; 118 return this._colorGenerator;
119 }, 119 },
120 120
121 /** 121 /**
122 * @return {!WebInspector.FlameChart.TimelineData} 122 * @return {!WebInspector.FlameChart.TimelineData}
123 */ 123 */
124 timelineData: function() 124 timelineData: function()
125 { 125 {
126 if (!this._timelineData) { 126 if (!this._timelineData) {
127 this._resetData(); 127 this._resetData();
128 WebInspector.TimelinePresentationModel.forAllRecords(this._model.rec ords, this._appendRecord.bind(this)); 128 this._model.forAllRecords(this._appendRecord.bind(this));
129 this._zeroTime = this._model.minimumRecordTime(); 129 this._zeroTime = this._model.minimumRecordTime();
130 } 130 }
131 return this._timelineData; 131 return this._timelineData;
132 }, 132 },
133 133
134 /** 134 /**
135 * @return {number} 135 * @return {number}
136 */ 136 */
137 zeroTime: function() 137 zeroTime: function()
138 { 138 {
(...skipping 26 matching lines...) Expand all
165 165
166 this._timelineData = { 166 this._timelineData = {
167 entryLevels: [], 167 entryLevels: [],
168 entryTotalTimes: [], 168 entryTotalTimes: [],
169 entryOffsets: [], 169 entryOffsets: [],
170 colorEntryIndexes: [] 170 colorEntryIndexes: []
171 }; 171 };
172 this._entryTitles = []; 172 this._entryTitles = [];
173 }, 173 },
174 174
175 /**
176 * @param {!WebInspector.TimelineModel.Record} record
177 * @param {number} depth
178 */
175 _appendRecord: function(record, depth) 179 _appendRecord: function(record, depth)
176 { 180 {
177 var timelineData = this._timelineData; 181 var timelineData = this._timelineData;
178 182
179 this._startTime = this._startTime ? Math.min(this._startTime, record.sta rtTime) : record.startTime; 183 this._startTime = this._startTime ? Math.min(this._startTime, record.sta rtTime) : record.startTime;
180 var startTime = this._startTime; 184 var startTime = this._startTime;
181 var endTime = record.endTime || record.startTime - startTime; 185 var endTime = record.endTime || record.startTime - startTime;
182 this._endTime = Math.max(this._endTime, endTime); 186 this._endTime = Math.max(this._endTime, endTime);
183 this._totalTime = Math.max(1000, this._endTime - this._startTime); 187 this._totalTime = Math.max(1000, this._endTime - this._startTime);
184 188
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 this._dataProvider.reset(); 278 this._dataProvider.reset();
275 this._mainView.setWindowTimes(0, Infinity); 279 this._mainView.setWindowTimes(0, Infinity);
276 }, 280 },
277 281
278 _onRecordingStarted: function() 282 _onRecordingStarted: function()
279 { 283 {
280 this._automaticallySizeWindow = true; 284 this._automaticallySizeWindow = true;
281 }, 285 },
282 286
283 /** 287 /**
284 * @param {!TimelineAgent.TimelineEvent} rawRecord 288 * @param {!WebInspector.TimelineModel.Record} record
285 * @param {!Array.<!WebInspector.TimelinePresentationModel.Record>} presenta tionRecords
286 */ 289 */
287 addRecord: function(rawRecord, presentationRecords) 290 addRecord: function(record)
288 { 291 {
289 this._dataProvider.addRecord(rawRecord); 292 this._dataProvider.addRecord(record);
290 if (this._automaticallySizeWindow) { 293 if (this._automaticallySizeWindow) {
291 var minimumRecordTime = this._model.minimumRecordTime(); 294 var minimumRecordTime = this._model.minimumRecordTime();
292 if (rawRecord.startTime > (minimumRecordTime + 1000)) { 295 if (record.startTime > (minimumRecordTime + 1000)) {
293 this._automaticallySizeWindow = false; 296 this._automaticallySizeWindow = false;
294 this._delegate.requestWindowTimes(minimumRecordTime, minimumReco rdTime + 1000); 297 this._delegate.requestWindowTimes(minimumRecordTime, minimumReco rdTime + 1000);
295 } 298 }
296 this._mainView._scheduleUpdate(); 299 this._mainView._scheduleUpdate();
297 } 300 }
298 }, 301 },
299 302
300 /** 303 /**
301 * @param {number} startTime 304 * @param {number} startTime
302 * @param {number} endTime 305 * @param {number} endTime
(...skipping 16 matching lines...) Expand all
319 }, 322 },
320 323
321 /** 324 /**
322 * @param {number} width 325 * @param {number} width
323 */ 326 */
324 setSidebarSize: function(width) 327 setSidebarSize: function(width)
325 { 328 {
326 }, 329 },
327 330
328 /** 331 /**
329 * @param {?WebInspector.TimelinePresentationModel.Record} record 332 * @param {?WebInspector.TimelineModel.Record} record
330 * @param {string=} regex 333 * @param {string=} regex
331 * @param {boolean=} selectRecord 334 * @param {boolean=} selectRecord
332 */ 335 */
333 highlightSearchResult: function(record, regex, selectRecord) 336 highlightSearchResult: function(record, regex, selectRecord)
334 { 337 {
335 }, 338 },
336 339
337 /** 340 /**
338 * @param {?WebInspector.TimelinePresentationModel.Record} record 341 * @param {?WebInspector.TimelineModel.Record} record
339 */ 342 */
340 setSelectedRecord: function(record) 343 setSelectedRecord: function(record)
341 { 344 {
342 }, 345 },
343 346
344 __proto__: WebInspector.View.prototype 347 __proto__: WebInspector.View.prototype
345 } 348 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698