mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-04 19:33:18 +00:00
Bug 1024470 - Make sure we run InitOnContentProcessCreated in all cases. r=khuey
This commit is contained in:
parent
c700a52d2a
commit
093e2092b9
@ -482,8 +482,17 @@ ContentChild* ContentChild::sSingleton;
|
||||
// Performs initialization that is not fork-safe, i.e. that must be done after
|
||||
// forking from the Nuwa process.
|
||||
static void
|
||||
InitOnContentProcessCreated()
|
||||
InitOnContentProcessCreated(bool aAfterNuwaFork)
|
||||
{
|
||||
#ifdef MOZ_NUWA_PROCESS
|
||||
// Wait until we are forked from Nuwa
|
||||
if (!aAfterNuwaFork &&
|
||||
Preferences::GetBool("dom.ipc.processPrelaunch.enabled", false)) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
unused << aAfterNuwaFork;
|
||||
#endif
|
||||
// This will register cross-process observer.
|
||||
mozilla::dom::time::InitializeDateCacheCleaner();
|
||||
}
|
||||
@ -670,9 +679,7 @@ ContentChild::InitXPCOM()
|
||||
new SystemMessageHandledObserver();
|
||||
sysMsgObserver->Init();
|
||||
|
||||
#ifndef MOZ_NUWA_PROCESS
|
||||
InitOnContentProcessCreated();
|
||||
#endif
|
||||
InitOnContentProcessCreated(/* aAfterNuwaFork = */false);
|
||||
}
|
||||
|
||||
PMemoryReportRequestChild*
|
||||
@ -1843,7 +1850,7 @@ public:
|
||||
}
|
||||
|
||||
// Perform other after-fork initializations.
|
||||
InitOnContentProcessCreated();
|
||||
InitOnContentProcessCreated(/* aAfterNuwaFork = */true);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -602,14 +602,20 @@ ContentParent::MaybeTakePreallocatedAppProcess(const nsAString& aAppManifestURL,
|
||||
/*static*/ void
|
||||
ContentParent::StartUp()
|
||||
{
|
||||
// We could launch sub processes from content process
|
||||
// FIXME Bug 1023701 - Stop using ContentParent static methods in
|
||||
// child process
|
||||
sCanLaunchSubprocesses = true;
|
||||
|
||||
if (XRE_GetProcessType() != GeckoProcessType_Default) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Note: This reporter measures all ContentParents.
|
||||
RegisterStrongMemoryReporter(new ContentParentsMemoryReporter());
|
||||
|
||||
mozilla::dom::time::InitializeDateCacheCleaner();
|
||||
|
||||
sCanLaunchSubprocesses = true;
|
||||
|
||||
if (XRE_GetProcessType() == GeckoProcessType_Default) {
|
||||
BackgroundChild::Startup();
|
||||
|
||||
// Try to preallocate a process that we can transform into an app later.
|
||||
@ -618,7 +624,6 @@ ContentParent::StartUp()
|
||||
// Test the PBackground infrastructure on ENABLE_TESTS builds when a special
|
||||
// testing preference is set.
|
||||
MaybeTestPBackground();
|
||||
}
|
||||
}
|
||||
|
||||
/*static*/ void
|
||||
|
Loading…
Reference in New Issue
Block a user