Bug 1492893 - [Devtools Performance-new] Remove the unused toolbox object from the redux store r=gregtatum
authorJulien Wajsberg <felash@gmail.com>
Fri, 21 Sep 2018 15:57:05 +0000
changeset 437709 267392b7c6929a93632be711d9a1d3044ae88b07
parent 437708 96b91a8c2bcf9fb28e50a48117f0c9aab9e79427
child 437710 0c5229bcdc1573fbc8bcc92d249312f3eb0c7b23
push id34693
push userbtara@mozilla.com
push dateFri, 21 Sep 2018 21:59:01 +0000
treeherdermozilla-central@c348ec8b2900 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgregtatum
bugs1492893
milestone64.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 1492893 - [Devtools Performance-new] Remove the unused toolbox object from the redux store r=gregtatum MozReview-Commit-ID: 1LJ6HypOYbM Differential Revision: https://phabricator.services.mozilla.com/D6469
devtools/client/performance-new/components/Description.js
devtools/client/performance-new/initializer.js
devtools/client/performance-new/panel.js
devtools/client/performance-new/store/reducers.js
devtools/client/performance-new/store/selectors.js
devtools/client/performance-new/test/chrome/head.js
--- a/devtools/client/performance-new/components/Description.js
+++ b/devtools/client/performance-new/components/Description.js
@@ -1,30 +1,24 @@
 /* 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 { PureComponent } = require("devtools/client/shared/vendor/react");
 const { div, button, p } = require("devtools/client/shared/vendor/react-dom-factories");
 const { openDocLink } = require("devtools/client/shared/link");
-const PropTypes = require("devtools/client/shared/vendor/react-prop-types");
-const { connect } = require("devtools/client/shared/vendor/react-redux");
-const selectors = require("devtools/client/performance-new/store/selectors");
 
 /**
  * This component provides a helpful description for what is going on in the component
  * and provides some external links.
  */
 class Description extends PureComponent {
   static get propTypes() {
-    return {
-      // StateProps:
-      toolbox: PropTypes.object.isRequired
-    };
+    return {};
   }
 
   constructor(props) {
     super(props);
     this.handleLinkClick = this.handleLinkClick.bind(this);
   }
 
   handleLinkClick(event) {
@@ -66,13 +60,9 @@ class Description extends PureComponent 
           "github.com/devtools-html/perf.html"
         ),
         "."
       )
     );
   }
 }
 
-const mapStateToProps = state => ({
-  toolbox: selectors.getToolbox(state)
-});
-
-module.exports = connect(mapStateToProps)(Description);
+module.exports = Description;
--- a/devtools/client/performance-new/initializer.js
+++ b/devtools/client/performance-new/initializer.js
@@ -23,26 +23,25 @@ const {
   receiveProfile,
   getRecordingPreferences,
   setRecordingPreferences
 } = require("devtools/client/performance-new/browser");
 
 /**
  * Initialize the panel by creating a redux store, and render the root component.
  *
- * @param toolbox - The toolbox
  * @param perfFront - The Perf actor's front. Used to start and stop recordings.
+ * @param preferenceFront - Used to get the recording preferences from the device.
  */
-async function gInit(toolbox, perfFront, preferenceFront) {
+async function gInit(perfFront, preferenceFront) {
   const store = createStore(reducers);
 
   // Do some initialization, especially with privileged things that are part of the
   // the browser.
   store.dispatch(actions.initializeStore({
-    toolbox,
     perfFront,
     receiveProfile,
     // Pull the default recording settings from the reducer, and update them according
     // to what's in the target's preferences. This way the preferences are stored
     // on the target. This could be useful for something like Android where you might
     // want to tweak the settings.
     recordingSettingsFromPreferences: await getRecordingPreferences(
       preferenceFront,
--- a/devtools/client/performance-new/panel.js
+++ b/devtools/client/performance-new/panel.js
@@ -30,17 +30,17 @@ class PerformancePanel {
     this.panelWin.gTarget = this.target;
 
     const rootForm = await this.target.root;
     const perfFront = new PerfFront(this.target.client, rootForm);
     const preferenceFront = this.target.client.mainRoot.getFront("preference");
 
     this.isReady = true;
     this.emit("ready");
-    this.panelWin.gInit(this.toolbox, perfFront, preferenceFront);
+    this.panelWin.gInit(perfFront, preferenceFront);
     return this;
   }
 
   // DevToolPanel API:
 
   get target() {
     return this.toolbox.target;
   }
--- a/devtools/client/performance-new/store/reducers.js
+++ b/devtools/client/performance-new/store/reducers.js
@@ -124,17 +124,16 @@ function threads(state = ["GeckoMain", "
  *   receiveProfile - A function to receive the profile and open it into a new window.
  *   setRecordingPreferences - A function to set the recording settings.
  * }
  */
 function initializedValues(state = null, action) {
   switch (action.type) {
     case "INITIALIZE_STORE":
       return {
-        toolbox: action.toolbox,
         perfFront: action.perfFront,
         receiveProfile: action.receiveProfile,
         setRecordingPreferences: action.setRecordingPreferences
       };
     default:
       return state;
   }
 }
--- a/devtools/client/performance-new/store/selectors.js
+++ b/devtools/client/performance-new/store/selectors.js
@@ -25,29 +25,27 @@ const getInitializedValues = state => {
   const values = state.initializedValues;
   if (!values) {
     throw new Error("The store must be initialized before it can be used.");
   }
   return values;
 };
 
 const getPerfFront = state => getInitializedValues(state).perfFront;
-const getToolbox = state => getInitializedValues(state).toolbox;
 const getReceiveProfileFn = state => getInitializedValues(state).receiveProfile;
 const getSetRecordingPreferencesFn =
   state => getInitializedValues(state).setRecordingPreferences;
 
 module.exports = {
   getRecordingState,
   getRecordingUnexpectedlyStopped,
   getIsSupportedPlatform,
   getInterval,
   getEntries,
   getFeatures,
   getThreads,
   getThreadsString,
   getRecordingSettings,
   getInitializedValues,
   getPerfFront,
-  getToolbox,
   getReceiveProfileFn,
   getSetRecordingPreferencesFn
 };
--- a/devtools/client/performance-new/test/chrome/head.js
+++ b/devtools/client/performance-new/test/chrome/head.js
@@ -164,33 +164,31 @@ function createPerfComponent() {
   const ReactDOM = require("devtools/client/shared/vendor/react-dom");
   const ReactRedux = require("devtools/client/shared/vendor/react-redux");
   const createStore = require("devtools/client/shared/redux/create-store")();
   const reducers = require("devtools/client/performance-new/store/reducers");
   const actions = require("devtools/client/performance-new/store/actions");
   const selectors = require("devtools/client/performance-new/store/selectors");
 
   const perfFrontMock = new MockPerfFront();
-  const toolboxMock = {};
   const store = createStore(reducers);
   const container = document.querySelector("#container");
   const receiveProfileCalls = [];
   const recordingPreferencesCalls = [];
 
   function receiveProfileMock(profile) {
     receiveProfileCalls.push(profile);
   }
 
   function recordingPreferencesMock(settings) {
     recordingPreferencesCalls.push(settings);
   }
 
   function mountComponent() {
     store.dispatch(actions.initializeStore({
-      toolbox: toolboxMock,
       perfFront: perfFrontMock,
       receiveProfile: receiveProfileMock,
       recordingSettingsFromPreferences: selectors.getRecordingSettings(store.getState()),
       setRecordingPreferences: recordingPreferencesMock
     }));
 
     return ReactDOM.render(
       React.createElement(