[gnome-shell/wip/rstrode/login-screen-extensions: 61/134] extensionSystem: Get rid of _enabled boolean optimization




commit 116c96c5a20baff845adf87142ec2feb294524b5
Author: Ray Strode <rstrode redhat com>
Date:   Tue Aug 10 13:25:57 2021 -0400

    extensionSystem: Get rid of _enabled boolean optimization
    
    At the moment a session mode either allows extensions or it doesn't.
    If it allows extensions, then the entire available list of
    configured extensions get enabled as soon as the session mode is
    entered.
    
    Since enabling or disabling extensions is an all or nothing situation,
    the code tracks whether extensions are already enabled when entering
    the session mode, and if so, avoids iterating through the extension list
    needlessly. It does this using a boolean named _enabled.
    
    In the future, the extensions themselves will be given some say on
    whether or not they should be enabled in a given session mode. This
    means, the configured extension list may contain extensions that
    shouldn't be enabled for a given session mode, and the _enabled boolean
    will no longer be appropriated.
    
    This commit drops the _enabled boolean optimization.

 js/ui/extensionSystem.js | 13 -------------
 1 file changed, 13 deletions(-)
---
diff --git a/js/ui/extensionSystem.js b/js/ui/extensionSystem.js
index 81804ea5ed..e282a834a8 100644
--- a/js/ui/extensionSystem.js
+++ b/js/ui/extensionSystem.js
@@ -20,7 +20,6 @@ const UPDATE_CHECK_TIMEOUT = 24 * 60 * 60; // 1 day in seconds
 var ExtensionManager = class {
     constructor() {
         this._initted = false;
-        this._enabled = false;
         this._updateNotified = false;
 
         this._extensions = new Map();
@@ -402,9 +401,6 @@ var ExtensionManager = class {
     _onEnabledExtensionsChanged() {
         let newEnabledExtensions = this._getEnabledExtensions();
 
-        if (!this._enabled)
-            return;
-
         // Find and enable all the newly enabled extensions: UUIDs found in the
         // new setting, but not in the old one.
         newEnabledExtensions.filter(
@@ -509,9 +505,6 @@ var ExtensionManager = class {
     }
 
     _enableAllExtensions() {
-        if (this._enabled)
-            return;
-
         if (!this._initted) {
             this._loadExtensions();
             this._initted = true;
@@ -520,20 +513,14 @@ var ExtensionManager = class {
                 this._callExtensionEnable(uuid);
             });
         }
-        this._enabled = true;
     }
 
     _disableAllExtensions() {
-        if (!this._enabled)
-            return;
-
         if (this._initted) {
             this._extensionOrder.slice().reverse().forEach(uuid => {
                 this._callExtensionDisable(uuid);
             });
         }
-
-        this._enabled = false;
     }
 
     _sessionUpdated() {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]