[gnome-shell/wip/chergert/3-28-perf-fixes: 4/4] appDisplay: use ShellAppCache to access GAppInfo



commit cfb92ad392c6ae459b1d8fb6008d7cdc53d5c151
Author: Christian Hergert <chergert redhat com>
Date:   Wed Feb 26 23:11:33 2020 -0800

    appDisplay: use ShellAppCache to access GAppInfo
    
    Calls to Gio.AppInfo.get_all() can perform quite a bit of I/O on the
    calling thread. This can potentially stall the compositor if the disk
    controller is saturated.
    
    Instead we can call the new ShellAppCache which contains cached information
    and performs all update I/O on a thread.
    
    Notifications of changes work very similar to GAppInfoMonitor via the
    ShellAppCache::changed() signal.

 js/ui/appDisplay.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index 18bad24310..f04adc3472 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -491,7 +491,7 @@ var AllView = new Lang.Class({
     },
 
     _loadApps() {
-        let apps = Gio.AppInfo.get_all().filter(appInfo => {
+        let apps = Shell.AppCache.get_default().get_all().filter(appInfo => {
             try {
                 let id = appInfo.get_id(); // catch invalid file encodings
             } catch(e) {
@@ -1321,7 +1321,7 @@ var FolderIcon = new Lang.Class({
         folderApps.forEach(addAppId);
 
         let folderCategories = this._folder.get_strv('categories');
-        Gio.AppInfo.get_all().forEach(appInfo => {
+        Shell.AppCache.get_default().get_all().forEach(appInfo => {
             let appCategories = _getCategories(appInfo);
             if (!_listsIntersect(folderCategories, appCategories))
                 return;


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