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 17:33:52 +00:00
Родитель 977f86fb80
Коммит 4f021f549e
7 изменённых файлов: 16 добавлений и 52 удалений

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

@ -22,8 +22,6 @@ const known_scripts = {
modules: new Set([
"chrome://mochikit/content/ShutdownLeaksCollector.jsm",
"resource://gre/modules/ContentProcessSingleton.jsm",
// General utilities
"resource://gre/modules/AppConstants.jsm",
"resource://gre/modules/DeferredTask.jsm",
@ -48,7 +46,6 @@ const known_scripts = {
"resource://gre/modules/Readerable.jsm",
// Telemetry
"resource://gre/modules/TelemetryController.jsm", // bug 1470339
"resource://gre/modules/TelemetryControllerBase.jsm", // bug 1470339
"resource://gre/modules/TelemetryControllerContent.jsm", // bug 1470339
"resource://gre/modules/TelemetryUtils.jsm", // bug 1470339

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

@ -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'},
},
]