mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-12 21:05:36 +00:00
JS_DestroyRuntime nukes all contexts; add JS_G/SetRuntimePrivate (r=tlundeen@webcrossing.com).
This commit is contained in:
parent
e9e143bc69
commit
7dd0a4f6c4
@ -631,7 +631,7 @@ JS_NewRuntime(uint32 maxbytes)
|
||||
rt->requestDone = JS_NEW_CONDVAR(rt->gcLock);
|
||||
if (!rt->requestDone)
|
||||
goto bad;
|
||||
js_SetupLocks(20,20); /* this is asymmetric with JS_ShutDown. */
|
||||
js_SetupLocks(20,20); /* this is asymmetric with JS_ShutDown. */
|
||||
rt->rtLock = JS_NEW_LOCK();
|
||||
rt->stateChange = JS_NEW_CONDVAR(rt->rtLock);
|
||||
#endif
|
||||
@ -649,6 +649,11 @@ bad:
|
||||
JS_PUBLIC_API(void)
|
||||
JS_DestroyRuntime(JSRuntime *rt)
|
||||
{
|
||||
JSContext *cx, *iter;
|
||||
|
||||
iter = NULL;
|
||||
while ((cx = js_ContextIterator(rt, &iter)) != NULL)
|
||||
js_DestroyContext(cx, JS_NO_GC);
|
||||
js_FinishGC(rt);
|
||||
#ifdef JS_THREADSAFE
|
||||
if (rt->gcLock)
|
||||
@ -672,6 +677,18 @@ JS_ShutDown(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(void *)
|
||||
JS_GetRuntimePrivate(JSRuntime *rt)
|
||||
{
|
||||
return rt->data;
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(void)
|
||||
JS_SetRuntimePrivate(JSRuntime *rt, void *data)
|
||||
{
|
||||
rt->data = data;
|
||||
}
|
||||
|
||||
#ifdef JS_THREADSAFE
|
||||
|
||||
JS_PUBLIC_API(void)
|
||||
|
@ -334,6 +334,12 @@ JS_DestroyRuntime(JSRuntime *rt);
|
||||
extern JS_PUBLIC_API(void)
|
||||
JS_ShutDown(void);
|
||||
|
||||
JS_PUBLIC_API(void *)
|
||||
JS_GetRuntimePrivate(JSRuntime *rt);
|
||||
|
||||
JS_PUBLIC_API(void)
|
||||
JS_SetRuntimePrivate(JSRuntime *rt, void *data);
|
||||
|
||||
#ifdef JS_THREADSAFE
|
||||
|
||||
extern JS_PUBLIC_API(void)
|
||||
|
@ -134,6 +134,9 @@ struct JSRuntime {
|
||||
/* XXX must come after JSCLists or MSVC alignment bug bites empty lists */
|
||||
JSPropertyCache propertyCache;
|
||||
|
||||
/* Client opaque pointer */
|
||||
void *data;
|
||||
|
||||
#ifdef JS_THREADSAFE
|
||||
/* These combine to interlock the GC and new requests. */
|
||||
PRLock *gcLock;
|
||||
|
Loading…
Reference in New Issue
Block a user