Bug 1452551 - Initialize the Telemetry core in GeckoView. r=esawin,gfritzsche,jchen

This additionally introduces a new pref (toolkit.telemetry.isGeckoViewMode)
to discriminate, at runtime, between Fennec and GV in JavaScript code.
Moreover, this disables TelemetryController initialization from content
processes, which was left enabled.

MozReview-Commit-ID: 7VoDorxAhvD
This commit is contained in:
Alessio Placitelli
2018-04-11 13:11:27 +02:00
parent a63263111f
commit 14f801cbb5
7 changed files with 88 additions and 20 deletions

View File

@@ -7,8 +7,10 @@
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.defineModuleGetter(this, "TelemetryController",
"resource://gre/modules/TelemetryController.jsm");
XPCOMUtils.defineLazyModuleGetters(this, {
GeckoViewTelemetryController: "resource://gre/modules/GeckoViewTelemetryController.jsm",
TelemetryController: "resource://gre/modules/TelemetryController.jsm",
});
function ContentProcessSingleton() {}
ContentProcessSingleton.prototype = {
@@ -20,6 +22,13 @@ ContentProcessSingleton.prototype = {
switch (topic) {
case "app-startup": {
Services.obs.addObserver(this, "xpcom-shutdown");
// Initialize Telemetry in the content process: use a different
// controller depending on the platform.
if (Services.prefs.getBoolPref("toolkit.telemetry.isGeckoViewMode", false)) {
GeckoViewTelemetryController.setup();
return;
}
// Initialize Firefox Desktop Telemetry.
TelemetryController.observe(null, topic, null);
break;
}