зеркало из https://github.com/mozilla/gecko-dev.git
added JS_YieldRequest to API (me), and removed assertion in InitClass (mlm)
This commit is contained in:
Родитель
29f04506ff
Коммит
7c6a64dcbf
|
@ -19,6 +19,7 @@
|
|||
/*
|
||||
* JavaScript API.
|
||||
*/
|
||||
#include "jsstddef.h"
|
||||
#include <ctype.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -460,6 +461,23 @@ JS_EndRequest(JSContext *cx)
|
|||
}
|
||||
}
|
||||
|
||||
/* Yield to pending GC operations, regardless of request depth */
|
||||
JS_PUBLIC_API(void)
|
||||
JS_YieldRequest(JSContext *cx)
|
||||
{
|
||||
JSRuntime *rt;
|
||||
|
||||
CHECK_REQUEST(cx);
|
||||
|
||||
PR_ASSERT(rt->requestCount > 0);
|
||||
rt->requestCount--;
|
||||
JS_NOTIFY_REQUEST_DONE(rt);
|
||||
JS_UNLOCK_GC(rt);
|
||||
JS_LOCK_GC(rt);
|
||||
rt->requestCount++;
|
||||
JS_UNLOCK_GC(rt);
|
||||
}
|
||||
|
||||
/* Like JS_EndRequest, but don't notify any GC waiting in the wings. */
|
||||
JS_PUBLIC_API(void)
|
||||
JS_SuspendRequest(JSContext *cx)
|
||||
|
@ -943,7 +961,10 @@ JS_InitClass(JSContext *cx, JSObject *obj, JSObject *parent_proto,
|
|||
|
||||
/* Bootstrap Function.prototype (see also JS_InitStandardClasses). */
|
||||
if (OBJ_GET_CLASS(cx, ctor) == clasp) {
|
||||
PR_ASSERT(!OBJ_GET_PROTO(cx, ctor));
|
||||
/* XXXMLM - this fails in framesets that are writing over
|
||||
* themselves!
|
||||
* PR_ASSERT(!OBJ_GET_PROTO(cx, ctor));
|
||||
*/
|
||||
OBJ_SET_PROTO(cx, ctor, proto);
|
||||
}
|
||||
}
|
||||
|
@ -1728,7 +1749,7 @@ JS_Enumerate(JSContext *cx, JSObject *obj)
|
|||
goto error;
|
||||
|
||||
/* No more jsid's to enumerate ? */
|
||||
if (!iter_state)
|
||||
if (iter_state == JSVAL_NULL)
|
||||
break;
|
||||
vector[i++] = id;
|
||||
}
|
||||
|
|
|
@ -245,6 +245,10 @@ JS_BeginRequest(JSContext *cx);
|
|||
extern JS_PUBLIC_API(void)
|
||||
JS_EndRequest(JSContext *cx);
|
||||
|
||||
/* Yield to pending GC operations, regardless of request depth */
|
||||
extern JS_PUBLIC_API(void)
|
||||
JS_YieldRequest(JSContext *cx);
|
||||
|
||||
extern JS_PUBLIC_API(void)
|
||||
JS_SuspendRequest(JSContext *cx);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче