mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 07:42:04 +00:00
Bug 808756 - Introduce a memory-pressure event that is not forwarded by the main process to its children. r=jlebar
This commit is contained in:
parent
df0b99ecc4
commit
9e3fdc6388
@ -1043,7 +1043,8 @@ ContentParent::Observe(nsISupports* aSubject,
|
||||
return NS_OK;
|
||||
|
||||
// listening for memory pressure event
|
||||
if (!strcmp(aTopic, "memory-pressure")) {
|
||||
if (!strcmp(aTopic, "memory-pressure") &&
|
||||
!NS_LITERAL_STRING("low-memory-no-forward").Equals(aData)) {
|
||||
unused << SendFlushMemory(nsDependentString(aData));
|
||||
}
|
||||
// listening for remotePrefs...
|
||||
|
@ -34,8 +34,10 @@ public:
|
||||
|
||||
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
|
||||
if (os) {
|
||||
// We use low-memory-no-forward because each process has its own watcher
|
||||
// and thus there is no need for the main process to forward this event.
|
||||
os->NotifyObservers(nullptr, "memory-pressure",
|
||||
NS_LITERAL_STRING("low-memory").get());
|
||||
NS_LITERAL_STRING("low-memory-no-forward").get());
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -26,6 +26,11 @@
|
||||
* This will be passed as the extra data when the pressure
|
||||
* observer is being asked to flush for low-memory conditions.
|
||||
*
|
||||
* "low-memory-no-forward"
|
||||
* This will be passed as the extra data when the pressure observer
|
||||
* is being asked to flush for low-memory conditions but the resulting
|
||||
* notification should not be forwarded to the child processes.
|
||||
*
|
||||
* "heap-minimize"
|
||||
* This will be passed as the extra data when the pressure
|
||||
* observer is being asked to flush because of a heap minimize
|
||||
|
Loading…
Reference in New Issue
Block a user