зеркало из https://github.com/mozilla/gecko-dev.git
Bug 785237: Give prelaunch processes background priority, and move the background oom_adj up (down?) a class. r=jlebar
This commit is contained in:
Родитель
179b553f43
Коммит
9509102724
|
@ -507,7 +507,7 @@ pref("dom.ipc.processPriorityManager.enabled", true);
|
|||
pref("dom.ipc.processPriorityManager.gracePeriodMS", 1000);
|
||||
pref("hal.processPriorityManager.gonk.masterOomAdjust", 0);
|
||||
pref("hal.processPriorityManager.gonk.foregroundOomAdjust", 1);
|
||||
pref("hal.processPriorityManager.gonk.backgroundOomAdjust", 2);
|
||||
pref("hal.processPriorityManager.gonk.backgroundOomAdjust", 6);
|
||||
pref("hal.processPriorityManager.gonk.masterNice", -1);
|
||||
pref("hal.processPriorityManager.gonk.foregroundNice", 0);
|
||||
pref("hal.processPriorityManager.gonk.backgroundNice", 10);
|
||||
|
|
|
@ -19,9 +19,11 @@
|
|||
#include "AudioChild.h"
|
||||
#endif
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/dom/ExternalHelperAppChild.h"
|
||||
#include "mozilla/dom/PCrashReporterChild.h"
|
||||
#include "mozilla/dom/StorageChild.h"
|
||||
#include "mozilla/Hal.h"
|
||||
#include "mozilla/hal_sandbox/PHalChild.h"
|
||||
#include "mozilla/ipc/TestShellChild.h"
|
||||
#include "mozilla/ipc/XPCShellEnvironment.h"
|
||||
|
@ -31,7 +33,6 @@
|
|||
#include "mozilla/layers/PCompositorChild.h"
|
||||
#include "mozilla/net/NeckoChild.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
|
||||
#if defined(MOZ_SYDNEYAUDIO)
|
||||
#include "nsAudioStream.h"
|
||||
|
@ -100,6 +101,7 @@
|
|||
#include "nsContentUtils.h"
|
||||
#include "nsIPrincipal.h"
|
||||
|
||||
using namespace base;
|
||||
using namespace mozilla::docshell;
|
||||
using namespace mozilla::dom::devicestorage;
|
||||
using namespace mozilla::dom::sms;
|
||||
|
@ -287,6 +289,14 @@ ContentChild::Init(MessageLoop* aIOLoop,
|
|||
#endif
|
||||
#endif
|
||||
|
||||
bool startBackground = true;
|
||||
SendGetProcessAttributes(&mID, &startBackground,
|
||||
&mIsForApp, &mIsForBrowser);
|
||||
hal::SetProcessPriority(
|
||||
GetCurrentProcId(),
|
||||
startBackground ? hal::PROCESS_PRIORITY_BACKGROUND:
|
||||
hal::PROCESS_PRIORITY_FOREGROUND);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -951,20 +961,6 @@ ContentChild::RecvAppInfo(const nsCString& version, const nsCString& buildID)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
ContentChild::RecvSetProcessAttributes(const uint64_t &id,
|
||||
const bool& aIsForApp,
|
||||
const bool& aIsForBrowser)
|
||||
{
|
||||
if (mID != uint64_t(-1)) {
|
||||
NS_WARNING("Setting content child's ID twice?");
|
||||
}
|
||||
mID = id;
|
||||
mIsForApp = aIsForApp;
|
||||
mIsForBrowser = aIsForBrowser;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
ContentChild::RecvLastPrivateDocShellDestroyed()
|
||||
{
|
||||
|
|
|
@ -167,9 +167,6 @@ public:
|
|||
virtual bool RecvCycleCollect();
|
||||
|
||||
virtual bool RecvAppInfo(const nsCString& version, const nsCString& buildID);
|
||||
virtual bool RecvSetProcessAttributes(const uint64_t& id,
|
||||
const bool& aIsForApp,
|
||||
const bool& aIsForBrowser);
|
||||
|
||||
virtual bool RecvLastPrivateDocShellDestroyed();
|
||||
|
||||
|
|
|
@ -686,9 +686,10 @@ ContentParent::ContentParent(const nsAString& aAppManifestURL,
|
|||
, mGeolocationWatchID(-1)
|
||||
, mRunToCompletionDepth(0)
|
||||
, mShouldCallUnblockChild(false)
|
||||
, mAppManifestURL(aAppManifestURL)
|
||||
, mIsAlive(true)
|
||||
, mSendPermissionUpdates(false)
|
||||
, mAppManifestURL(aAppManifestURL)
|
||||
, mIsForBrowser(aIsForBrowser)
|
||||
{
|
||||
// From this point on, NS_WARNING, NS_ASSERTION, etc. should print out the
|
||||
// PID along with the warning.
|
||||
|
@ -707,8 +708,6 @@ ContentParent::ContentParent(const nsAString& aAppManifestURL,
|
|||
mSubprocess->AsyncLaunch();
|
||||
}
|
||||
Open(mSubprocess->GetChannel(), mSubprocess->GetChildProcessHandle());
|
||||
unused << SendSetProcessAttributes(gContentChildID++,
|
||||
IsForApp(), aIsForBrowser);
|
||||
|
||||
// NB: internally, this will send an IPC message to the child
|
||||
// process to get it to create the CompositorChild. This
|
||||
|
@ -1087,6 +1086,18 @@ ContentParent::AllocPImageBridge(mozilla::ipc::Transport* aTransport,
|
|||
return ImageBridgeParent::Create(aTransport, aOtherProcess);
|
||||
}
|
||||
|
||||
bool
|
||||
ContentParent::RecvGetProcessAttributes(uint64_t* aId, bool* aStartBackground,
|
||||
bool* aIsForApp, bool* aIsForBrowser)
|
||||
{
|
||||
*aId = gContentChildID++;
|
||||
*aStartBackground =
|
||||
(mAppManifestURL == MAGIC_PREALLOCATED_APP_MANIFEST_URL);
|
||||
*aIsForApp = IsForApp();
|
||||
*aIsForBrowser = mIsForBrowser;
|
||||
return true;
|
||||
}
|
||||
|
||||
PBrowserParent*
|
||||
ContentParent::AllocPBrowser(const uint32_t& aChromeFlags,
|
||||
const bool& aIsBrowserElement, const AppId& aApp)
|
||||
|
|
|
@ -164,6 +164,11 @@ private:
|
|||
AllocPImageBridge(mozilla::ipc::Transport* aTransport,
|
||||
base::ProcessId aOtherProcess) MOZ_OVERRIDE;
|
||||
|
||||
virtual bool RecvGetProcessAttributes(uint64_t* aId,
|
||||
bool* aStartBackground,
|
||||
bool* aIsForApp,
|
||||
bool* aIsForBrowser) MOZ_OVERRIDE;
|
||||
|
||||
virtual PBrowserParent* AllocPBrowser(const uint32_t& aChromeFlags,
|
||||
const bool& aIsBrowserElement,
|
||||
const AppId& aApp);
|
||||
|
@ -297,12 +302,13 @@ private:
|
|||
// the nsIObserverService.
|
||||
nsCOMArray<nsIMemoryReporter> mMemoryReporters;
|
||||
|
||||
bool mIsAlive;
|
||||
bool mSendPermissionUpdates;
|
||||
|
||||
const nsString mAppManifestURL;
|
||||
nsRefPtr<nsFrameMessageManager> mMessageManager;
|
||||
|
||||
bool mIsAlive;
|
||||
bool mSendPermissionUpdates;
|
||||
bool mIsForBrowser;
|
||||
|
||||
friend class CrashReporterParent;
|
||||
};
|
||||
|
||||
|
|
|
@ -198,17 +198,6 @@ child:
|
|||
|
||||
PTestShell();
|
||||
|
||||
/**
|
||||
* Tell the content process some attributes of itself. This is
|
||||
* the first message received by content processes after startup.
|
||||
*
|
||||
* |id| is a unique ID among all subprocesses. When |isForApp &&
|
||||
* isForBrowser|, we're loading <browser> for an app. When
|
||||
* |isForBrowser|, we're loading <browser>. When |!isForApp &&
|
||||
* !isForBrowser|, we're probably loading <xul:browser remote>.
|
||||
*/
|
||||
SetProcessAttributes(uint64_t id, bool isForApp, bool isForBrowser);
|
||||
|
||||
RegisterChrome(ChromePackage[] packages, ResourceMapping[] resources,
|
||||
OverrideMapping[] overrides, nsCString locale);
|
||||
|
||||
|
@ -247,6 +236,21 @@ child:
|
|||
FileSystemUpdate(nsString fsName, nsString mountPoint, int32_t fsState);
|
||||
|
||||
parent:
|
||||
/**
|
||||
* Tell the content process some attributes of itself. This is
|
||||
* among the first information queried by content processes after
|
||||
* startup. (The message is sync to allow the content process to
|
||||
* control when it receives the information.)
|
||||
*
|
||||
* |id| is a unique ID among all subprocesses. When |isForApp &&
|
||||
* isForBrowser|, we're loading <browser> for an app. When
|
||||
* |isForBrowser|, we're loading <browser>. When |!isForApp &&
|
||||
* !isForBrowser|, we're probably loading <xul:browser remote>.
|
||||
*/
|
||||
sync GetProcessAttributes()
|
||||
returns (uint64_t id, bool startBackground,
|
||||
bool isForApp, bool isForBrowser);
|
||||
|
||||
PAudio(int32_t aNumChannels, int32_t aRate, int32_t aFormat);
|
||||
|
||||
PDeviceStorageRequest(DeviceStorageParams params);
|
||||
|
|
Загрузка…
Ссылка в новой задаче