зеркало из https://github.com/mozilla/gecko-dev.git
Bug 618533 - forward oom notifications to child content process. r=jdm a=blocking-fennec
This commit is contained in:
Родитель
c9efb237e4
Коммит
1e9877817a
|
@ -586,5 +586,15 @@ ContentChild::RecvScreenSizeChanged(const gfxIntSize& size)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
ContentChild::RecvFlushMemory(const nsString& reason)
|
||||
{
|
||||
nsCOMPtr<nsIObserverService> os =
|
||||
mozilla::services::GetObserverService();
|
||||
if (os)
|
||||
os->NotifyObservers(nsnull, "memory-pressure", reason.get());
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -131,6 +131,9 @@ public:
|
|||
const double& z);
|
||||
|
||||
virtual bool RecvScreenSizeChanged(const gfxIntSize &size);
|
||||
|
||||
virtual bool RecvFlushMemory(const nsString& reason);
|
||||
|
||||
#ifdef ANDROID
|
||||
gfxIntSize GetScreenSize() { return mScreenSize; }
|
||||
#endif
|
||||
|
|
|
@ -116,7 +116,9 @@ ContentParent::GetSingleton(PRBool aForceNew)
|
|||
}
|
||||
}
|
||||
obs->AddObserver(
|
||||
parent, NS_IPC_IOSERVICE_SET_OFFLINE_TOPIC, PR_FALSE);
|
||||
parent, NS_IPC_IOSERVICE_SET_OFFLINE_TOPIC, PR_FALSE);
|
||||
|
||||
obs->AddObserver(parent, "memory-pressure", PR_FALSE);
|
||||
}
|
||||
nsCOMPtr<nsIThreadInternal>
|
||||
threadInt(do_QueryInterface(NS_GetCurrentThread()));
|
||||
|
@ -354,8 +356,12 @@ ContentParent::Observe(nsISupports* aSubject,
|
|||
if (!mIsAlive || !mSubprocess)
|
||||
return NS_OK;
|
||||
|
||||
// listening for memory pressure event
|
||||
if (!strcmp(aTopic, "memory-pressure")) {
|
||||
SendFlushMemory(nsDependentString(aData));
|
||||
}
|
||||
// listening for remotePrefs...
|
||||
if (!strcmp(aTopic, "nsPref:changed")) {
|
||||
else if (!strcmp(aTopic, "nsPref:changed")) {
|
||||
// We know prefs are ASCII here.
|
||||
NS_LossyConvertUTF16toASCII strData(aData);
|
||||
|
||||
|
|
|
@ -116,6 +116,8 @@ child:
|
|||
|
||||
ScreenSizeChanged(gfxIntSize size);
|
||||
|
||||
FlushMemory(nsString reason);
|
||||
|
||||
parent:
|
||||
PNecko();
|
||||
PCrashReporter();
|
||||
|
|
Загрузка…
Ссылка в новой задаче