Bug 1355611 - Don't load TelemetryStartup.js in the content process. r=gfritzsche

Instead, run the telemetry startup in ContentProcessSingleton.js, to
avoid loading a .jsm in every content process.

MozReview-Commit-ID: BnwoZTjFB3i

--HG--
extra : rebase_source : 1d515668c9d0af0aa498c573a14c96681baa4605
This commit is contained in:
Andrew McCreight 2017-04-11 15:13:30 -07:00
Родитель c0edbd9dfe
Коммит 45774ba552
3 изменённых файлов: 6 добавлений и 2 удалений

Просмотреть файл

@ -14,6 +14,9 @@ XPCOMUtils.defineLazyServiceGetter(this, "cpmm",
"@mozilla.org/childprocessmessagemanager;1",
"nsIMessageSender");
XPCOMUtils.defineLazyModuleGetter(this, "TelemetryController",
"resource://gre/modules/TelemetryController.jsm");
/*
* The message manager has an upper limit on message sizes that it can
* reliably forward to the parent so we limit the size of console log event
@ -47,6 +50,7 @@ ContentProcessSingleton.prototype = {
Services.obs.addObserver(this, "console-api-log-event", false);
Services.obs.addObserver(this, "xpcom-shutdown", false);
cpmm.addMessageListener("DevTools:InitDebuggerServer", this);
TelemetryController.observe(null, topic, null);
break;
}
case "console-api-log-event": {

Просмотреть файл

@ -24,7 +24,8 @@ function TelemetryStartup() {
TelemetryStartup.prototype.classID = Components.ID("{117b219f-92fe-4bd2-a21b-95a342a9d474}");
TelemetryStartup.prototype.QueryInterface = XPCOMUtils.generateQI([Components.interfaces.nsIObserver]);
TelemetryStartup.prototype.observe = function(aSubject, aTopic, aData) {
if (aTopic == "profile-after-change" || aTopic == "app-startup") {
if (aTopic == "profile-after-change") {
// In the content process, this is done in ContentProcessSingleton.js.
TelemetryController.observe(null, aTopic, null);
}
if (aTopic == "profile-after-change") {

Просмотреть файл

@ -1,4 +1,3 @@
component {117b219f-92fe-4bd2-a21b-95a342a9d474} TelemetryStartup.js
contract @mozilla.org/base/telemetry-startup;1 {117b219f-92fe-4bd2-a21b-95a342a9d474}
category profile-after-change TelemetryStartup @mozilla.org/base/telemetry-startup;1 process=main
category app-startup TelemetryStartup @mozilla.org/base/telemetry-startup;1 process=content