| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2012 Intel Inc. All rights reserved. | 3 * Copyright (C) 2012 Intel Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 this._overviewPane.addEventListener( | 95 this._overviewPane.addEventListener( |
| 96 PerfUI.TimelineOverviewPane.Events.WindowChanged, this._onWindowChanged.
bind(this)); | 96 PerfUI.TimelineOverviewPane.Events.WindowChanged, this._onWindowChanged.
bind(this)); |
| 97 this._overviewPane.show(topPaneElement); | 97 this._overviewPane.show(topPaneElement); |
| 98 /** @type {!Array<!Timeline.TimelineEventOverview>} */ | 98 /** @type {!Array<!Timeline.TimelineEventOverview>} */ |
| 99 this._overviewControls = []; | 99 this._overviewControls = []; |
| 100 | 100 |
| 101 this._statusPaneContainer = this._timelinePane.element.createChild('div', 's
tatus-pane-container fill'); | 101 this._statusPaneContainer = this._timelinePane.element.createChild('div', 's
tatus-pane-container fill'); |
| 102 | 102 |
| 103 this._createFileSelector(); | 103 this._createFileSelector(); |
| 104 | 104 |
| 105 SDK.targetManager.addEventListener(SDK.TargetManager.Events.PageReloadReques
ted, this._pageReloadRequested, this); | 105 SDK.targetManager.addModelListener( |
| 106 SDK.targetManager.addEventListener(SDK.TargetManager.Events.Load, this._load
EventFired, this); | 106 SDK.ResourceTreeModel, SDK.ResourceTreeModel.Events.PageReloadRequested,
this._pageReloadRequested, this); |
| 107 SDK.targetManager.addModelListener( |
| 108 SDK.ResourceTreeModel, SDK.ResourceTreeModel.Events.Load, this._loadEven
tFired, this); |
| 107 | 109 |
| 108 if (Runtime.experiments.isEnabled('timelineMultipleMainViews')) { | 110 if (Runtime.experiments.isEnabled('timelineMultipleMainViews')) { |
| 109 var viewMode = Timeline.TimelinePanel.ViewMode; | 111 var viewMode = Timeline.TimelinePanel.ViewMode; |
| 110 this._tabbedPane = new UI.TabbedPane(); | 112 this._tabbedPane = new UI.TabbedPane(); |
| 111 this._tabbedPane.appendTab(viewMode.FlameChart, Common.UIString('Flame Cha
rt'), new UI.VBox()); | 113 this._tabbedPane.appendTab(viewMode.FlameChart, Common.UIString('Flame Cha
rt'), new UI.VBox()); |
| 112 this._tabbedPane.appendTab(viewMode.BottomUp, Common.UIString('Bottom-Up')
, new UI.VBox()); | 114 this._tabbedPane.appendTab(viewMode.BottomUp, Common.UIString('Bottom-Up')
, new UI.VBox()); |
| 113 this._tabbedPane.appendTab(viewMode.CallTree, Common.UIString('Call Tree')
, new UI.VBox()); | 115 this._tabbedPane.appendTab(viewMode.CallTree, Common.UIString('Call Tree')
, new UI.VBox()); |
| 114 this._tabbedPane.appendTab(viewMode.EventLog, Common.UIString('Event Log')
, new UI.VBox()); | 116 this._tabbedPane.appendTab(viewMode.EventLog, Common.UIString('Event Log')
, new UI.VBox()); |
| 115 this._tabbedPane.addEventListener(UI.TabbedPane.Events.TabSelected, this._
onMainViewChanged.bind(this)); | 117 this._tabbedPane.addEventListener(UI.TabbedPane.Events.TabSelected, this._
onMainViewChanged.bind(this)); |
| 116 this._tabbedPane.selectTab(this._viewModeSetting.get()); | 118 this._tabbedPane.selectTab(this._viewModeSetting.get()); |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 } | 496 } |
| 495 | 497 |
| 496 /** | 498 /** |
| 497 * @param {boolean} enabled | 499 * @param {boolean} enabled |
| 498 */ | 500 */ |
| 499 _setUIControlsEnabled(enabled) { | 501 _setUIControlsEnabled(enabled) { |
| 500 this._recordingOptionUIControls.forEach(control => control.setEnabled(enable
d)); | 502 this._recordingOptionUIControls.forEach(control => control.setEnabled(enable
d)); |
| 501 } | 503 } |
| 502 | 504 |
| 503 /** | 505 /** |
| 506 * @param {!SDK.TracingManager} tracingManager |
| 504 * @param {boolean} userInitiated | 507 * @param {boolean} userInitiated |
| 505 * @return {!Promise} | 508 * @return {!Promise} |
| 506 */ | 509 */ |
| 507 _startRecording(userInitiated) { | 510 _startRecording(tracingManager, userInitiated) { |
| 508 console.assert(!this._statusPane, 'Status pane is already opened.'); | 511 console.assert(!this._statusPane, 'Status pane is already opened.'); |
| 509 var tracingManagers = SDK.targetManager.models(SDK.TracingManager); | |
| 510 if (!tracingManagers.length) | |
| 511 return Promise.resolve(); | |
| 512 this._setState(Timeline.TimelinePanel.State.StartPending); | 512 this._setState(Timeline.TimelinePanel.State.StartPending); |
| 513 this._showRecordingStarted(); | 513 this._showRecordingStarted(); |
| 514 | 514 |
| 515 this._autoRecordGeneration = userInitiated ? null : Symbol('Generation'); | 515 this._autoRecordGeneration = userInitiated ? null : {tracingManager: tracing
Manager}; |
| 516 var enabledTraceProviders = Extensions.extensionServer.traceProviders().filt
er( | 516 var enabledTraceProviders = Extensions.extensionServer.traceProviders().filt
er( |
| 517 provider => Timeline.TimelinePanel._settingForTraceProvider(provider).ge
t()); | 517 provider => Timeline.TimelinePanel._settingForTraceProvider(provider).ge
t()); |
| 518 | 518 |
| 519 const recordingOptions = { | 519 const recordingOptions = { |
| 520 enableJSSampling: !this._disableCaptureJSProfileSetting.get(), | 520 enableJSSampling: !this._disableCaptureJSProfileSetting.get(), |
| 521 capturePictures: this._captureLayersAndPicturesSetting.get(), | 521 capturePictures: this._captureLayersAndPicturesSetting.get(), |
| 522 captureFilmStrip: this._showScreenshotsSetting.get() | 522 captureFilmStrip: this._showScreenshotsSetting.get() |
| 523 }; | 523 }; |
| 524 | 524 |
| 525 this._pendingPerformanceModel = new Timeline.PerformanceModel(); | 525 this._pendingPerformanceModel = new Timeline.PerformanceModel(); |
| 526 this._controller = new Timeline.TimelineController(tracingManagers[0], this.
_pendingPerformanceModel, this); | 526 this._controller = new Timeline.TimelineController(tracingManager, this._pen
dingPerformanceModel, this); |
| 527 Host.userMetrics.actionTaken( | 527 Host.userMetrics.actionTaken( |
| 528 userInitiated ? Host.UserMetrics.Action.TimelineStarted : Host.UserMetri
cs.Action.TimelinePageReloadStarted); | 528 userInitiated ? Host.UserMetrics.Action.TimelineStarted : Host.UserMetri
cs.Action.TimelinePageReloadStarted); |
| 529 this._setUIControlsEnabled(false); | 529 this._setUIControlsEnabled(false); |
| 530 this._hideLandingPage(); | 530 this._hideLandingPage(); |
| 531 return this._controller.startRecording(recordingOptions, enabledTraceProvide
rs) | 531 return this._controller.startRecording(recordingOptions, enabledTraceProvide
rs) |
| 532 .then(() => this._recordingStarted()); | 532 .then(() => this._recordingStarted()); |
| 533 } | 533 } |
| 534 | 534 |
| 535 _stopRecording() { | 535 _stopRecording() { |
| 536 if (this._statusPane) { | 536 if (this._statusPane) { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 551 | 551 |
| 552 _updateTimelineControls() { | 552 _updateTimelineControls() { |
| 553 var state = Timeline.TimelinePanel.State; | 553 var state = Timeline.TimelinePanel.State; |
| 554 this._toggleRecordAction.setToggled(this._state === state.Recording); | 554 this._toggleRecordAction.setToggled(this._state === state.Recording); |
| 555 this._toggleRecordAction.setEnabled(this._state === state.Recording || this.
_state === state.Idle); | 555 this._toggleRecordAction.setEnabled(this._state === state.Recording || this.
_state === state.Idle); |
| 556 this._panelToolbar.setEnabled(this._state !== state.Loading); | 556 this._panelToolbar.setEnabled(this._state !== state.Loading); |
| 557 this._dropTarget.setEnabled(this._state === state.Idle); | 557 this._dropTarget.setEnabled(this._state === state.Idle); |
| 558 } | 558 } |
| 559 | 559 |
| 560 _toggleRecording() { | 560 _toggleRecording() { |
| 561 if (this._state === Timeline.TimelinePanel.State.Idle) | 561 if (this._state === Timeline.TimelinePanel.State.Idle) { |
| 562 this._startRecording(true); | 562 var tracingManagers = SDK.targetManager.models(SDK.TracingManager); |
| 563 else if (this._state === Timeline.TimelinePanel.State.Recording) | 563 if (tracingManagers.length) |
| 564 this._startRecording(tracingManagers[0], true); |
| 565 } else if (this._state === Timeline.TimelinePanel.State.Recording) { |
| 564 this._stopRecording(); | 566 this._stopRecording(); |
| 567 } |
| 565 } | 568 } |
| 566 | 569 |
| 567 _clear() { | 570 _clear() { |
| 568 this._showLandingPage(); | 571 this._showLandingPage(); |
| 569 this._reset(); | 572 this._reset(); |
| 570 } | 573 } |
| 571 | 574 |
| 572 _reset() { | 575 _reset() { |
| 573 PerfUI.LineLevelProfile.instance().reset(); | 576 PerfUI.LineLevelProfile.instance().reset(); |
| 574 this._setModel(null); | 577 this._setModel(null); |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 778 this._overviewPane.setMarkers(markers); | 781 this._overviewPane.setMarkers(markers); |
| 779 } | 782 } |
| 780 | 783 |
| 781 /** | 784 /** |
| 782 * @param {!Common.Event} event | 785 * @param {!Common.Event} event |
| 783 */ | 786 */ |
| 784 _pageReloadRequested(event) { | 787 _pageReloadRequested(event) { |
| 785 if (this._state !== Timeline.TimelinePanel.State.Idle || !this.isShowing()) | 788 if (this._state !== Timeline.TimelinePanel.State.Idle || !this.isShowing()) |
| 786 return; | 789 return; |
| 787 var resourceTreeModel = /** @type {!SDK.ResourceTreeModel} */ (event.data); | 790 var resourceTreeModel = /** @type {!SDK.ResourceTreeModel} */ (event.data); |
| 791 var tracingManager = resourceTreeModel.target().model(SDK.TracingManager); |
| 792 if (resourceTreeModel.target() !== SDK.targetManager.mainTarget() || !tracin
gManager) |
| 793 return; |
| 794 |
| 788 resourceTreeModel.suspendReload(); | 795 resourceTreeModel.suspendReload(); |
| 789 this._startRecording(false).then(() => resourceTreeModel.resumeReload()); | 796 this._startRecording(tracingManager, false).then(() => resourceTreeModel.res
umeReload()); |
| 790 } | 797 } |
| 791 | 798 |
| 792 /** | 799 /** |
| 793 * @param {!Common.Event} event | 800 * @param {!Common.Event} event |
| 794 */ | 801 */ |
| 795 _loadEventFired(event) { | 802 _loadEventFired(event) { |
| 796 if (this._state !== Timeline.TimelinePanel.State.Recording || !this._autoRec
ordGeneration) | 803 if (this._state !== Timeline.TimelinePanel.State.Recording || !this._autoRec
ordGeneration || |
| 804 this._autoRecordGeneration.tracingManager.target() !== event.data.resour
ceTreeModel.target()) |
| 797 return; | 805 return; |
| 798 setTimeout(stopRecordingOnReload.bind(this, this._autoRecordGeneration), thi
s._millisecondsToRecordAfterLoadEvent); | 806 setTimeout(stopRecordingOnReload.bind(this, this._autoRecordGeneration), thi
s._millisecondsToRecordAfterLoadEvent); |
| 799 | 807 |
| 800 /** | 808 /** |
| 801 * @this {Timeline.TimelinePanel} | 809 * @this {Timeline.TimelinePanel} |
| 802 * @param {!Object} recordGeneration | 810 * @param {!Object} recordGeneration |
| 803 */ | 811 */ |
| 804 function stopRecordingOnReload(recordGeneration) { | 812 function stopRecordingOnReload(recordGeneration) { |
| 805 // Check if we're still in the same recording session. | 813 // Check if we're still in the same recording session. |
| 806 if (this._state !== Timeline.TimelinePanel.State.Recording || this._autoRe
cordGeneration !== recordGeneration) | 814 if (this._state !== Timeline.TimelinePanel.State.Recording || this._autoRe
cordGeneration !== recordGeneration) |
| (...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1288 return true; | 1296 return true; |
| 1289 case 'timeline.jump-to-next-frame': | 1297 case 'timeline.jump-to-next-frame': |
| 1290 panel._jumpToFrame(1); | 1298 panel._jumpToFrame(1); |
| 1291 return true; | 1299 return true; |
| 1292 } | 1300 } |
| 1293 return false; | 1301 return false; |
| 1294 } | 1302 } |
| 1295 }; | 1303 }; |
| 1296 | 1304 |
| 1297 Timeline.TimelinePanel._traceProviderSettingSymbol = Symbol('traceProviderSettin
g'); | 1305 Timeline.TimelinePanel._traceProviderSettingSymbol = Symbol('traceProviderSettin
g'); |
| OLD | NEW |