Commit f9e9ef7a authored by Johann Hofmann's avatar Johann Hofmann
Browse files

Bug 1547116 - Avoid updating unnecessary touch bar inputs. r=mikedeboer

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

--HG--
extra : moz-landing-system : lando
parent 2d6cf501
Loading
Loading
Loading
Loading
+12 −6
Original line number Diff line number Diff line
@@ -252,14 +252,20 @@ class TouchBarHelper {
   * @param {...*} [otherInputs] (optional)
   *        Additional keys to values in the kBuiltInInputs object in this file.
   */
  _updateTouchBarInputs(inputName, ...otherInputs) {
    let input = this.getTouchBarInput(inputName);
    if (!input || !this.window) {
  _updateTouchBarInputs(...inputNames) {
    if (!this.window) {
      return;
    }
    let inputs = [input];
    for (let otherInputName of otherInputs) {
      input = this.getTouchBarInput(otherInputName);

    let inputs = [];
    for (let inputName of inputNames) {
      // Updating Touch Bar items isn't cheap in terms of performance, so
      // only consider this input if it's actually part of the layout.
      if (!this._storedLayout.includes(inputName)) {
        continue;
      }

      let input = this.getTouchBarInput(inputName);
      if (!input) {
        continue;
      }