author | Andrew McCreight <continuation@gmail.com> |
Mon, 15 Jun 2020 22:37:10 +0000 | |
changeset 535787 | c088d48d1e614289ec2047c38cc3b3b6b88a6327 |
parent 535786 | 26231891f0048c2782566ac71dc174392ecbb93a |
child 535788 | 323418a0d68fb43e033a82addb3475724217c0bc |
push id | 119072 |
push user | amccreight@mozilla.com |
push date | Mon, 15 Jun 2020 22:39:01 +0000 |
treeherder | autoland@c088d48d1e61 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | kmag |
bugs | 1645908 |
milestone | 79.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
js/xpconnect/idl/xpccomponents.idl | file | annotate | diff | comparison | revisions | |
js/xpconnect/src/XPCComponents.cpp | file | annotate | diff | comparison | revisions |
--- a/js/xpconnect/idl/xpccomponents.idl +++ b/js/xpconnect/idl/xpccomponents.idl @@ -245,16 +245,17 @@ interface nsIXPCComponents_Utils : nsISu [implicit_jscontext] xpcIJSWeakReference getWeakReference(in jsval obj); /* * To be called from JS only. * * Force an immediate garbage collection cycle. */ + [implicit_jscontext] void forceGC(); /* * To be called from JS only. * * Force an immediate cycle collection cycle. */ void forceCC([optional] in nsICycleCollectorListener aListener); @@ -299,16 +300,17 @@ interface nsIXPCComponents_Utils : nsISu */ void clearMaxCCTime(); /* * To be called from JS only. * * Force an immediate shrinking garbage collection cycle. */ + [implicit_jscontext] void forceShrinkingGC(); /* * Schedule a garbage collection cycle for a point in the future when no JS * is running. Call the provided function once this has occurred. */ void schedulePreciseGC(in nsIScheduledGCCallback callback);
--- a/js/xpconnect/src/XPCComponents.cpp +++ b/js/xpconnect/src/XPCComponents.cpp @@ -1613,20 +1613,19 @@ nsXPCComponents_Utils::GetWeakReference( RefPtr<xpcJSWeakReference> ref = new xpcJSWeakReference(); nsresult rv = ref->Init(cx, object); NS_ENSURE_SUCCESS(rv, rv); ref.forget(_retval); return NS_OK; } NS_IMETHODIMP -nsXPCComponents_Utils::ForceGC() { - JSContext* cx = XPCJSContext::Get()->Context(); - PrepareForFullGC(cx); - NonIncrementalGC(cx, GC_NORMAL, GCReason::COMPONENT_UTILS); +nsXPCComponents_Utils::ForceGC(JSContext* aCx) { + PrepareForFullGC(aCx); + NonIncrementalGC(aCx, GC_NORMAL, GCReason::COMPONENT_UTILS); return NS_OK; } NS_IMETHODIMP nsXPCComponents_Utils::ForceCC(nsICycleCollectorListener* listener) { nsJSContext::CycleCollectNow(listener); return NS_OK; } @@ -1659,20 +1658,19 @@ nsXPCComponents_Utils::GetMaxCCSliceTime NS_IMETHODIMP nsXPCComponents_Utils::ClearMaxCCTime() { nsJSContext::ClearMaxCCSliceTime(); return NS_OK; } NS_IMETHODIMP -nsXPCComponents_Utils::ForceShrinkingGC() { - JSContext* cx = dom::danger::GetJSContext(); - PrepareForFullGC(cx); - NonIncrementalGC(cx, GC_SHRINK, GCReason::COMPONENT_UTILS); +nsXPCComponents_Utils::ForceShrinkingGC(JSContext* aCx) { + PrepareForFullGC(aCx); + NonIncrementalGC(aCx, GC_SHRINK, GCReason::COMPONENT_UTILS); return NS_OK; } class PreciseGCRunnable : public Runnable { public: PreciseGCRunnable(nsIScheduledGCCallback* aCallback, bool aShrinking) : mozilla::Runnable("PreciseGCRunnable"), mCallback(aCallback),