Bug 534944 - Avoid loading/importing weave files until necessary to speed up fennec startup

Have importing service.js trigger startup instead of only starting up from Weave.js, which now is used as a backup kickstarter. Only call import(service.js) when necessary from various Fennec files.
This commit is contained in:
Edward Lee 2009-12-15 14:21:12 -08:00
parent baf9c41432
commit cee1a6e884
3 changed files with 11 additions and 4 deletions

View File

@ -59,8 +59,13 @@ WeaveService.prototype = {
break;
case "final-ui-startup":
Cu.import("resource://weave/service.js");
Weave.Service.onStartup();
// Force Weave service to load if it hasn't triggered from overlays
this.timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
this.timer.initWithCallback({
notify: function() {
Cu.import("resource://weave/service.js");
}
}, 10000, Ci.nsITimer.TYPE_ONE_SHOT);
break;
}
}

View File

@ -253,8 +253,6 @@ WeaveSvc.prototype = {
while (enum.hasMoreElements())
wait += enum.getNext().gBrowser.mTabs.length;
break;
case FENNEC_ID:
wait = 10;
}
// Make sure we wait a little but but not too long in the worst case
@ -1523,3 +1521,6 @@ WeaveSvc.prototype = {
}
},
};
// Load Weave on the first time this file is loaded
Weave.Service.onStartup();

View File

@ -795,6 +795,7 @@ let Utils = {
let Svc = {};
Svc.Prefs = new Preferences(PREFS_BRANCH);
Svc.Obs = Observers;
[["Annos", "@mozilla.org/browser/annotation-service;1", "nsIAnnotationService"],
["AppInfo", "@mozilla.org/xre/app-info;1", "nsIXULAppInfo"],
["Bookmark", "@mozilla.org/browser/nav-bookmarks-service;1", "nsINavBookmarksService"],