mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 655647 - Allow per-process GC/CC from about:memory. r=dougt
This commit is contained in:
parent
6b8124559c
commit
dbfb7766e5
@ -73,6 +73,7 @@
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsIScriptError.h"
|
||||
#include "nsIConsoleService.h"
|
||||
#include "nsJSEnvironment.h"
|
||||
|
||||
#include "History.h"
|
||||
#include "nsDocShellCID.h"
|
||||
@ -763,5 +764,20 @@ ContentChild::GetIndexedDBPath()
|
||||
return *gIndexedDBPath;
|
||||
}
|
||||
|
||||
bool
|
||||
ContentChild::RecvGarbageCollect()
|
||||
{
|
||||
nsJSContext::GarbageCollectNow();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
ContentChild::RecvCycleCollect()
|
||||
{
|
||||
nsJSContext::GarbageCollectNow();
|
||||
nsJSContext::CycleCollectNow();
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
@ -148,6 +148,9 @@ public:
|
||||
|
||||
virtual bool RecvActivateA11y();
|
||||
|
||||
virtual bool RecvGarbageCollect();
|
||||
virtual bool RecvCycleCollect();
|
||||
|
||||
#ifdef ANDROID
|
||||
gfxIntSize GetScreenSize() { return mScreenSize; }
|
||||
#endif
|
||||
|
@ -200,6 +200,8 @@ ContentParent::Init()
|
||||
obs->AddObserver(this, NS_IPC_IOSERVICE_SET_OFFLINE_TOPIC, PR_FALSE);
|
||||
obs->AddObserver(this, "child-memory-reporter-request", PR_FALSE);
|
||||
obs->AddObserver(this, "memory-pressure", PR_FALSE);
|
||||
obs->AddObserver(this, "child-gc-request", PR_FALSE);
|
||||
obs->AddObserver(this, "child-cc-request", PR_FALSE);
|
||||
#ifdef ACCESSIBILITY
|
||||
obs->AddObserver(this, "a11y-init-or-shutdown", PR_FALSE);
|
||||
#endif
|
||||
@ -304,6 +306,8 @@ ContentParent::ActorDestroy(ActorDestroyReason why)
|
||||
obs->RemoveObserver(static_cast<nsIObserver*>(this), "memory-pressure");
|
||||
obs->RemoveObserver(static_cast<nsIObserver*>(this), "child-memory-reporter-request");
|
||||
obs->RemoveObserver(static_cast<nsIObserver*>(this), NS_IPC_IOSERVICE_SET_OFFLINE_TOPIC);
|
||||
obs->RemoveObserver(static_cast<nsIObserver*>(this), "child-gc-request");
|
||||
obs->RemoveObserver(static_cast<nsIObserver*>(this), "child-cc-request");
|
||||
#ifdef ACCESSIBILITY
|
||||
obs->RemoveObserver(static_cast<nsIObserver*>(this), "a11y-init-or-shutdown");
|
||||
#endif
|
||||
@ -749,6 +753,12 @@ ContentParent::Observe(nsISupports* aSubject,
|
||||
else if (!strcmp(aTopic, "child-memory-reporter-request")) {
|
||||
SendPMemoryReportRequestConstructor();
|
||||
}
|
||||
else if (!strcmp(aTopic, "child-gc-request")){
|
||||
SendGarbageCollect();
|
||||
}
|
||||
else if (!strcmp(aTopic, "child-cc-request")){
|
||||
SendCycleCollect();
|
||||
}
|
||||
#ifdef ACCESSIBILITY
|
||||
// Make sure accessibility is running in content process when accessibility
|
||||
// gets initiated in chrome process.
|
||||
|
@ -105,6 +105,7 @@ LOCAL_INCLUDES += \
|
||||
-I$(srcdir)/../../xpcom/base \
|
||||
-I$(srcdir)/../indexedDB \
|
||||
-I$(topsrcdir)/extensions/cookie \
|
||||
-I$(topsrcdir)/dom/base \
|
||||
$(NULL)
|
||||
|
||||
DEFINES += -DBIN_SUFFIX='"$(BIN_SUFFIX)"'
|
||||
|
@ -129,6 +129,9 @@ child:
|
||||
|
||||
FlushMemory(nsString reason);
|
||||
|
||||
GarbageCollect();
|
||||
CycleCollect();
|
||||
|
||||
/**
|
||||
* Start accessibility engine in content process.
|
||||
*/
|
||||
|
@ -144,6 +144,9 @@ function $(n)
|
||||
function doGlobalGC()
|
||||
{
|
||||
Cu.forceGC();
|
||||
var os = Cc["@mozilla.org/observer-service;1"]
|
||||
.getService(Ci.nsIObserverService);
|
||||
os.notifyObservers(null, "child-gc-request", null);
|
||||
update();
|
||||
}
|
||||
|
||||
@ -152,6 +155,9 @@ function doCC()
|
||||
window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils)
|
||||
.cycleCollect();
|
||||
var os = Cc["@mozilla.org/observer-service;1"]
|
||||
.getService(Ci.nsIObserverService);
|
||||
os.notifyObservers(null, "child-cc-request", null);
|
||||
update();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user