Bug 1538731 - Stop using async methods in performance panel initializer.js;r=daisuke

Follow up to 1524982. We started using the browserloader to load almost all perf panel files.
However we kept two async methods in the js file loaded by performance/index.xul, which defeated the purpose.

Differential Revision: https://phabricator.services.mozilla.com/D26899

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Julian Descottes 2019-04-11 09:36:14 +00:00
parent 7b45ebc476
commit fecd3641a7
2 changed files with 10 additions and 24 deletions

View File

@ -25,24 +25,6 @@ const { WaterfallView } = require("./views/details-waterfall");
const EVENTS = require("./events");
/**
* Initializes the profiler controller and views.
*/
const startupPerformance = async function(toolbox, target, front) {
await PerformanceController.initialize(toolbox, target, front);
await PerformanceView.initialize();
PerformanceController.enableFrontEventListeners();
};
/**
* Destroys the profiler controller and views.
*/
const shutdownPerformance = async function() {
await PerformanceController.destroy();
await PerformanceView.destroy();
PerformanceController.disableFrontEventListeners();
};
/**
* The performance panel used to only share modules through references on the window
* object. We started cleaning this up and to require() explicitly in Bug 1524982, but
@ -62,8 +44,6 @@ window.RecordingsView = RecordingsView;
window.ToolbarView = ToolbarView;
window.WaterfallView = WaterfallView;
window.shutdownPerformance = shutdownPerformance;
window.startupPerformance = startupPerformance;
window.EVENTS = EVENTS;
/**

View File

@ -49,10 +49,13 @@ PerformancePanel.prototype = {
console.error("No PerformanceFront found in toolbox.");
}
const { startupPerformance, PerformanceController, EVENTS } = this.panelWin;
const { PerformanceController, PerformanceView, EVENTS } = this.panelWin;
PerformanceController.on(EVENTS.RECORDING_ADDED, this._checkRecordingStatus);
PerformanceController.on(EVENTS.RECORDING_STATE_CHANGE, this._checkRecordingStatus);
await startupPerformance(this.toolbox, this.target, front);
await PerformanceController.initialize(this.toolbox, this.target, front);
await PerformanceView.initialize();
PerformanceController.enableFrontEventListeners();
// Fire this once incase we have an in-progress recording (console profile)
// that caused this start up, and no state change yet, so we can highlight the
@ -80,10 +83,13 @@ PerformancePanel.prototype = {
return;
}
const { shutdownPerformance, PerformanceController, EVENTS } = this.panelWin;
const { PerformanceController, PerformanceView, EVENTS } = this.panelWin;
PerformanceController.off(EVENTS.RECORDING_ADDED, this._checkRecordingStatus);
PerformanceController.off(EVENTS.RECORDING_STATE_CHANGE, this._checkRecordingStatus);
await shutdownPerformance();
await PerformanceController.destroy();
await PerformanceView.destroy();
PerformanceController.disableFrontEventListeners();
this.emit("destroyed");
this._destroyed = true;