Bug 902095 - Allow accessing the compartment/zone for ExclusiveContext, r=billm.

This commit is contained in:
Brian Hackett
2013-08-13 09:13:46 -06:00
parent 8e2628986e
commit 48d45c5a34
30 changed files with 204 additions and 194 deletions

View File

@@ -117,13 +117,14 @@ const char js_yield_str[] = "yield";
bool
js::InitAtoms(JSRuntime *rt)
{
return rt->atoms.init(JS_STRING_HASH_COUNT);
AutoLockForExclusiveAccess lock(rt);
return rt->atoms().init(JS_STRING_HASH_COUNT);
}
void
js::FinishAtoms(JSRuntime *rt)
{
AtomSet &atoms = rt->atoms;
AtomSet &atoms = rt->atoms();
if (!atoms.initialized()) {
/*
* We are called with uninitialized state when JS_NewRuntime fails and
@@ -181,7 +182,7 @@ void
js::MarkAtoms(JSTracer *trc)
{
JSRuntime *rt = trc->runtime;
for (AtomSet::Range r = rt->atoms.all(); !r.empty(); r.popFront()) {
for (AtomSet::Range r = rt->atoms().all(); !r.empty(); r.popFront()) {
AtomStateEntry entry = r.front();
if (!entry.isTagged())
continue;
@@ -195,7 +196,7 @@ js::MarkAtoms(JSTracer *trc)
void
js::SweepAtoms(JSRuntime *rt)
{
for (AtomSet::Enum e(rt->atoms); !e.empty(); e.popFront()) {
for (AtomSet::Enum e(rt->atoms()); !e.empty(); e.popFront()) {
AtomStateEntry entry = e.front();
JSAtom *atom = entry.asPtr();
bool isDying = IsStringAboutToBeFinalized(&atom);
@@ -215,7 +216,9 @@ AtomIsInterned(JSContext *cx, JSAtom *atom)
if (StaticStrings::isStatic(atom))
return true;
AtomSet::Ptr p = cx->runtime()->atoms.lookup(atom);
AutoLockForExclusiveAccess lock(cx);
AtomSet::Ptr p = cx->runtime()->atoms().lookup(atom);
if (!p)
return false;