Bug 539991 - minor memoization (r=ehsan)

This commit is contained in:
Dietrich Ayala 2010-01-21 15:45:01 -08:00
parent f32be26e5b
commit 0a4e5e3635

View File

@ -87,6 +87,8 @@ const STATE_RESTORE_FINISHED = 3;
//// PrivateBrowsingService
function PrivateBrowsingService() {
this._obs = Cc["@mozilla.org/observer-service;1"].
getService(Ci.nsIObserverService);
this._obs.addObserver(this, "profile-after-change", true);
this._obs.addObserver(this, "quit-application-granted", true);
this._obs.addObserver(this, "private-browsing", true);
@ -95,22 +97,12 @@ function PrivateBrowsingService() {
}
PrivateBrowsingService.prototype = {
// Observer Service
__obs: null,
get _obs() {
if (!this.__obs)
this.__obs = Cc["@mozilla.org/observer-service;1"].
getService(Ci.nsIObserverService);
return this.__obs;
},
// Preferences Service
__prefs: null,
get _prefs() {
if (!this.__prefs)
this.__prefs = Cc["@mozilla.org/preferences-service;1"].
let prefs = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefBranch);
return this.__prefs;
this.__defineGetter__("_prefs", function() prefs);
return this._prefs;
},
// Whether the private browsing mode is currently active or not.