Bug 1388631: Don't call generateQI for every defineLazyPreferenceGetter call. r=mixedpuppy
authorKris Maglione <maglione.k@gmail.com>
Tue, 08 Aug 2017 23:19:06 -0700
changeset 373624 440697b45d73109f868c88fbf39df32ee29c6d47
parent 373623 7b9ab0caee26ba502d61c5a71bae819018ab6ac4
child 373625 5c9b13e813391a433976999f59a5090e66311697
push id93566
push usermaglione.k@gmail.com
push dateWed, 09 Aug 2017 20:17:31 +0000
treeherdermozilla-inbound@440697b45d73 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmixedpuppy
bugs1388631
milestone57.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1388631: Don't call generateQI for every defineLazyPreferenceGetter call. r=mixedpuppy MozReview-Commit-ID: 9n8VyXFM7bc
js/xpconnect/loader/XPCOMUtils.jsm
--- a/js/xpconnect/loader/XPCOMUtils.jsm
+++ b/js/xpconnect/loader/XPCOMUtils.jsm
@@ -390,17 +390,17 @@ this.XPCOMUtils = {
                                    aTransform = val => val)
   {
     // Note: We need to keep a reference to this observer alive as long
     // as aObject is alive. This means that all of our getters need to
     // explicitly close over the variable that holds the object, and we
     // cannot define a value in place of a getter after we read the
     // preference.
     let observer = {
-      QueryInterface: this.generateQI([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
+      QueryInterface: XPCU_lazyPreferenceObserverQI,
 
       value: undefined,
 
       observe(subject, topic, data) {
         if (data == aPreference) {
           if (aOnUpdate) {
             let previous = this.value;
 
@@ -563,16 +563,18 @@ this.XPCOMUtils = {
     Object.defineProperty(aObj, aName, {
       value: aValue,
       enumerable: true,
       writable: false
     });
   },
 };
 
+var XPCU_lazyPreferenceObserverQI = XPCOMUtils.generateQI([Ci.nsIObserver, Ci.nsISupportsWeakReference]);
+
 XPCOMUtils.defineLazyModuleGetter(this, "Services",
                                   "resource://gre/modules/Services.jsm");
 
 XPCOMUtils.defineLazyServiceGetter(XPCOMUtils, "categoryManager",
                                    "@mozilla.org/categorymanager;1",
                                    "nsICategoryManager");
 
 /**