Bug 1050122 - Part 2: Disable preallocate when proc loader is not initialized. r=khuey

This commit is contained in:
Ting-Yu Chou 2014-11-01 13:28:33 +08:00
parent 4f77c2c332
commit 3055606b7d
3 changed files with 18 additions and 2 deletions

View File

@ -18,6 +18,10 @@
#include "ipc/Nuwa.h"
#endif
#ifdef MOZ_B2G_LOADER
#include "ProcessUtils.h"
#endif
// This number is fairly arbitrary ... the intention is to put off
// launching another app process until the last one has finished
// loading its content, to reduce CPU/memory/IO contention.
@ -133,7 +137,14 @@ PreallocatedProcessManagerImpl::Init()
os->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID,
/* weakRef = */ false);
}
RereadPrefs();
#ifdef MOZ_B2G_LOADER
if (!mozilla::ipc::ProcLoaderIsInitialized()) {
Disable();
} else
#endif
{
RereadPrefs();
}
}
NS_IMETHODIMP

View File

@ -21,7 +21,7 @@ void SetThisProcessName(const char *aName);
#ifdef MOZ_B2G_LOADER
// see ProcessUtils_linux.cpp for explaination.
void ProcLoaderClientGeckoInit();
bool ProcLoaderIsInitialized();
bool ProcLoaderLoad(const char *aArgv[],
const char *aEnvp[],
const base::file_handle_mapping_vector &aFdsRemap,

View File

@ -227,6 +227,11 @@ ProcLoaderClientGeckoInit()
sProcLoaderLoop = MessageLoop::current();
}
bool ProcLoaderIsInitialized()
{
return sProcLoaderPid != 0;
}
/**
* Shutdown and destroy the client of B2G loader service.
*/