Bug 721933 - add way to do compartment GC with a reason. r=billm

This commit is contained in:
Andrew McCreight 2012-02-01 17:55:09 -08:00
parent 18e41ee0ff
commit e182241389
2 changed files with 12 additions and 0 deletions

View File

@ -135,6 +135,15 @@ js::GCForReason(JSContext *cx, gcreason::Reason reason)
js_GC(cx, NULL, GC_NORMAL, reason);
}
JS_FRIEND_API(void)
js::CompartmentGCForReason(JSContext *cx, JSCompartment *comp, gcreason::Reason reason)
{
/* We cannot GC the atoms compartment alone; use a full GC instead. */
JS_ASSERT(comp != cx->runtime->atomsCompartment);
js_GC(cx, comp, GC_NORMAL, reason);
}
JS_FRIEND_API(void)
js::ShrinkingGC(JSContext *cx, gcreason::Reason reason)
{

View File

@ -675,6 +675,9 @@ enum Reason {
extern JS_FRIEND_API(void)
GCForReason(JSContext *cx, gcreason::Reason reason);
extern JS_FRIEND_API(void)
CompartmentGCForReason(JSContext *cx, JSCompartment *comp, gcreason::Reason reason);
extern JS_FRIEND_API(void)
ShrinkingGC(JSContext *cx, gcreason::Reason reason);