From 096e083ebfff20abbacabe85a660374273105600 Mon Sep 17 00:00:00 2001 From: Till Schneidereit Date: Tue, 15 May 2012 18:30:15 -0400 Subject: [PATCH] Bug 754299 - Update gcMaxMallocBytes of existing compartments in JSRuntime::setGCMaxMallocBytes. r=billm --- js/src/jscntxt.cpp | 8 ++++++++ js/src/jscntxt.h | 4 +--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/js/src/jscntxt.cpp b/js/src/jscntxt.cpp index afe73b52281..810dba13b34 100644 --- a/js/src/jscntxt.cpp +++ b/js/src/jscntxt.cpp @@ -1099,6 +1099,14 @@ JSContext::runningWithTrustedPrincipals() const return !compartment || compartment->principals == runtime->trustedPrincipals(); } +void +JSRuntime::setGCMaxMallocBytes(size_t value) +{ + gcMaxMallocBytes = value; + for (CompartmentsIter c(this); !c.done(); c.next()) + c->setGCMaxMallocBytes(value); +} + void JSRuntime::updateMallocCounter(JSContext *cx, size_t nbytes) { diff --git a/js/src/jscntxt.h b/js/src/jscntxt.h index 86ce0e2ffed..e3df67fd057 100644 --- a/js/src/jscntxt.h +++ b/js/src/jscntxt.h @@ -852,9 +852,7 @@ struct JSRuntime : js::RuntimeFriendFields JS_DECLARE_NEW_METHODS(malloc_, JS_ALWAYS_INLINE) JS_DECLARE_DELETE_METHODS(free_, JS_ALWAYS_INLINE) - void setGCMaxMallocBytes(size_t value) { - gcMaxMallocBytes = value; - } + void setGCMaxMallocBytes(size_t value); /* * Call this after allocating memory held by GC things, to update memory