From 03b9baceb0f361c2438fdd62f335d90c0f194135 Mon Sep 17 00:00:00 2001 From: "wmccloskey@mozilla.com" Date: Sat, 5 May 2012 11:56:58 +0300 Subject: [PATCH] Bug 716014, use compartment gc more often, JS API part, r=terrence --HG-- extra : rebase_source : c61a7552611cfbb0ce39bfee7787da57bec5a637 --- js/src/jsfriendapi.cpp | 11 +++++++++++ js/src/jsfriendapi.h | 3 +++ 2 files changed, 14 insertions(+) diff --git a/js/src/jsfriendapi.cpp b/js/src/jsfriendapi.cpp index 0c131d1336c..2c56df11aa1 100644 --- a/js/src/jsfriendapi.cpp +++ b/js/src/jsfriendapi.cpp @@ -144,6 +144,17 @@ js::PrepareForFullGC(JSRuntime *rt) c->scheduleGC(); } +JS_FRIEND_API(bool) +js::IsGCScheduled(JSRuntime *rt) +{ + for (CompartmentsIter c(rt); !c.done(); c.next()) { + if (c->isGCScheduled()) + return true; + } + + return false; +} + JS_FRIEND_API(void) js::GCForReason(JSRuntime *rt, gcreason::Reason reason) { diff --git a/js/src/jsfriendapi.h b/js/src/jsfriendapi.h index c3e119b0e6e..88687ac665f 100644 --- a/js/src/jsfriendapi.h +++ b/js/src/jsfriendapi.h @@ -651,6 +651,9 @@ PrepareCompartmentForGC(JSCompartment *comp); extern JS_FRIEND_API(void) PrepareForFullGC(JSRuntime *rt); +extern JS_FRIEND_API(bool) +IsGCScheduled(JSRuntime *rt); + /* * When triggering a GC using one of the functions below, it is first necessary * to select the compartments to be collected. To do this, you can call