Bug 1538731 - Stop using async methods in performance panel initializer.js;r=daisuke
☠☠ backed out by 54e502f0f78e ☠ ☠
authorJulian Descottes <jdescottes@mozilla.com>
Thu, 11 Apr 2019 09:36:14 +0000
changeset 468973 769d9b3bdd4e5c5706744867d79171a092d3fcee
parent 468972 040df193736f2274ca87a23d0fb405b4a0f2e1f2
child 468974 ff05581f5fe0125940697e9e3332bd84481dad98
push id35856
push usercsabou@mozilla.com
push dateFri, 12 Apr 2019 03:19:48 +0000
treeherdermozilla-central@940684cd1065 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdaisuke
bugs1538731, 1524982
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
devtools/client/performance/initializer.js
devtools/client/performance/panel.js
--- a/devtools/client/performance/initializer.js
+++ b/devtools/client/performance/initializer.js
@@ -21,34 +21,16 @@ const { MemoryFlameGraphView } = require
 const { OverviewView } = require("./views/overview");
 const { RecordingsView } = require("./views/recordings");
 const { ToolbarView } = require("./views/toolbar");
 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
  * some modules and tests are still relying on those references so we keep exposing them
  * for the moment. Bug 1528777.
  */
 window.PerformanceController = PerformanceController;
 window.PerformanceView = PerformanceView;
 window.DetailsView = DetailsView;
@@ -57,18 +39,16 @@ window.JsCallTreeView = JsCallTreeView;
 window.JsFlameGraphView = JsFlameGraphView;
 window.MemoryCallTreeView = MemoryCallTreeView;
 window.MemoryFlameGraphView = MemoryFlameGraphView;
 window.OverviewView = OverviewView;
 window.RecordingsView = RecordingsView;
 window.ToolbarView = ToolbarView;
 window.WaterfallView = WaterfallView;
 
-window.shutdownPerformance = shutdownPerformance;
-window.startupPerformance = startupPerformance;
 window.EVENTS = EVENTS;
 
 /**
  * DOM query helpers.
  */
 /* exported $, $$ */
 function $(selector, target = document) {
   return target.querySelector(selector);
--- a/devtools/client/performance/panel.js
+++ b/devtools/client/performance/panel.js
@@ -44,20 +44,23 @@ PerformancePanel.prototype = {
 
     // This should only happen if this is completely unsupported (when profiler
     // does not exist), and in that case, the tool shouldn't be available,
     // so let's ensure this assertion.
     if (!front) {
       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
     // tab if we need.
     this._checkRecordingStatus();
 
     this.isReady = true;
     this.emit("ready");
@@ -75,20 +78,23 @@ PerformancePanel.prototype = {
   },
 
   async destroy() {
     // Make sure this panel is not already destroyed.
     if (this._destroyed) {
       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;
   },
 
   _checkRecordingStatus: function() {
     if (this.panelWin.PerformanceController.isRecording()) {
       this.toolbox.highlightTool("performance");