Bug 1645862: Part 2 - Get rid of ContentProcessSingleton. r=chutten

Differential Revision: https://phabricator.services.mozilla.com/D79871
This commit is contained in:
Kris Maglione 2020-06-24 03:09:25 +00:00
Родитель 3ea9f8b628
Коммит 7b964c86a2
6 изменённых файлов: 16 добавлений и 49 удалений

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

@ -1,39 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
const { XPCOMUtils } = ChromeUtils.import(
"resource://gre/modules/XPCOMUtils.jsm"
);
XPCOMUtils.defineLazyModuleGetters(this, {
TelemetryController: "resource://gre/modules/TelemetryController.jsm",
});
function ContentProcessSingleton() {}
ContentProcessSingleton.prototype = {
classID: Components.ID("{ca2a8470-45c7-11e4-916c-0800200c9a66}"),
QueryInterface: ChromeUtils.generateQI([
Ci.nsIObserver,
Ci.nsISupportsWeakReference,
]),
observe(subject, topic, data) {
switch (topic) {
case "app-startup": {
Services.obs.addObserver(this, "xpcom-shutdown");
// Initialize Firefox Desktop Telemetry.
TelemetryController.observe(null, topic, null);
break;
}
case "xpcom-shutdown":
Services.obs.removeObserver(this, "xpcom-shutdown");
break;
}
},
};
var EXPORTED_SYMBOLS = ["ContentProcessSingleton"];

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

@ -1,2 +1 @@
category app-startup MainProcessSingleton service,@mozilla.org/main-process-singleton;1 process=main
category app-startup ContentProcessSingleton service,@mozilla.org/content-process-singleton;1 process=content

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

@ -12,11 +12,4 @@ Classes = [
'constructor': 'MainProcessSingleton',
'processes': ProcessSelector.MAIN_PROCESS_ONLY,
},
{
'cid': '{ca2a8470-45c7-11e4-916c-0800200c9a66}',
'contract_ids': ['@mozilla.org/content-process-singleton;1'],
'jsm': 'resource://gre/modules/ContentProcessSingleton.jsm',
'constructor': 'ContentProcessSingleton',
'processes': ProcessSelector.CONTENT_PROCESS_ONLY,
},
]

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

@ -12,7 +12,6 @@ EXTRA_COMPONENTS += [
]
EXTRA_JS_MODULES += [
'ContentProcessSingleton.jsm',
'CustomElementsListener.jsm',
'MainProcessSingleton.jsm',
]

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

@ -19,7 +19,7 @@ const TELEMETRY_DELAY =
// Delay before initializing telemetry if we're testing (ms)
const TELEMETRY_TEST_DELAY = 1;
var EXPORTED_SYMBOLS = ["TelemetryController"];
var EXPORTED_SYMBOLS = ["TelemetryController", "getTelemetryController"];
var TelemetryController = Object.freeze({
/**
@ -42,6 +42,8 @@ var TelemetryController = Object.freeze({
observe(aSubject, aTopic, aData) {
return Impl.observe(aSubject, aTopic, aData);
},
QueryInterface: ChromeUtils.generateQI(["nsIObserver"]),
});
var Impl = {
@ -99,3 +101,8 @@ var Impl = {
}
},
};
// Used by service registration, which requires a callable function.
function getTelemetryController() {
return TelemetryController;
}

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

@ -12,4 +12,12 @@ Classes = [
'constructor': 'TelemetryStartup',
'processes': ProcessSelector.MAIN_PROCESS_ONLY,
},
{
'cid': '{efc1415c-5708-41cc-8226-82bf1d3bee16}',
'contract_ids': ['@mozilla.org/base/telemetry-controller-content;1'],
'jsm': 'resource://gre/modules/TelemetryControllerContent.jsm',
'processes': ProcessSelector.CONTENT_PROCESS_ONLY,
'constructor': 'getTelemetryController',
'categories': {'app-startup': 'TelemetryControllerContent'},
},
]