зеркало из https://github.com/mozilla/pjs.git
Bug 633986 Pref nice value, default to 1 on Android r=dougt a=blocking-fennec
This commit is contained in:
Родитель
133b6f4784
Коммит
46148c1dd1
|
@ -88,14 +88,6 @@
|
||||||
#include "nsPermissionManager.h"
|
#include "nsPermissionManager.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(ANDROID) || defined(LINUX)
|
|
||||||
#include <sys/time.h>
|
|
||||||
#include <sys/resource.h>
|
|
||||||
// TODO: For other platforms that support setpriority, figure out
|
|
||||||
// appropriate values of niceness
|
|
||||||
static const int kRelativeNiceness = 10;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "nsAccelerometer.h"
|
#include "nsAccelerometer.h"
|
||||||
|
|
||||||
#if defined(ANDROID)
|
#if defined(ANDROID)
|
||||||
|
@ -233,18 +225,6 @@ ContentChild::Init(MessageLoop* aIOLoop,
|
||||||
|
|
||||||
NS_ASSERTION(!sSingleton, "only one ContentChild per child");
|
NS_ASSERTION(!sSingleton, "only one ContentChild per child");
|
||||||
|
|
||||||
#if defined(ANDROID) || defined(LINUX)
|
|
||||||
// XXX We change the behavior of Linux child processes here. That
|
|
||||||
// means that, not just in Fennec, but also in Firefox, once it has
|
|
||||||
// child processes, those will be niced. IOW, Firefox with child processes
|
|
||||||
// will have different performance profiles on Linux than other
|
|
||||||
// platforms. This may alter Talos results and so forth.
|
|
||||||
char* relativeNicenessStr = getenv("MOZ_CHILD_PROCESS_RELATIVE_NICENESS");
|
|
||||||
setpriority(PRIO_PROCESS, 0, getpriority(PRIO_PROCESS, 0) +
|
|
||||||
(relativeNicenessStr ? atoi(relativeNicenessStr) :
|
|
||||||
kRelativeNiceness));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Open(aChannel, aParentHandle, aIOLoop);
|
Open(aChannel, aParentHandle, aIOLoop);
|
||||||
sSingleton = this;
|
sSingleton = this;
|
||||||
|
|
||||||
|
@ -415,7 +395,7 @@ ContentChild::RecvSetOffline(const PRBool& offline)
|
||||||
NS_ASSERTION(io, "IO Service can not be null");
|
NS_ASSERTION(io, "IO Service can not be null");
|
||||||
|
|
||||||
io->SetOffline(offline);
|
io->SetOffline(offline);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -435,7 +415,7 @@ ContentChild::ActorDestroy(ActorDestroyReason why)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
mAlertObservers.Clear();
|
mAlertObservers.Clear();
|
||||||
|
|
||||||
nsCOMPtr<nsIConsoleService> svc(do_GetService(NS_CONSOLESERVICE_CONTRACTID));
|
nsCOMPtr<nsIConsoleService> svc(do_GetService(NS_CONSOLESERVICE_CONTRACTID));
|
||||||
if (svc) {
|
if (svc) {
|
||||||
svc->UnregisterListener(mConsoleListener);
|
svc->UnregisterListener(mConsoleListener);
|
||||||
|
|
|
@ -70,6 +70,11 @@
|
||||||
#include "nsConsoleMessage.h"
|
#include "nsConsoleMessage.h"
|
||||||
#include "AudioParent.h"
|
#include "AudioParent.h"
|
||||||
|
|
||||||
|
#if defined(ANDROID) || defined(LINUX)
|
||||||
|
#include <sys/time.h>
|
||||||
|
#include <sys/resource.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef MOZ_PERMISSIONS
|
#ifdef MOZ_PERMISSIONS
|
||||||
#include "nsPermissionManager.h"
|
#include "nsPermissionManager.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -145,6 +150,26 @@ ContentParent::OnChannelConnected(int32 pid)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
SetOtherProcess(handle);
|
SetOtherProcess(handle);
|
||||||
|
|
||||||
|
#if defined(ANDROID) || defined(LINUX)
|
||||||
|
EnsurePrefService();
|
||||||
|
nsCOMPtr<nsIPrefBranch> branch;
|
||||||
|
branch = do_QueryInterface(mPrefService);
|
||||||
|
|
||||||
|
// Check nice preference
|
||||||
|
PRInt32 nice = 0;
|
||||||
|
branch->GetIntPref("dom.ipc.content.nice", &nice);
|
||||||
|
|
||||||
|
// Environment variable overrides preference
|
||||||
|
char* relativeNicenessStr = getenv("MOZ_CHILD_PROCESS_RELATIVE_NICENESS");
|
||||||
|
if (relativeNicenessStr) {
|
||||||
|
nice = atoi(relativeNicenessStr);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nice != 0) {
|
||||||
|
setpriority(PRIO_PROCESS, pid, getpriority(PRIO_PROCESS, pid) + nice);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче