OLD | NEW |
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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 WebInspector.TimelinePresentationModel.forAllRecords(this._model.rec
ords, this._appendRecord.bind(this)); |
129 this._zeroTime = this._model.minimumRecordTime(); | 129 this._zeroTime = this._model.minimumRecordTime(); |
130 } | 130 } |
131 return this._timelineData; | 131 return /** @type {!WebInspector.FlameChart.TimelineData} */(this._timeli
neData); |
132 }, | 132 }, |
133 | 133 |
134 /** | 134 /** |
135 * @return {number} | 135 * @return {number} |
136 */ | 136 */ |
137 zeroTime: function() | 137 zeroTime: function() |
138 { | 138 { |
139 return this._zeroTime; | 139 return this._zeroTime; |
140 }, | 140 }, |
141 | 141 |
(...skipping 14 matching lines...) Expand all Loading... |
156 }, | 156 }, |
157 | 157 |
158 _resetData: function() | 158 _resetData: function() |
159 { | 159 { |
160 this._startTime = 0; | 160 this._startTime = 0; |
161 this._endTime = 0; | 161 this._endTime = 0; |
162 this._maxStackDepth = 5; | 162 this._maxStackDepth = 5; |
163 this._totalTime = 1000; | 163 this._totalTime = 1000; |
164 this._zeroTime = 0; | 164 this._zeroTime = 0; |
165 | 165 |
| 166 /** |
| 167 * @type {?WebInspector.FlameChart.TimelineData} |
| 168 */ |
166 this._timelineData = { | 169 this._timelineData = { |
167 entryLevels: [], | 170 entryLevels: [], |
168 entryTotalTimes: [], | 171 entryTotalTimes: [], |
169 entryOffsets: [], | 172 entryOffsets: [], |
170 colorEntryIndexes: [] | |
171 }; | 173 }; |
172 this._entryTitles = []; | 174 |
| 175 /** @type {!Array.<string>} */ |
| 176 this._entryTitles = []; |
| 177 |
| 178 /** @type {!Array.<string>} */ |
| 179 this._entryColors = []; |
173 }, | 180 }, |
174 | 181 |
175 _appendRecord: function(record, depth) | 182 _appendRecord: function(record, depth) |
176 { | 183 { |
177 var timelineData = this._timelineData; | 184 var timelineData = this._timelineData; |
178 | 185 |
179 this._startTime = this._startTime ? Math.min(this._startTime, record.sta
rtTime) : record.startTime; | 186 this._startTime = this._startTime ? Math.min(this._startTime, record.sta
rtTime) : record.startTime; |
180 var startTime = this._startTime; | 187 var startTime = this._startTime; |
181 var endTime = record.endTime || record.startTime - startTime; | 188 var endTime = record.endTime || record.startTime - startTime; |
182 this._endTime = Math.max(this._endTime, endTime); | 189 this._endTime = Math.max(this._endTime, endTime); |
183 this._totalTime = Math.max(1000, this._endTime - this._startTime); | 190 this._totalTime = Math.max(1000, this._endTime - this._startTime); |
184 | 191 |
185 if (this._mainThread) { | 192 if (this._mainThread) { |
186 if (record.type === WebInspector.TimelineModel.RecordType.GPUTask ||
!!record.thread) | 193 if (record.type === WebInspector.TimelineModel.RecordType.GPUTask ||
!!record.thread) |
187 return; | 194 return; |
188 } else { | 195 } else { |
189 if (record.type === WebInspector.TimelineModel.RecordType.Program ||
!record.thread) | 196 if (record.type === WebInspector.TimelineModel.RecordType.Program ||
!record.thread) |
190 return; | 197 return; |
191 } | 198 } |
192 | 199 |
193 var index = this._entryTitles.length; | 200 var index = this._entryTitles.length; |
194 this._entryTitles[index] = record.type; | 201 this._entryTitles[index] = record.type; |
195 timelineData.entryOffsets[index] = record.startTime - startTime; | 202 timelineData.entryOffsets[index] = record.startTime - startTime; |
196 timelineData.entryLevels[index] = depth - 1; | 203 timelineData.entryLevels[index] = depth - 1; |
197 timelineData.entryTotalTimes[index] = endTime - record.startTime; | 204 timelineData.entryTotalTimes[index] = endTime - record.startTime; |
198 | 205 this._entryColors[index] = this._colorGenerator.colorForID(WebInspector.
TimelineUIUtils.categoryForRecord(record).name); |
199 var color = this._colorGenerator.colorForID(WebInspector.TimelineUIUtils
.categoryForRecord(record).name); | |
200 var indexesForColor = timelineData.colorEntryIndexes[color.index]; | |
201 if (!indexesForColor) | |
202 indexesForColor = timelineData.colorEntryIndexes[color.index] = []; | |
203 indexesForColor.push(index); | |
204 | |
205 this._maxStackDepth = Math.max(this._maxStackDepth, depth + 1); | 206 this._maxStackDepth = Math.max(this._maxStackDepth, depth + 1); |
206 }, | 207 }, |
207 | 208 |
208 /** | 209 /** |
209 * @param {number} entryIndex | 210 * @param {number} entryIndex |
210 * @return {?Array.<!{title: string, text: string}>} | 211 * @return {?Array.<!{title: string, text: string}>} |
211 */ | 212 */ |
212 prepareHighlightedEntryInfo: function(entryIndex) | 213 prepareHighlightedEntryInfo: function(entryIndex) |
213 { | 214 { |
214 return null; | 215 return null; |
215 }, | 216 }, |
216 | 217 |
217 /** | 218 /** |
218 * @param {number} entryIndex | 219 * @param {number} entryIndex |
219 * @return {boolean} | 220 * @return {boolean} |
220 */ | 221 */ |
221 canJumpToEntry: function(entryIndex) | 222 canJumpToEntry: function(entryIndex) |
222 { | 223 { |
223 return false; | 224 return false; |
224 }, | 225 }, |
225 | 226 |
226 /** | 227 /** |
227 * @param {number} entryIndex | 228 * @param {number} entryIndex |
228 * @return {?Object} | 229 * @return {?Object} |
229 */ | 230 */ |
230 entryData: function(entryIndex) | 231 entryData: function(entryIndex) |
231 { | 232 { |
232 return null; | 233 return null; |
| 234 }, |
| 235 |
| 236 /** |
| 237 * @param {number} entryIndex |
| 238 * @return {!string} |
| 239 */ |
| 240 entryColor: function(entryIndex) |
| 241 { |
| 242 return this._entryColors[entryIndex]; |
233 } | 243 } |
234 } | 244 } |
235 | 245 |
236 /** | 246 /** |
237 * @constructor | 247 * @constructor |
238 * @extends {WebInspector.View} | 248 * @extends {WebInspector.View} |
239 * @implements {WebInspector.TimelineModeView} | 249 * @implements {WebInspector.TimelineModeView} |
240 * @implements {WebInspector.TimeRangeController} | 250 * @implements {WebInspector.TimeRangeController} |
241 * @param {!WebInspector.TimelineModeViewDelegate} delegate | 251 * @param {!WebInspector.TimelineModeViewDelegate} delegate |
242 * @param {!WebInspector.TimelineModel} model | 252 * @param {!WebInspector.TimelineModel} model |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 | 346 |
337 /** | 347 /** |
338 * @param {?WebInspector.TimelinePresentationModel.Record} record | 348 * @param {?WebInspector.TimelinePresentationModel.Record} record |
339 */ | 349 */ |
340 setSelectedRecord: function(record) | 350 setSelectedRecord: function(record) |
341 { | 351 { |
342 }, | 352 }, |
343 | 353 |
344 __proto__: WebInspector.View.prototype | 354 __proto__: WebInspector.View.prototype |
345 } | 355 } |
OLD | NEW |