Backed out changeset cfb9cc9ee352 (bug 1607545) for node failures on a CLOSED TREE

This commit is contained in:
Oana Pop Rus 2020-01-25 01:21:24 +02:00
parent 62e6e75256
commit aace55be1b
3 changed files with 17 additions and 39 deletions

View File

@ -15,7 +15,6 @@ ChromeUtils.import("resource://gre/modules/NotificationDB.jsm");
// lazy module getters
XPCOMUtils.defineLazyModuleGetters(this, {
AboutNewTabStartupRecorder: "resource:///modules/AboutNewTabService.jsm",
AddonManager: "resource://gre/modules/AddonManager.jsm",
AMTelemetry: "resource://gre/modules/AddonManager.jsm",
NewTabPagePreloading: "resource:///modules/NewTabPagePreloading.jsm",
@ -2343,8 +2342,6 @@ var gBrowserInit = {
// If the given URI is different from the homepage, we want to load it.
if (uri != defaultArgs) {
AboutNewTabStartupRecorder.noteNonDefaultStartup();
if (uri instanceof Ci.nsIArray) {
// Transform the nsIArray of nsISupportsString's into a JS Array of
// JS strings.

View File

@ -51,6 +51,7 @@ function AboutNewTabService() {
// More initialization happens here
this.toggleActivityStream(true);
this.initialized = true;
this.alreadyRecordedTopsitesPainted = false;
if (IS_MAIN_PROCESS) {
AboutNewTab.init();
@ -296,6 +297,20 @@ AboutNewTabService.prototype = {
this.notifyChange();
},
maybeRecordTopsitesPainted(timestamp) {
if (this.alreadyRecordedTopsitesPainted) {
return;
}
const SCALAR_KEY = "timestamps.about_home_topsites_first_paint";
let startupInfo = Services.startup.getStartupInfo();
let processStartTs = startupInfo.process.getTime();
let delta = Math.round(timestamp - processStartTs);
Services.telemetry.scalarSet(SCALAR_KEY, delta);
this.alreadyRecordedTopsitesPainted = true;
},
uninit() {
if (!this.initialized) {
return;
@ -312,33 +327,4 @@ AboutNewTabService.prototype = {
},
};
/**
* We split out the definition of AboutNewTabStartupRecorder from
* AboutNewTabService to avoid initializing the AboutNewTabService
* unnecessarily early when we just want to record some startup
* data.
*/
const AboutNewTabStartupRecorder = {
_alreadyRecordedTopsitesPainted: false,
_nonDefaultStartup: false,
noteNonDefaultStartup() {
this._nonDefaultStartup = true;
},
maybeRecordTopsitesPainted(timestamp) {
if (this._alreadyRecordedTopsitesPainted || this._nonDefaultStartup) {
return;
}
const SCALAR_KEY = "timestamps.about_home_topsites_first_paint";
let startupInfo = Services.startup.getStartupInfo();
let processStartTs = startupInfo.process.getTime();
let delta = Math.round(timestamp - processStartTs);
Services.telemetry.scalarSet(SCALAR_KEY, delta);
this._alreadyRecordedTopsitesPainted = true;
},
};
const EXPORTED_SYMBOLS = ["AboutNewTabService", "AboutNewTabStartupRecorder"];
const EXPORTED_SYMBOLS = ["AboutNewTabService"];

View File

@ -29,11 +29,6 @@ ChromeUtils.defineModuleGetter(
"perfService",
"resource://activity-stream/common/PerfService.jsm"
);
ChromeUtils.defineModuleGetter(
this,
"AboutNewTabStartupRecorder",
"resource:///modules/AboutNewTabService.jsm"
);
ChromeUtils.defineModuleGetter(
this,
"PingCentre",
@ -1048,7 +1043,7 @@ this.TelemetryFeed = class TelemetryFeed {
!HomePage.overridden &&
Services.prefs.getIntPref("browser.startup.page") === 1
) {
AboutNewTabStartupRecorder.maybeRecordTopsitesPainted(timestamp);
aboutNewTabService.maybeRecordTopsitesPainted(timestamp);
}
Object.assign(session.perf, data);