| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @implements {UI.FlameChartDataProvider} | 6 * @implements {UI.FlameChartDataProvider} |
| 7 * @unrestricted | 7 * @unrestricted |
| 8 */ | 8 */ |
| 9 Timeline.TimelineFlameChartDataProviderBase = class { | 9 Timeline.TimelineFlameChartDataProviderBase = class { |
| 10 constructor() { | 10 constructor() { |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 } | 185 } |
| 186 }; | 186 }; |
| 187 | 187 |
| 188 /** | 188 /** |
| 189 * @enum {symbol} | 189 * @enum {symbol} |
| 190 */ | 190 */ |
| 191 Timeline.TimelineFlameChartEntryType = { | 191 Timeline.TimelineFlameChartEntryType = { |
| 192 Frame: Symbol('Frame'), | 192 Frame: Symbol('Frame'), |
| 193 Event: Symbol('Event'), | 193 Event: Symbol('Event'), |
| 194 InteractionRecord: Symbol('InteractionRecord'), | 194 InteractionRecord: Symbol('InteractionRecord'), |
| 195 ExtensionEvent: Symbol('ExtensionEvent') |
| 195 }; | 196 }; |
| 196 | 197 |
| 197 /** | 198 /** |
| 198 * @implements {UI.FlameChartMarker} | 199 * @implements {UI.FlameChartMarker} |
| 199 * @unrestricted | 200 * @unrestricted |
| 200 */ | 201 */ |
| 201 Timeline.TimelineFlameChartMarker = class { | 202 Timeline.TimelineFlameChartMarker = class { |
| 202 /** | 203 /** |
| 203 * @param {number} startTime | 204 * @param {number} startTime |
| 204 * @param {number} startOffset | 205 * @param {number} startOffset |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 * @implements {Timeline.TimelineModeView} | 277 * @implements {Timeline.TimelineModeView} |
| 277 * @implements {UI.FlameChartDelegate} | 278 * @implements {UI.FlameChartDelegate} |
| 278 * @unrestricted | 279 * @unrestricted |
| 279 */ | 280 */ |
| 280 Timeline.TimelineFlameChartView = class extends UI.VBox { | 281 Timeline.TimelineFlameChartView = class extends UI.VBox { |
| 281 /** | 282 /** |
| 282 * @param {!Timeline.TimelineModeViewDelegate} delegate | 283 * @param {!Timeline.TimelineModeViewDelegate} delegate |
| 283 * @param {!TimelineModel.TimelineModel} timelineModel | 284 * @param {!TimelineModel.TimelineModel} timelineModel |
| 284 * @param {!TimelineModel.TimelineFrameModel} frameModel | 285 * @param {!TimelineModel.TimelineFrameModel} frameModel |
| 285 * @param {!TimelineModel.TimelineIRModel} irModel | 286 * @param {!TimelineModel.TimelineIRModel} irModel |
| 287 * @param {!Array<!{title: string, model: !SDK.TracingModel}>} extensionModels |
| 286 * @param {!Array<!TimelineModel.TimelineModel.Filter>} filters | 288 * @param {!Array<!TimelineModel.TimelineModel.Filter>} filters |
| 287 */ | 289 */ |
| 288 constructor(delegate, timelineModel, frameModel, irModel, filters) { | 290 constructor(delegate, timelineModel, frameModel, irModel, extensionModels, fil
ters) { |
| 289 super(); | 291 super(); |
| 290 this.element.classList.add('timeline-flamechart'); | 292 this.element.classList.add('timeline-flamechart'); |
| 291 this._delegate = delegate; | 293 this._delegate = delegate; |
| 292 this._model = timelineModel; | 294 this._model = timelineModel; |
| 293 | 295 this._extensionModels = extensionModels; |
| 294 this._splitWidget = new UI.SplitWidget(false, false, 'timelineFlamechartMain
View', 150); | 296 this._splitWidget = new UI.SplitWidget(false, false, 'timelineFlamechartMain
View', 150); |
| 295 | 297 |
| 296 this._dataProvider = new Timeline.TimelineFlameChartDataProvider(this._model
, frameModel, irModel, filters); | 298 this._dataProvider = new Timeline.TimelineFlameChartDataProvider(this._model
, frameModel, irModel, filters); |
| 297 var mainViewGroupExpansionSetting = Common.settings.createSetting('timelineF
lamechartMainViewGroupExpansion', {}); | 299 var mainViewGroupExpansionSetting = Common.settings.createSetting('timelineF
lamechartMainViewGroupExpansion', {}); |
| 298 this._mainView = new UI.FlameChart(this._dataProvider, this, mainViewGroupEx
pansionSetting); | 300 this._mainView = new UI.FlameChart(this._dataProvider, this, mainViewGroupEx
pansionSetting); |
| 299 | 301 |
| 300 var networkViewGroupExpansionSetting = | 302 var networkViewGroupExpansionSetting = |
| 301 Common.settings.createSetting('timelineFlamechartNetworkViewGroupExpansi
on', {}); | 303 Common.settings.createSetting('timelineFlamechartNetworkViewGroupExpansi
on', {}); |
| 302 this._networkDataProvider = new Timeline.TimelineFlameChartNetworkDataProvid
er(this._model); | 304 this._networkDataProvider = new Timeline.TimelineFlameChartNetworkDataProvid
er(this._model); |
| 303 this._networkView = new UI.FlameChart(this._networkDataProvider, this, netwo
rkViewGroupExpansionSetting); | 305 this._networkView = new UI.FlameChart(this._networkDataProvider, this, netwo
rkViewGroupExpansionSetting); |
| 304 networkViewGroupExpansionSetting.addChangeListener(this.resizeToPreferredHei
ghts.bind(this)); | 306 networkViewGroupExpansionSetting.addChangeListener(this.resizeToPreferredHei
ghts.bind(this)); |
| 305 | 307 |
| 306 this._splitWidget.setMainWidget(this._mainView); | 308 this._splitWidget.setMainWidget(this._mainView); |
| 307 this._splitWidget.setSidebarWidget(this._networkView); | 309 this._splitWidget.setSidebarWidget(this._networkView); |
| 308 this._splitWidget.show(this.element); | 310 this._splitWidget.show(this.element); |
| 309 | 311 |
| 310 this._onMainEntrySelected = this._onEntrySelected.bind(this, this._dataProvi
der); | 312 this._onMainEntrySelected = this._onEntrySelected.bind(this, this._dataProvi
der); |
| 311 this._onNetworkEntrySelected = this._onEntrySelected.bind(this, this._networ
kDataProvider); | 313 this._onNetworkEntrySelected = this._onEntrySelected.bind(this, this._networ
kDataProvider); |
| 312 this._mainView.addEventListener(UI.FlameChart.Events.EntrySelected, this._on
MainEntrySelected, this); | 314 this._mainView.addEventListener(UI.FlameChart.Events.EntrySelected, this._on
MainEntrySelected, this); |
| 313 this._networkView.addEventListener(UI.FlameChart.Events.EntrySelected, this.
_onNetworkEntrySelected, this); | 315 this._networkView.addEventListener(UI.FlameChart.Events.EntrySelected, this.
_onNetworkEntrySelected, this); |
| 316 this._nextExtensionIndex = 0; |
| 317 |
| 314 Bindings.blackboxManager.addChangeListener(this.refreshRecords, this); | 318 Bindings.blackboxManager.addChangeListener(this.refreshRecords, this); |
| 315 } | 319 } |
| 316 | 320 |
| 317 /** | 321 /** |
| 318 * @override | 322 * @override |
| 319 */ | 323 */ |
| 320 dispose() { | 324 dispose() { |
| 321 this._mainView.removeEventListener(UI.FlameChart.Events.EntrySelected, this.
_onMainEntrySelected, this); | 325 this._mainView.removeEventListener(UI.FlameChart.Events.EntrySelected, this.
_onMainEntrySelected, this); |
| 322 this._networkView.removeEventListener(UI.FlameChart.Events.EntrySelected, th
is._onNetworkEntrySelected, this); | 326 this._networkView.removeEventListener(UI.FlameChart.Events.EntrySelected, th
is._onNetworkEntrySelected, this); |
| 323 Bindings.blackboxManager.removeChangeListener(this.refreshRecords, this); | 327 Bindings.blackboxManager.removeChangeListener(this.refreshRecords, this); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 347 */ | 351 */ |
| 348 updateRangeSelection(startTime, endTime) { | 352 updateRangeSelection(startTime, endTime) { |
| 349 this._delegate.select(Timeline.TimelineSelection.fromRange(startTime, endTim
e)); | 353 this._delegate.select(Timeline.TimelineSelection.fromRange(startTime, endTim
e)); |
| 350 } | 354 } |
| 351 | 355 |
| 352 /** | 356 /** |
| 353 * @override | 357 * @override |
| 354 */ | 358 */ |
| 355 refreshRecords() { | 359 refreshRecords() { |
| 356 this._dataProvider.reset(); | 360 this._dataProvider.reset(); |
| 361 this._nextExtensionIndex = 0; |
| 362 this.extensionDataAdded(); |
| 357 this._mainView.scheduleUpdate(); | 363 this._mainView.scheduleUpdate(); |
| 364 |
| 358 this._networkDataProvider.reset(); | 365 this._networkDataProvider.reset(); |
| 359 this._networkView.scheduleUpdate(); | 366 this._networkView.scheduleUpdate(); |
| 360 } | 367 } |
| 361 | 368 |
| 362 /** | 369 /** |
| 363 * @override | 370 * @override |
| 371 */ |
| 372 extensionDataAdded() { |
| 373 while (this._nextExtensionIndex < this._extensionModels.length) |
| 374 this._dataProvider.appendExtensionEvents(this._extensionModels[this._nextE
xtensionIndex++]); |
| 375 this._mainView.scheduleUpdate(); |
| 376 } |
| 377 |
| 378 /** |
| 379 * @override |
| 364 * @param {?SDK.TracingModel.Event} event | 380 * @param {?SDK.TracingModel.Event} event |
| 365 */ | 381 */ |
| 366 highlightEvent(event) { | 382 highlightEvent(event) { |
| 367 var entryIndex = | 383 var entryIndex = |
| 368 event ? this._dataProvider.entryIndexForSelection(Timeline.TimelineSelec
tion.fromTraceEvent(event)) : -1; | 384 event ? this._dataProvider.entryIndexForSelection(Timeline.TimelineSelec
tion.fromTraceEvent(event)) : -1; |
| 369 if (entryIndex >= 0) | 385 if (entryIndex >= 0) |
| 370 this._mainView.highlightEntry(entryIndex); | 386 this._mainView.highlightEntry(entryIndex); |
| 371 else | 387 else |
| 372 this._mainView.hideHighlight(); | 388 this._mainView.hideHighlight(); |
| 373 } | 389 } |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 Timeline.TimelineFlameChartView.Selection = class { | 485 Timeline.TimelineFlameChartView.Selection = class { |
| 470 /** | 486 /** |
| 471 * @param {!Timeline.TimelineSelection} selection | 487 * @param {!Timeline.TimelineSelection} selection |
| 472 * @param {number} entryIndex | 488 * @param {number} entryIndex |
| 473 */ | 489 */ |
| 474 constructor(selection, entryIndex) { | 490 constructor(selection, entryIndex) { |
| 475 this.timelineSelection = selection; | 491 this.timelineSelection = selection; |
| 476 this.entryIndex = entryIndex; | 492 this.entryIndex = entryIndex; |
| 477 } | 493 } |
| 478 }; | 494 }; |
| OLD | NEW |