Bug 1382603 - Remove old-event-emitter usage from performance panel; r=gregtatum. draft
authorNicolas Chevobbe <nchevobbe@mozilla.com>
Thu, 22 Mar 2018 14:16:51 +0100
changeset 771128 841f4a356e00a7cb6edcc4b7deca1a4cecec4ab0
parent 770928 b41c7c1ff91f49b1500b087ff23c288dd88f1fde
child 771129 b0c8b5490c8217e34cee5faafca62a4968b844f0
child 771147 5fece05d056be69a5f0b8f6ecd123fa824a61d1a
push id103572
push userbmo:nchevobbe@mozilla.com
push dateThu, 22 Mar 2018 14:20:33 +0000
reviewersgregtatum
bugs1382603
milestone61.0a1
Bug 1382603 - Remove old-event-emitter usage from performance panel; r=gregtatum. MozReview-Commit-ID: F7VCMbWwPRH
devtools/client/performance/modules/logic/telemetry.js
devtools/client/performance/modules/widgets/graphs.js
devtools/client/performance/modules/widgets/marker-details.js
devtools/client/performance/panel.js
devtools/client/performance/performance-controller.js
devtools/client/performance/performance-view.js
devtools/client/performance/views/details-abstract-subview.js
devtools/client/performance/views/details-js-call-tree.js
devtools/client/performance/views/details-js-flamegraph.js
devtools/client/performance/views/details-memory-call-tree.js
devtools/client/performance/views/details-memory-flamegraph.js
devtools/client/performance/views/details-waterfall.js
devtools/client/performance/views/details.js
devtools/client/performance/views/overview.js
devtools/client/performance/views/recordings.js
--- a/devtools/client/performance/modules/logic/telemetry.js
+++ b/devtools/client/performance/modules/logic/telemetry.js
@@ -21,17 +21,17 @@ const SELECTED_VIEW_HISTOGRAM_NAME = "DE
 function PerformanceTelemetry(emitter) {
   this._emitter = emitter;
   this._telemetry = new Telemetry();
   this.onFlagEvent = this.onFlagEvent.bind(this);
   this.onRecordingStateChange = this.onRecordingStateChange.bind(this);
   this.onViewSelected = this.onViewSelected.bind(this);
 
   for (let [event] of EVENT_MAP_FLAGS) {
-    this._emitter.on(event, this.onFlagEvent);
+    this._emitter.on(event, this.onFlagEvent.bind(this, event));
   }
 
   this._emitter.on(EVENTS.RECORDING_STATE_CHANGE, this.onRecordingStateChange);
   this._emitter.on(EVENTS.UI_DETAILS_VIEW_SELECTED, this.onViewSelected);
 
   if (flags.testing) {
     this.recordLogs();
   }
@@ -50,17 +50,17 @@ PerformanceTelemetry.prototype.destroy =
   this._emitter.off(EVENTS.UI_DETAILS_VIEW_SELECTED, this.onViewSelected);
   this._emitter = null;
 };
 
 PerformanceTelemetry.prototype.onFlagEvent = function(eventName, ...data) {
   this._telemetry.log(EVENT_MAP_FLAGS.get(eventName), true);
 };
 
-PerformanceTelemetry.prototype.onRecordingStateChange = function(_, status, model) {
+PerformanceTelemetry.prototype.onRecordingStateChange = function(status, model) {
   if (status != "recording-stopped") {
     return;
   }
 
   if (model.isConsole()) {
     this._telemetry.log("DEVTOOLS_PERFTOOLS_CONSOLE_RECORDING_COUNT", true);
   } else {
     this._telemetry.log("DEVTOOLS_PERFTOOLS_RECORDING_COUNT", true);
@@ -72,17 +72,17 @@ PerformanceTelemetry.prototype.onRecordi
   for (let k in config) {
     if (RECORDING_FEATURES.includes(k)) {
       this._telemetry.logKeyed("DEVTOOLS_PERFTOOLS_RECORDING_FEATURES_USED", k,
                                config[k]);
     }
   }
 };
 
-PerformanceTelemetry.prototype.onViewSelected = function(_, viewName) {
+PerformanceTelemetry.prototype.onViewSelected = function(viewName) {
   if (this._previousView) {
     this._telemetry.stopTimer(SELECTED_VIEW_HISTOGRAM_NAME, this._previousView);
   }
   this._previousView = viewName;
   this._telemetry.startTimer(SELECTED_VIEW_HISTOGRAM_NAME);
 };
 
 /**
--- a/devtools/client/performance/modules/widgets/graphs.js
+++ b/devtools/client/performance/modules/widgets/graphs.js
@@ -8,17 +8,17 @@
  */
 
 const { extend } = require("devtools/shared/extend");
 const LineGraphWidget = require("devtools/client/shared/widgets/LineGraphWidget");
 const MountainGraphWidget = require("devtools/client/shared/widgets/MountainGraphWidget");
 const { CanvasGraphUtils } = require("devtools/client/shared/widgets/Graphs");
 
 const defer = require("devtools/shared/defer");
-const EventEmitter = require("devtools/shared/old-event-emitter");
+const EventEmitter = require("devtools/shared/event-emitter");
 
 const { colorUtils } = require("devtools/shared/css/color");
 const { getColor } = require("devtools/client/shared/theme");
 const ProfilerGlobal = require("devtools/client/performance/modules/global");
 const { MarkersOverview } = require("devtools/client/performance/modules/widgets/markers-overview");
 const { createTierGraphDataFromFrameNode } = require("devtools/client/performance/modules/logic/jit");
 
 /**
--- a/devtools/client/performance/modules/widgets/marker-details.js
+++ b/devtools/client/performance/modules/widgets/marker-details.js
@@ -2,17 +2,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 "use strict";
 
 /**
  * This file contains the rendering code for the marker sidebar.
  */
 
-const EventEmitter = require("devtools/shared/old-event-emitter");
+const EventEmitter = require("devtools/shared/event-emitter");
 const { MarkerDOMUtils } = require("devtools/client/performance/modules/marker-dom-utils");
 
 /**
  * A detailed view for one single marker.
  *
  * @param nsIDOMNode parent
  *        The parent node holding the view.
  * @param nsIDOMNode splitter
--- a/devtools/client/performance/panel.js
+++ b/devtools/client/performance/panel.js
@@ -2,18 +2,17 @@
 /* vim: set ft=javascript ts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 "use strict";
 
 const defer = require("devtools/shared/defer");
 
-loader.lazyRequireGetter(this, "EventEmitter",
-  "devtools/shared/old-event-emitter");
+loader.lazyRequireGetter(this, "EventEmitter", "devtools/shared/event-emitter");
 
 function PerformancePanel(iframeWindow, toolbox) {
   this.panelWin = iframeWindow;
   this.toolbox = toolbox;
 
   EventEmitter.decorate(this);
 }
 
--- a/devtools/client/performance/performance-controller.js
+++ b/devtools/client/performance/performance-controller.js
@@ -39,17 +39,17 @@ var JITOptimizationsView = React.createF
 var RecordingControls = React.createFactory(require("devtools/client/performance/components/recording-controls"));
 var RecordingButton = React.createFactory(require("devtools/client/performance/components/recording-button"));
 var RecordingList = React.createFactory(require("devtools/client/performance/components/recording-list"));
 var RecordingListItem = React.createFactory(require("devtools/client/performance/components/recording-list-item"));
 
 var Services = require("Services");
 var promise = require("promise");
 const defer = require("devtools/shared/defer");
-var EventEmitter = require("devtools/shared/old-event-emitter");
+var EventEmitter = require("devtools/shared/event-emitter");
 var DevToolsUtils = require("devtools/shared/DevToolsUtils");
 var flags = require("devtools/shared/flags");
 var system = require("devtools/shared/system");
 
 // Logic modules
 /* exported L10N, PerformanceTelemetry, TIMELINE_BLUEPRINT, RecordingUtils,
    PerformanceUtils, OptimizationsGraph, GraphsController,
    MarkerDetails, MarkerBlueprintUtils, WaterfallUtils, FrameUtils, CallView, ThreadNode,
@@ -122,35 +122,41 @@ var PerformanceController = {
     this.startRecording = this.startRecording.bind(this);
     this.stopRecording = this.stopRecording.bind(this);
     this.importRecording = this.importRecording.bind(this);
     this.exportRecording = this.exportRecording.bind(this);
     this.clearRecordings = this.clearRecordings.bind(this);
     this._onRecordingSelectFromView = this._onRecordingSelectFromView.bind(this);
     this._onPrefChanged = this._onPrefChanged.bind(this);
     this._onThemeChanged = this._onThemeChanged.bind(this);
-    this._onFrontEvent = this._onFrontEvent.bind(this);
-    this._pipe = this._pipe.bind(this);
+    this._onDetailsViewSelected = this._onDetailsViewSelected.bind(this);
+    this._onProfilerStatus = this._onProfilerStatus.bind(this);
+    this._onRecordingStarted =
+      this._emitRecordingStateChange.bind(this, "recording-started");
+    this._onRecordingStopping =
+      this._emitRecordingStateChange.bind(this, "recording-stopping");
+    this._onRecordingStopped =
+      this._emitRecordingStateChange.bind(this, "recording-stopped");
 
     // Store data regarding if e10s is enabled.
     this._e10s = Services.appinfo.browserTabsRemoteAutostart;
     this._setMultiprocessAttributes();
 
     this._prefs = require("devtools/client/performance/modules/global").PREFS;
     this._prefs.registerObserver();
     this._prefs.on("pref-changed", this._onPrefChanged);
 
     ToolbarView.on(EVENTS.UI_PREF_CHANGED, this._onPrefChanged);
     PerformanceView.on(EVENTS.UI_START_RECORDING, this.startRecording);
     PerformanceView.on(EVENTS.UI_STOP_RECORDING, this.stopRecording);
     PerformanceView.on(EVENTS.UI_IMPORT_RECORDING, this.importRecording);
     PerformanceView.on(EVENTS.UI_CLEAR_RECORDINGS, this.clearRecordings);
     RecordingsView.on(EVENTS.UI_EXPORT_RECORDING, this.exportRecording);
     RecordingsView.on(EVENTS.UI_RECORDING_SELECTED, this._onRecordingSelectFromView);
-    DetailsView.on(EVENTS.UI_DETAILS_VIEW_SELECTED, this._pipe);
+    DetailsView.on(EVENTS.UI_DETAILS_VIEW_SELECTED, this._onDetailsViewSelected);
 
     this._prefObserver = new PrefObserver("devtools.");
     this._prefObserver.on("devtools.theme", this._onThemeChanged);
   },
 
   /**
    * Remove events handled by the PerformanceController
    */
@@ -161,41 +167,47 @@ var PerformanceController = {
 
     ToolbarView.off(EVENTS.UI_PREF_CHANGED, this._onPrefChanged);
     PerformanceView.off(EVENTS.UI_START_RECORDING, this.startRecording);
     PerformanceView.off(EVENTS.UI_STOP_RECORDING, this.stopRecording);
     PerformanceView.off(EVENTS.UI_IMPORT_RECORDING, this.importRecording);
     PerformanceView.off(EVENTS.UI_CLEAR_RECORDINGS, this.clearRecordings);
     RecordingsView.off(EVENTS.UI_EXPORT_RECORDING, this.exportRecording);
     RecordingsView.off(EVENTS.UI_RECORDING_SELECTED, this._onRecordingSelectFromView);
-    DetailsView.off(EVENTS.UI_DETAILS_VIEW_SELECTED, this._pipe);
+    DetailsView.off(EVENTS.UI_DETAILS_VIEW_SELECTED, this._onDetailsViewSelected);
 
     this._prefObserver.off("devtools.theme", this._onThemeChanged);
     this._prefObserver.destroy();
   },
 
   /**
    * Enables front event listeners.
    *
    * The rationale behind this is given by the async intialization of all the
    * frontend components. Even though the panel is considered "open" only after
    * both the controller and the view are created, and even though their
    * initialization is sequential (controller, then view), the controller might
    * start handling backend events before the view finishes if the event
    * listeners are added too soon.
    */
   enableFrontEventListeners: function() {
-    gFront.on("*", this._onFrontEvent);
+    gFront.on("profiler-status", this._onProfilerStatus);
+    gFront.on("recording-started", this._onRecordingStarted);
+    gFront.on("recording-stopping", this._onRecordingStopping);
+    gFront.on("recording-stopped", this._onRecordingStopped);
   },
 
   /**
    * Disables front event listeners.
    */
   disableFrontEventListeners: function() {
-    gFront.off("*", this._onFrontEvent);
+    gFront.off("profiler-status", this._onProfilerStatus);
+    gFront.off("recording-started", this._onRecordingStarted);
+    gFront.off("recording-stopping", this._onRecordingStopping);
+    gFront.off("recording-stopped", this._onRecordingStopped);
   },
 
   /**
    * Returns the current devtools theme.
    */
   getTheme: function() {
     return Services.prefs.getCharPref("devtools.theme");
   },
@@ -293,17 +305,17 @@ var PerformanceController = {
    * Saves the given recording to a file. Emits `EVENTS.RECORDING_EXPORTED`
    * when the file was saved.
    *
    * @param PerformanceRecording recording
    *        The model that holds the recording data.
    * @param nsIFile file
    *        The file to stream the data into.
    */
-  async exportRecording(_, recording, file) {
+  async exportRecording(recording, file) {
     await recording.exportRecording(file);
     this.emit(EVENTS.RECORDING_EXPORTED, recording, file);
   },
 
    /**
    * Clears all completed recordings from the list as well as the current non-console
    * recording. Emits `EVENTS.RECORDING_DELETED` when complete so other components can
    * clean up.
@@ -337,17 +349,17 @@ var PerformanceController = {
 
   /**
    * Loads a recording from a file, adding it to the recordings list. Emits
    * `EVENTS.RECORDING_IMPORTED` when the file was loaded.
    *
    * @param nsIFile file
    *        The file to import the data from.
    */
-  async importRecording(_, file) {
+  async importRecording(file) {
     let recording = await gFront.importRecording(file);
     this._addRecordingIfUnknown(recording);
 
     this.emit(EVENTS.RECORDING_IMPORTED, recording);
   },
 
   /**
    * Sets the currently active PerformanceRecording. Should rarely be called directly,
@@ -383,53 +395,43 @@ var PerformanceController = {
     }
     return null;
   },
 
   /**
    * Fired from RecordingsView, we listen on the PerformanceController so we can
    * set it here and re-emit on the controller, where all views can listen.
    */
-  _onRecordingSelectFromView: function(_, recording) {
+  _onRecordingSelectFromView: function(recording) {
     this.setCurrentRecording(recording);
   },
 
   /**
    * Fired when the ToolbarView fires a PREF_CHANGED event.
    * with the value.
    */
-  _onPrefChanged: function(_, prefName, prefValue) {
+  _onPrefChanged: function(prefName, prefValue) {
     this.emit(EVENTS.PREF_CHANGED, prefName, prefValue);
   },
 
   /*
    * Called when the developer tools theme changes.
    */
   _onThemeChanged: function() {
     let newValue = Services.prefs.getCharPref("devtools.theme");
     this.emit(EVENTS.THEME_CHANGED, newValue);
   },
 
-  /**
-   * Fired from the front on any event. Propagates to other handlers from here.
-   */
-  _onFrontEvent: function(eventName, ...data) {
-    switch (eventName) {
-      case "profiler-status":
-        let [profilerStatus] = data;
-        this.emit(EVENTS.RECORDING_PROFILER_STATUS_UPDATE, profilerStatus);
-        break;
-      case "recording-started":
-      case "recording-stopping":
-      case "recording-stopped":
-        let [recordingModel] = data;
-        this._addRecordingIfUnknown(recordingModel);
-        this.emit(EVENTS.RECORDING_STATE_CHANGE, eventName, recordingModel);
-        break;
-    }
+  _onProfilerStatus: function(status) {
+    this.emit(EVENTS.RECORDING_PROFILER_STATUS_UPDATE, status);
+  },
+
+  _emitRecordingStateChange(eventName, recordingModel) {
+    this._addRecordingIfUnknown(recordingModel);
+    this.emit(EVENTS.RECORDING_STATE_CHANGE, eventName, recordingModel);
   },
 
   /**
    * Stores a recording internally.
    *
    * @param {PerformanceRecordingFront} recording
    */
   _addRecordingIfUnknown: function(recording) {
@@ -556,20 +558,20 @@ var PerformanceController = {
   _setMultiprocessAttributes: function() {
     let { enabled } = this.getMultiprocessStatus();
     if (!enabled) {
       $("#performance-view").setAttribute("e10s", "disabled");
     }
   },
 
   /**
-   * Pipes an event from some source to the PerformanceController.
+   * Pipes EVENTS.UI_DETAILS_VIEW_SELECTED to the PerformanceController.
    */
-  _pipe: function(eventName, ...data) {
-    this.emit(eventName, ...data);
+  _onDetailsViewSelected: function(...data) {
+    this.emit(EVENTS.UI_DETAILS_VIEW_SELECTED, ...data);
   },
 
   toString: () => "[object PerformanceController]"
 };
 
 /**
  * Convenient way of emitting events from the controller.
  */
--- a/devtools/client/performance/performance-view.js
+++ b/devtools/client/performance/performance-view.js
@@ -319,17 +319,17 @@ var PerformanceView = {
     if (currentRecording && currentRecording.isRecording()) {
       this.updateBufferStatus();
     }
   },
 
   /**
    * When starting a recording has failed.
    */
-  _onNewRecordingFailed: function(e) {
+  _onNewRecordingFailed: function() {
     this._lockRecordButtons(false);
     this._toggleRecordButtons(false);
   },
 
   /**
    * Handler for clicking the clear button.
    */
   _onClearButtonClick: function(e) {
@@ -364,33 +364,33 @@ var PerformanceView = {
         this.emit(EVENTS.UI_IMPORT_RECORDING, fp.file);
       }
     });
   },
 
   /**
    * Fired when a recording is selected. Used to toggle the profiler view state.
    */
-  _onRecordingSelected: function(_, recording) {
+  _onRecordingSelected: function(recording) {
     if (!recording) {
       this.setState("empty");
     } else if (recording.isRecording() && recording.isConsole()) {
       this.setState("console-recording");
     } else if (recording.isRecording()) {
       this.setState("recording");
     } else {
       this.setState("recorded");
     }
   },
 
   /**
    * Fired when the controller has updated information on the buffer's status.
    * Update the buffer status display if shown.
    */
-  _onProfilerStatusUpdated: function(_, profilerStatus) {
+  _onProfilerStatusUpdated: function(profilerStatus) {
     // We only care about buffer status here, so check to see
     // if it has position.
     if (!profilerStatus || profilerStatus.position === void 0) {
       return;
     }
     // If this is our first buffer event, set the status and add a class
     if (!this._bufferStatusSupported) {
       this._bufferStatusSupported = true;
--- a/devtools/client/performance/views/details-abstract-subview.js
+++ b/devtools/client/performance/views/details-abstract-subview.js
@@ -106,17 +106,17 @@ var DetailsSubview = {
    * Flag specifying if this view should update while the overview selection
    * area is actively being dragged by the mouse.
    */
   shouldUpdateWhileMouseIsActive: false,
 
   /**
    * Called when recording stops or is selected.
    */
-  _onRecordingStoppedOrSelected: function(_, state, recording) {
+  _onRecordingStoppedOrSelected: function(state, recording) {
     if (typeof state !== "string") {
       recording = state;
     }
     if (arguments.length === 3 && state !== "recording-stopped") {
       return;
     }
 
     if (!recording || !recording.isCompleted()) {
@@ -127,17 +127,17 @@ var DetailsSubview = {
     } else {
       this.shouldUpdateWhenShown = true;
     }
   },
 
   /**
    * Fired when a range is selected or cleared in the OverviewView.
    */
-  _onOverviewRangeChange: function(_, interval) {
+  _onOverviewRangeChange: function(interval) {
     if (!this.requiresUpdateOnRangeChange) {
       return;
     }
     if (DetailsView.isViewSelected(this)) {
       let debounced = () => {
         if (!this.shouldUpdateWhileMouseIsActive && OverviewView.isMouseActive) {
           // Don't render yet, while the selection is still being dragged.
           setNamedTimeout("range-change-debounce", this.rangeChangeDebounceTime,
@@ -160,17 +160,17 @@ var DetailsSubview = {
       this.render(OverviewView.getTimeInterval());
       this.shouldUpdateWhenShown = false;
     }
   },
 
   /**
    * Fired when a preference in `devtools.performance.ui.` is changed.
    */
-  _onPrefChanged: function(_, prefName, prefValue) {
+  _onPrefChanged: function(prefName, prefValue) {
     if (~this.observedPrefs.indexOf(prefName) && this._onObservedPrefChange) {
       this._onObservedPrefChange(prefName);
     }
 
     // All detail views require a recording to be complete, so do not
     // attempt to render if recording is in progress or does not exist.
     let recording = PerformanceController.getCurrentRecording();
     if (!recording || !recording.isCompleted()) {
--- a/devtools/client/performance/views/details-js-call-tree.js
+++ b/devtools/client/performance/views/details-js-call-tree.js
@@ -114,17 +114,17 @@ var JsCallTreeView = extend(DetailsSubvi
     ReactDOM.render(optimizations, this.optimizationsElement);
 
     this.emit("focus", treeItem);
   },
 
   /**
    * Fired on the "link" event for the call tree in this container.
    */
-  _onLink: function(_, treeItem) {
+  _onLink: function(treeItem) {
     let { url, line } = treeItem.frame.getInfo();
     gToolbox.viewSourceInDebugger(url, line).then(success => {
       if (success) {
         this.emit(EVENTS.SOURCE_SHOWN_IN_JS_DEBUGGER);
       } else {
         this.emit(EVENTS.SOURCE_NOT_FOUND_IN_JS_DEBUGGER);
       }
     });
--- a/devtools/client/performance/views/details-js-flamegraph.js
+++ b/devtools/client/performance/views/details-js-flamegraph.js
@@ -109,17 +109,17 @@ var JsFlameGraphView = extend(DetailsSub
     let profile = recording.getProfile();
     let thread = profile.threads[0];
     FlameGraphUtils.removeFromCache(thread);
   },
 
   /**
    * Called when `devtools.theme` changes.
    */
-  _onThemeChanged: function(_, theme) {
+  _onThemeChanged: function(theme) {
     this.graph.setTheme(theme);
     this.graph.refresh({ force: true });
   },
 
   toString: () => "[object JsFlameGraphView]"
 });
 
 EventEmitter.decorate(JsFlameGraphView);
--- a/devtools/client/performance/views/details-memory-call-tree.js
+++ b/devtools/client/performance/views/details-memory-call-tree.js
@@ -51,17 +51,17 @@ var MemoryCallTreeView = extend(DetailsS
     let threadNode = this._prepareCallTree(allocations, interval, options);
     this._populateCallTree(threadNode, options);
     this.emit(EVENTS.UI_MEMORY_CALL_TREE_RENDERED);
   },
 
   /**
    * Fired on the "link" event for the call tree in this container.
    */
-  _onLink: function(_, treeItem) {
+  _onLink: function(treeItem) {
     let { url, line } = treeItem.frame.getInfo();
     gToolbox.viewSourceInDebugger(url, line).then(success => {
       if (success) {
         this.emit(EVENTS.SOURCE_SHOWN_IN_JS_DEBUGGER);
       } else {
         this.emit(EVENTS.SOURCE_NOT_FOUND_IN_JS_DEBUGGER);
       }
     });
--- a/devtools/client/performance/views/details-memory-flamegraph.js
+++ b/devtools/client/performance/views/details-memory-flamegraph.js
@@ -106,17 +106,17 @@ var MemoryFlameGraphView = extend(Detail
     let allocations = recording.getAllocations();
     let thread = RecordingUtils.getProfileThreadFromAllocations(allocations);
     FlameGraphUtils.removeFromCache(thread);
   },
 
   /**
    * Called when `devtools.theme` changes.
    */
-  _onThemeChanged: function(_, theme) {
+  _onThemeChanged: function(theme) {
     this.graph.setTheme(theme);
     this.graph.refresh({ force: true });
   },
 
   toString: () => "[object MemoryFlameGraphView]"
 });
 
 EventEmitter.decorate(MemoryFlameGraphView);
--- a/devtools/client/performance/views/details-waterfall.js
+++ b/devtools/client/performance/views/details-waterfall.js
@@ -140,24 +140,24 @@ var WaterfallView = extend(DetailsSubvie
     // Clear the cache as we'll need to recompute the collapsed
     // marker model
     this._cache = new WeakMap();
   },
 
   /**
    * Called when MarkerDetails view emits an event to view source.
    */
-  _onViewSource: function(_, data) {
+  _onViewSource: function(data) {
     gToolbox.viewSourceInDebugger(data.url, data.line);
   },
 
   /**
    * Called when MarkerDetails view emits an event to snap to allocations.
    */
-  _onShowAllocations: function(_, data) {
+  _onShowAllocations: function(data) {
     let { endTime } = data;
     let startTime = 0;
     let recording = PerformanceController.getCurrentRecording();
     let markers = recording.getMarkers();
 
     let lastGCMarkerFromPreviousCycle = null;
     let lastGCMarker = null;
     // Iterate over markers looking for the most recent GC marker
--- a/devtools/client/performance/views/details.js
+++ b/devtools/client/performance/views/details.js
@@ -235,17 +235,17 @@ var DetailsView = {
     if (recording && recording.isCompleted()) {
       component.view.shouldUpdateWhenShown = true;
     }
   },
 
   /**
    * Called when recording stops or is selected.
    */
-  _onRecordingStoppedOrSelected: function(_, state, recording) {
+  _onRecordingStoppedOrSelected: function(state, recording) {
     if (typeof state === "string" && state !== "recording-stopped") {
       return;
     }
     this.setAvailableViews();
   },
 
   /**
    * Called when a view button is clicked.
--- a/devtools/client/performance/views/overview.js
+++ b/devtools/client/performance/views/overview.js
@@ -204,37 +204,36 @@ var OverviewView = {
     if (this.isRendering()) {
       this._timeoutId = setTimeout(this._onRecordingTick, this.OVERVIEW_UPDATE_INTERVAL);
     }
   },
 
   /**
    * Called when recording state changes.
    */
-  _onRecordingStateChange:
-    OverviewViewOnStateChange(async function(_, state, recording) {
-      if (state !== "recording-stopped") {
-        return;
-      }
-      // Check to see if the recording that just stopped is the current recording.
-      // If it is, render the high-res graphs. For manual recordings, it will also
-      // be the current recording, but profiles generated by `console.profile` can stop
-      // while having another profile selected -- in this case, OverviewView should keep
-      // rendering the current recording.
-      if (recording !== PerformanceController.getCurrentRecording()) {
-        return;
-      }
-      this.render(FRAMERATE_GRAPH_HIGH_RES_INTERVAL);
-      await this._checkSelection(recording);
-    }),
+  _onRecordingStateChange: OverviewViewOnStateChange(async function(state, recording) {
+    if (state !== "recording-stopped") {
+      return;
+    }
+    // Check to see if the recording that just stopped is the current recording.
+    // If it is, render the high-res graphs. For manual recordings, it will also
+    // be the current recording, but profiles generated by `console.profile` can stop
+    // while having another profile selected -- in this case, OverviewView should keep
+    // rendering the current recording.
+    if (recording !== PerformanceController.getCurrentRecording()) {
+      return;
+    }
+    this.render(FRAMERATE_GRAPH_HIGH_RES_INTERVAL);
+    await this._checkSelection(recording);
+  }),
 
   /**
    * Called when a new recording is selected.
    */
-  _onRecordingSelected: OverviewViewOnStateChange(async function(_, recording) {
+  _onRecordingSelected: OverviewViewOnStateChange(async function(recording) {
     this._setGraphVisibilityFromRecordingFeatures(recording);
 
     // If this recording is complete, render the high res graph
     if (recording.isCompleted()) {
       await this.render(FRAMERATE_GRAPH_HIGH_RES_INTERVAL);
     }
     await this._checkSelection(recording);
     this.graphs.dropSelection();
@@ -278,17 +277,17 @@ var OverviewView = {
   _onGraphSelecting: function() {
     if (this._stopSelectionChangeEventPropagation) {
       return;
     }
 
     this.emit(EVENTS.UI_OVERVIEW_RANGE_SELECTED, this.getTimeInterval());
   },
 
-  _onGraphRendered: function(_, graphName) {
+  _onGraphRendered: function(graphName) {
     switch (graphName) {
       case "timeline":
         this.emit(EVENTS.UI_MARKERS_GRAPH_RENDERED);
         break;
       case "memory":
         this.emit(EVENTS.UI_MEMORY_GRAPH_RENDERED);
         break;
       case "framerate":
@@ -298,17 +297,17 @@ var OverviewView = {
   },
 
   /**
    * Called whenever a preference in `devtools.performance.ui.` changes.
    * Does not care about the enabling of memory/framerate graphs,
    * because those will set values on a recording model, and
    * the graphs will render based on the existence.
    */
-  async _onPrefChanged(_, prefName, prefValue) {
+  async _onPrefChanged(prefName, prefValue) {
     switch (prefName) {
       case "hidden-markers": {
         let graph = await this.graphs.isAvailable("timeline");
         if (graph) {
           let filter = PerformanceController.getPref("hidden-markers");
           graph.setFilter(filter);
           graph.refresh({ force: true });
         }
@@ -351,17 +350,17 @@ var OverviewView = {
    */
   _hideGraphsPanel: function() {
     $("#overview-pane").classList.add("hidden");
   },
 
   /**
    * Called when `devtools.theme` changes.
    */
-  _onThemeChanged: function(_, theme) {
+  _onThemeChanged: function(theme) {
     this.graphs.setTheme({ theme, redraw: true });
   },
 
   toString: () => "[object OverviewView]"
 };
 
 /**
  * Utility that can wrap a method of OverviewView that
@@ -369,21 +368,21 @@ var OverviewView = {
  * stopping, or about to start/stop, and determines whether or not
  * the polling for rendering the overview graphs needs to start or stop.
  * Must be called with the OverviewView context.
  *
  * @param {function?} fn
  * @return {function}
  */
 function OverviewViewOnStateChange(fn) {
-  return function _onRecordingStateChange(eventName, recording) {
+  return function _onRecordingStateChange(recording) {
     // Normalize arguments for the RECORDING_STATE_CHANGE event,
     // as it also has a `state` argument.
     if (typeof recording === "string") {
-      recording = arguments[2];
+      recording = arguments[1];
     }
 
     let currentRecording = PerformanceController.getCurrentRecording();
 
     // All these methods require a recording to exist selected and
     // from the event name, since there is a delay between starting
     // a recording and changing the selection.
     if (!currentRecording || !recording) {
--- a/devtools/client/performance/views/recordings.js
+++ b/devtools/client/performance/views/recordings.js
@@ -104,29 +104,29 @@ var RecordingsView = {
   },
 
   /**
    * Called when a new recording is stored in the UI. This handles
    * when recordings are lazily loaded (like a console.profile occurring
    * before the tool is loaded) or imported. In normal manual recording cases,
    * this will also be fired.
    */
-  _onNewRecording: function(_, recording) {
-    this._onRecordingStateChange(_, null, recording);
+  _onNewRecording: function(recording) {
+    this._onRecordingStateChange(null, recording);
   },
 
   /**
    * Signals that a recording has changed state.
    *
    * @param string state
    *        Can be "recording-started", "recording-stopped", "recording-stopping"
    * @param RecordingModel recording
    *        Model of the recording that was started.
    */
-  _onRecordingStateChange: function(_, state, recording) {
+  _onRecordingStateChange: function(state, recording) {
     const { recordings, labels } = this._listState;
 
     if (!recordings.includes(recording)) {
       recordings.push(recording);
       labels.set(recording, recording.getLabel() ||
         L10N.getFormatStr("recordingsList.itemLabel", recordings.length));
 
       // If this is a manual recording, immediately select it, or
@@ -143,17 +143,17 @@ var RecordingsView = {
     }
 
     this._renderList();
   },
 
   /**
    * Clears out all non-console recordings.
    */
-  _onRecordingDeleted: function(_, recording) {
+  _onRecordingDeleted: function(recording) {
     const { recordings } = this._listState;
     const index = recordings.indexOf(recording);
     if (index === -1) {
       throw new Error("Attempting to remove a recording that doesn't exist.");
     }
     recordings.splice(index, 1);
     this._renderList();
   },
@@ -181,17 +181,17 @@ var RecordingsView = {
     fp.open({ done: result => {
       if (result == Ci.nsIFilePicker.returnCancel) {
         return;
       }
       this.emit(EVENTS.UI_EXPORT_RECORDING, recording, fp.file);
     }});
   },
 
-  _onRecordingExported: function(_, recording, file) {
+  _onRecordingExported: function(recording, file) {
     if (recording.isConsole()) {
       return;
     }
     const name = file.leafName.replace(/\..+$/, "");
     this._listState.labels.set(recording, name);
     this._renderList();
   }
 };