Bug 412985 - "Provide stubs for JS_THREADSAFE APIs in non-JS_THREADSAFE builds" [p=jorendorff@mozilla.com (Jason Orendorff) r+a1.9=brendan]
git-svn-id: svn://10.0.0.236/trunk@245043 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
2ac8640250
commit
f37b77ecd2
@ -831,11 +831,10 @@ JS_SetRuntimePrivate(JSRuntime *rt, void *data)
|
||||
rt->data = data;
|
||||
}
|
||||
|
||||
#ifdef JS_THREADSAFE
|
||||
|
||||
JS_PUBLIC_API(void)
|
||||
JS_BeginRequest(JSContext *cx)
|
||||
{
|
||||
#ifdef JS_THREADSAFE
|
||||
JSRuntime *rt;
|
||||
|
||||
JS_ASSERT(cx->thread->id == js_CurrentThreadId());
|
||||
@ -859,11 +858,13 @@ JS_BeginRequest(JSContext *cx)
|
||||
}
|
||||
cx->requestDepth++;
|
||||
cx->outstandingRequests++;
|
||||
#endif
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(void)
|
||||
JS_EndRequest(JSContext *cx)
|
||||
{
|
||||
#ifdef JS_THREADSAFE
|
||||
JSRuntime *rt;
|
||||
JSScope *scope, **todop;
|
||||
uintN nshares;
|
||||
@ -918,12 +919,14 @@ JS_EndRequest(JSContext *cx)
|
||||
|
||||
cx->requestDepth--;
|
||||
cx->outstandingRequests--;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Yield to pending GC operations, regardless of request depth */
|
||||
JS_PUBLIC_API(void)
|
||||
JS_YieldRequest(JSContext *cx)
|
||||
{
|
||||
#ifdef JS_THREADSAFE
|
||||
JSRuntime *rt;
|
||||
|
||||
JS_ASSERT(cx->thread);
|
||||
@ -945,28 +948,33 @@ JS_YieldRequest(JSContext *cx)
|
||||
}
|
||||
rt->requestCount++;
|
||||
JS_UNLOCK_GC(rt);
|
||||
#endif
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(jsrefcount)
|
||||
JS_SuspendRequest(JSContext *cx)
|
||||
{
|
||||
#ifdef JS_THREADSAFE
|
||||
jsrefcount saveDepth = cx->requestDepth;
|
||||
|
||||
while (cx->requestDepth)
|
||||
JS_EndRequest(cx);
|
||||
return saveDepth;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(void)
|
||||
JS_ResumeRequest(JSContext *cx, jsrefcount saveDepth)
|
||||
{
|
||||
#ifdef JS_THREADSAFE
|
||||
JS_ASSERT(!cx->requestDepth);
|
||||
while (--saveDepth >= 0)
|
||||
JS_BeginRequest(cx);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* JS_THREADSAFE */
|
||||
|
||||
JS_PUBLIC_API(void)
|
||||
JS_Lock(JSRuntime *rt)
|
||||
{
|
||||
|
||||
@ -430,8 +430,6 @@ JS_GetRuntimePrivate(JSRuntime *rt);
|
||||
JS_PUBLIC_API(void)
|
||||
JS_SetRuntimePrivate(JSRuntime *rt, void *data);
|
||||
|
||||
#ifdef JS_THREADSAFE
|
||||
|
||||
extern JS_PUBLIC_API(void)
|
||||
JS_BeginRequest(JSContext *cx);
|
||||
|
||||
@ -481,8 +479,6 @@ class JSAutoRequest {
|
||||
JS_BEGIN_EXTERN_C
|
||||
#endif
|
||||
|
||||
#endif /* JS_THREADSAFE */
|
||||
|
||||
extern JS_PUBLIC_API(void)
|
||||
JS_Lock(JSRuntime *rt);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user