Bug 1024470 - Make sure we run InitOnContentProcessCreated in all cases. r=khuey

This commit is contained in:
"Kan-Ru Chen (陳侃如)" 2014-06-19 01:22:05 +08:00
Родитель c700a52d2a
Коммит 093e2092b9
2 изменённых файлов: 27 добавлений и 15 удалений

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

@ -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,23 +602,28 @@ 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;
BackgroundChild::Startup();
if (XRE_GetProcessType() == GeckoProcessType_Default) {
BackgroundChild::Startup();
// Try to preallocate a process that we can transform into an app later.
PreallocatedProcessManager::AllocateAfterDelay();
// Try to preallocate a process that we can transform into an app later.
PreallocatedProcessManager::AllocateAfterDelay();
// Test the PBackground infrastructure on ENABLE_TESTS builds when a special
// testing preference is set.
MaybeTestPBackground();
}
// Test the PBackground infrastructure on ENABLE_TESTS builds when a special
// testing preference is set.
MaybeTestPBackground();
}
/*static*/ void