[gnome-shell/gnome-42] signalTracker: Avoid creating a temporary keys array when clearing



commit 4ffff795af6e612d4e069603f2410d917a9cf9f7
Author: Marco Trevisan (Treviño) <mail 3v1n0 net>
Date:   Wed Jul 6 17:47:14 2022 +0200

    signalTracker: Avoid creating a temporary keys array when clearing
    
    We used to create a temporary array of signal tracker keys and then to
    iterate through them in order to untrack the objects, but the Map's can
    be iterated directly so let's just use their native forEach.
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2366>
    (cherry picked from commit 74720f250e51f9f7ae65b9be18cfde53b7103ae9)

 js/misc/signalTracker.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/js/misc/signalTracker.js b/js/misc/signalTracker.js
index a214291420..6f87962254 100644
--- a/js/misc/signalTracker.js
+++ b/js/misc/signalTracker.js
@@ -138,7 +138,7 @@ class SignalTracker {
      * @returns {void}
      */
     clear() {
-        [...this._map.keys()].forEach(obj => this.untrack(obj));
+        this._map.forEach((_, obj) => this.untrack(obj));
     }
 
     /**


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