[gnome-documents] application: Spawn the miners only when a window is created



commit 8f9781cfdc3b92db0456ae263011dc74f7cbba72
Author: Debarshi Ray <debarshir gnome org>
Date:   Tue Feb 17 08:59:04 2015 +0100

    application: Spawn the miners only when a window is created
    
    Creating the miner proxies during startup would spawn the processes
    even though they are only used when an application window is shown.
    This is bad because the startup is shared between the application and
    the search provider, and we should not needlessly spawn so many
    processes for each gnome-shell search.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=744625

 src/application.js |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index 98ef009..c2d63cd 100644
--- a/src/application.js
+++ b/src/application.js
@@ -407,6 +407,10 @@ const Application = new Lang.Class({
     },
 
     _startMiners: function() {
+        this.gdataMiner = new Miners.GDataMiner();
+        this.owncloudMiner = new Miners.OwncloudMiner();
+        this.zpjMiner = new Miners.ZpjMiner();
+
         this._refreshMiners();
 
         this._sourceAddedId = sourceManager.connect('item-added', Lang.bind(this, this._refreshMiners));
@@ -428,6 +432,10 @@ const Application = new Lang.Class({
             function(miner) {
                 miner._cancellable.cancel();
             }));
+
+        this.gdataMiner = null;
+        this.owncloudMiner = null;
+        this.zpjMiner = null;
     },
 
     _themeChanged: function(gtkSettings) {
@@ -602,10 +610,6 @@ const Application = new Lang.Class({
                              WindowMode.WindowMode.SEARCH] }
         ];
 
-        this.gdataMiner = new Miners.GDataMiner();
-        this.owncloudMiner = new Miners.OwncloudMiner();
-        this.zpjMiner = new Miners.ZpjMiner();
-
         this._initActions();
         this._initAppMenu();
 


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