Bug 1349389 - Lazily load osfile.jsm in telemetry. r=gfritzsche
☠☠ backed out by ad36fc3e53b6 ☠ ☠
authorAndrew McCreight <continuation@gmail.com>
Tue, 21 Mar 2017 14:55:39 -0700
changeset 348995 9476c9a5f4c960a62ab066c6ff1f976c80b592e2
parent 348994 45e1d59b5dffcb5ffefb2fc057cde91bb8b8d321
child 348996 4e2d53d22566a45c5402c4f0785d5fbc5628f92a
push id39374
push useramccreight@mozilla.com
push dateThu, 23 Mar 2017 04:39:11 +0000
treeherderautoland@9476c9a5f4c9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgfritzsche
bugs1349389
milestone55.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 1349389 - Lazily load osfile.jsm in telemetry. r=gfritzsche Also, avoid two entirely unused imports. This avoids loading the various osfile jsms at startup. The additional shim method for sysinfo is needed in test_TelemetryEnvironment.js because delaying the intialization of osfile results in loading osfile_shared_allthreads.jsm after the shim sysinfo has been added, which initializes Ci.nsIOSFileConstantsService, which calls into sysinfo in InitOSFileConstants(). MozReview-Commit-ID: D7IWk20TRt1
toolkit/components/telemetry/TelemetryController.jsm
toolkit/components/telemetry/tests/unit/test_TelemetryEnvironment.js
toolkit/modules/ClientID.jsm
--- a/toolkit/components/telemetry/TelemetryController.jsm
+++ b/toolkit/components/telemetry/TelemetryController.jsm
@@ -7,20 +7,18 @@
 
 const Cc = Components.classes;
 const Ci = Components.interfaces;
 const Cr = Components.results;
 const Cu = Components.utils;
 const myScope = this;
 
 Cu.import("resource://gre/modules/Log.jsm");
-Cu.import("resource://gre/modules/debug.js", this);
 Cu.import("resource://gre/modules/Services.jsm", this);
 Cu.import("resource://gre/modules/XPCOMUtils.jsm", this);
-Cu.import("resource://gre/modules/osfile.jsm", this);
 Cu.import("resource://gre/modules/Promise.jsm", this);
 Cu.import("resource://gre/modules/PromiseUtils.jsm", this);
 Cu.import("resource://gre/modules/Task.jsm", this);
 Cu.import("resource://gre/modules/DeferredTask.jsm", this);
 Cu.import("resource://gre/modules/Preferences.jsm");
 Cu.import("resource://gre/modules/Timer.jsm");
 Cu.import("resource://gre/modules/TelemetryUtils.jsm", this);
 Cu.import("resource://gre/modules/AppConstants.jsm");
--- a/toolkit/components/telemetry/tests/unit/test_TelemetryEnvironment.js
+++ b/toolkit/components/telemetry/tests/unit/test_TelemetryEnvironment.js
@@ -139,16 +139,20 @@ var SysInfo = {
     }
     try {
       return this._genuine.getProperty(name);
     } catch (ex) {
       throw ex;
     }
   },
 
+  getPropertyAsUint32(name) {
+      return this.get(name);
+  },
+
   get(name) {
     return this._genuine.get(name);
   },
 
   QueryInterface(iid) {
     if (iid.equals(Ci.nsIPropertyBag2)
      || iid.equals(Ci.nsISupports))
       return this;
--- a/toolkit/modules/ClientID.jsm
+++ b/toolkit/modules/ClientID.jsm
@@ -3,27 +3,28 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 this.EXPORTED_SYMBOLS = ["ClientID"];
 
 const {classes: Cc, interfaces: Ci, results: Cr, utils: Cu} = Components;
 
-Cu.import("resource://gre/modules/osfile.jsm");
 Cu.import("resource://gre/modules/Task.jsm");
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/Preferences.jsm");
 Cu.import("resource://gre/modules/Log.jsm");
 
 const LOGGER_NAME = "Toolkit.Telemetry";
 const LOGGER_PREFIX = "ClientID::";
 
 XPCOMUtils.defineLazyModuleGetter(this, "CommonUtils",
                                   "resource://services-common/utils.js");
+XPCOMUtils.defineLazyModuleGetter(this, "OS",
+				  "resource://gre/modules/osfile.jsm");
 
 XPCOMUtils.defineLazyGetter(this, "gDatareportingPath", () => {
   return OS.Path.join(OS.Constants.Path.profileDir, "datareporting");
 });
 
 XPCOMUtils.defineLazyGetter(this, "gStateFilePath", () => {
   return OS.Path.join(gDatareportingPath, "state.json");
 });