Commit 412407ac authored by David Anderson's avatar David Anderson
Browse files

Ensure the power management service gets initialized in the GPU process. (bug...

Ensure the power management service gets initialized in the GPU process. (bug 1294350 part 8, r=froydnj)
parent 94df8b79
Loading
Loading
Loading
Loading
+15 −3
Original line number Diff line number Diff line
@@ -418,6 +418,13 @@ Initialize()
    NS_RUNTIMEABORT("Recursive layout module initialization");
    return NS_ERROR_FAILURE;
  }
  if (XRE_GetProcessType() == GeckoProcessType_GPU) {
    // We mark the layout module as being available in the GPU process so that
    // XPCOM's component manager initializes the power manager service, which
    // is needed for nsAppShell. However, we don't actually need anything in
    // the layout module itself.
    return NS_OK;
  }

  static_assert(sizeof(uintptr_t) == sizeof(void*),
                "Eeek! You'll need to adjust the size of uintptr_t to the "
@@ -1135,7 +1142,7 @@ static const mozilla::Module::CIDEntry kLayoutCIDs[] = {
  { &kMMS_SERVICE_CID, false, nullptr, nsIMmsServiceConstructor },
  { &kMOBILE_MESSAGE_SERVICE_CID, false, nullptr, nsIMobileMessageServiceConstructor },
  { &kMOBILE_MESSAGE_DATABASE_SERVICE_CID, false, nullptr, nsIMobileMessageDatabaseServiceConstructor },
  { &kNS_POWERMANAGERSERVICE_CID, false, nullptr, nsIPowerManagerServiceConstructor },
  { &kNS_POWERMANAGERSERVICE_CID, false, nullptr, nsIPowerManagerServiceConstructor, Module::ALLOW_IN_GPU_PROCESS },
  { &kOSFILECONSTANTSSERVICE_CID, true, nullptr, OSFileConstantsServiceConstructor },
  { &kNS_ALARMHALSERVICE_CID, false, nullptr, nsIAlarmHalServiceConstructor },
  { &kUDPSOCKETCHILD_CID, false, nullptr, UDPSocketChildConstructor },
@@ -1301,7 +1308,7 @@ static const mozilla::Module::ContractIDEntry kLayoutContracts[] = {
  { MMS_SERVICE_CONTRACTID, &kMMS_SERVICE_CID },
  { MOBILE_MESSAGE_SERVICE_CONTRACTID, &kMOBILE_MESSAGE_SERVICE_CID },
  { MOBILE_MESSAGE_DATABASE_SERVICE_CONTRACTID, &kMOBILE_MESSAGE_DATABASE_SERVICE_CID },
  { POWERMANAGERSERVICE_CONTRACTID, &kNS_POWERMANAGERSERVICE_CID },
  { POWERMANAGERSERVICE_CONTRACTID, &kNS_POWERMANAGERSERVICE_CID, Module::ALLOW_IN_GPU_PROCESS },
  { OSFILECONSTANTSSERVICE_CONTRACTID, &kOSFILECONSTANTSSERVICE_CID },
  { ALARMHALSERVICE_CONTRACTID, &kNS_ALARMHALSERVICE_CID },
  { "@mozilla.org/udp-socket-child;1", &kUDPSOCKETCHILD_CID },
@@ -1367,6 +1374,10 @@ static const mozilla::Module::CategoryEntry kLayoutCategories[] = {
static void
LayoutModuleDtor()
{
  if (XRE_GetProcessType() == GeckoProcessType_GPU) {
    return;
  }

  Shutdown();
  nsContentUtils::XPCOMShutdown();

@@ -1387,7 +1398,8 @@ static const mozilla::Module kLayoutModule = {
  kLayoutCategories,
  nullptr,
  Initialize,
  LayoutModuleDtor
  LayoutModuleDtor,
  Module::ALLOW_IN_GPU_PROCESS
};

NSMODULE_DEFN(nsLayoutModule) = &kLayoutModule;