Commit 071a2fe9 authored by Mike Hommey's avatar Mike Hommey
Browse files

Bug 1541792 - Replace linker magic with manual component registration. r=froydnj

Before bug 938437, we had a rather large and error-prone
nsStaticXULComponents.cpp used to register all modules. That was
replaced with clever use of the linker, which allowed to avoid the mess
that maintaining that file was.

Fast forward to now, where after bug 1524687 and other work that
preceded it, we have a much smaller number of remaining static xpcom
components, registered via this linker hack, and don't expect to add
any new ones. The list should eventually go down to zero.

Within that context, it seems to be the right time to get rid of the
magic, and with it the problems it causes on its own.

Some of those components could probably be trivially be converted to
static registration via .conf files, but I didn't want to deal with the
possible need to increase the number of dummy modules in XPCOMInit.cpp.
They can still be converted as a followup.

Differential Revision: https://phabricator.services.mozilla.com/D26076

--HG--
extra : moz-landing-system : lando
parent e4a2cb3a
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@ static const mozilla::Module::CategoryEntry kCategories[] = {
     ANDROIDSPEECHSERVICE_CONTRACTID},
    {nullptr}};

static const mozilla::Module kModule = {
extern const mozilla::Module kSpeechSynthModule = {
    mozilla::Module::kVersion,
    kCIDs,
    kContracts,
@@ -47,5 +47,3 @@ static const mozilla::Module kModule = {
    nullptr,
    nullptr,
};

NSMODULE_DEFN(androidspeechsynth) = &kModule;
+8 −9
Original line number Diff line number Diff line
@@ -46,12 +46,11 @@ static void UnloadOSXSpeechSynthesizerModule() {
  OSXSpeechSynthesizerService::Shutdown();
}

static const mozilla::Module kModule = {mozilla::Module::kVersion,
extern const mozilla::Module kSpeechSynthModule = {
    mozilla::Module::kVersion,
    kCIDs,
    kContracts,
    kCategories,
    nullptr,
    nullptr,
    UnloadOSXSpeechSynthesizerModule};

NSMODULE_DEFN(osxsynth) = &kModule;
+1 −3
Original line number Diff line number Diff line
@@ -39,8 +39,6 @@ static const mozilla::Module::CategoryEntry kCategories[] = {

static void UnloadSapiModule() { SapiService::Shutdown(); }

static const mozilla::Module kModule = {
extern const mozilla::Module kSpeechSynthModule = {
    mozilla::Module::kVersion, kCIDs, kContracts, kCategories, nullptr, nullptr,
    UnloadSapiModule};

NSMODULE_DEFN(synthsapi) = &kModule;
+1 −3
Original line number Diff line number Diff line
@@ -173,7 +173,7 @@ static const mozilla::Module::ContractIDEntry kPowerManagerContracts[] = {

// We mark the power module as being available in the GPU process because the
// appshell depends on the power manager service.
static const mozilla::Module kPowerManagerModule = {
extern const mozilla::Module kPowerManagerModule = {
    mozilla::Module::kVersion,
    kPowerManagerCIDs,
    kPowerManagerContracts,
@@ -182,5 +182,3 @@ static const mozilla::Module kPowerManagerModule = {
    nullptr,
    nullptr,
    mozilla::Module::ALLOW_IN_GPU_AND_SOCKET_PROCESS};

NSMODULE_DEFN(nsPowerManagerModule) = &kPowerManagerModule;
+1 −3
Original line number Diff line number Diff line
@@ -270,12 +270,10 @@ void nsLayoutModuleDtor() {
  xpcModuleDtor();
}

static const mozilla::Module kLayoutModule = {mozilla::Module::kVersion,
extern const mozilla::Module kLayoutModule = {mozilla::Module::kVersion,
                                              nullptr,
                                              nullptr,
                                              kLayoutCategories,
                                              nullptr,
                                              nullptr,
                                              nullptr};

NSMODULE_DEFN(nsLayoutModule) = &kLayoutModule;
Loading