yControllerParent is loaded only in the parent process, and
 *   contains code specific to the parent.
 * - TelemetryControllerContent is loaded only in content processes, and
 *   contains code specific to them.
 *
 * Both the parent and the content modules load TelemetryControllerBase,
 * which contains code which is common to all processes.
 *
 * This division is important for content process memory usage and
 * startup time. The parent-specific code occupies tens of KB of memory
 * which, multiplied by the number of content processes we have, adds up
 * fast.
 */

// We can't use Services.appinfo here because tests stub out the appinfo
// service, and if we touch Services.appinfo now, the built-in version
// will be cached in place of the stub.
const isParentProcess =
  // eslint-disable-next-line mozilla/use-services
  Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime).processType ===
  Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT;

export var TelemetryController;
if (isParentProcess) {
  ({ TelemetryController } = ChromeUtils.importESModule(
    "resource://gre/modules/TelemetryControllerParent.sys.mjs"
  ));
} else {
  ({ TelemetryController } = ChromeUtils.importESModule(
    "resource://gre/modules/TelemetryControllerContent.sys.mjs"
  ));
}
PK