mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 332648 - Part c: Move AutoObjectRooter to jsapi.h; r=evilpie
This commit is contained in:
parent
d7850e8af7
commit
25c1f65ab1
@ -180,7 +180,7 @@ CreateImageData(JSContext* cx,
|
||||
// Create the fast typed array; it's initialized to 0 by default.
|
||||
JSObject* darray =
|
||||
js_CreateTypedArray(cx, js::TypedArray::TYPE_UINT8_CLAMPED, len.value());
|
||||
js::AutoObjectRooter rd(cx, darray);
|
||||
JS::AutoObjectRooter rd(cx, darray);
|
||||
if (!darray) {
|
||||
return false;
|
||||
}
|
||||
@ -201,7 +201,7 @@ CreateImageData(JSContext* cx,
|
||||
// Do JS_NewObject after CreateTypedArray, so that gc will get
|
||||
// triggered here if necessary
|
||||
JSObject* result = JS_NewObject(cx, NULL, NULL, NULL);
|
||||
js::AutoObjectRooter rr(cx, result);
|
||||
JS::AutoObjectRooter rr(cx, result);
|
||||
if (!result) {
|
||||
return false;
|
||||
}
|
||||
|
@ -1903,7 +1903,7 @@ nsJSContext::CallEventHandler(nsISupports* aTarget, JSObject* aScope,
|
||||
nsresult rv = JSObjectFromInterface(aTarget, aScope, &target);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
js::AutoObjectRooter targetVal(mContext, target);
|
||||
JS::AutoObjectRooter targetVal(mContext, target);
|
||||
jsval rval = JSVAL_VOID;
|
||||
|
||||
// This one's a lot easier than EvaluateString because we don't have to
|
||||
|
@ -918,6 +918,35 @@ class AutoValueRooter : private AutoGCRooter
|
||||
JS_DECL_USE_GUARD_OBJECT_NOTIFIER
|
||||
};
|
||||
|
||||
class AutoObjectRooter : private AutoGCRooter {
|
||||
public:
|
||||
AutoObjectRooter(JSContext *cx, JSObject *obj = NULL
|
||||
JS_GUARD_OBJECT_NOTIFIER_PARAM)
|
||||
: AutoGCRooter(cx, OBJECT), obj(obj)
|
||||
{
|
||||
JS_GUARD_OBJECT_NOTIFIER_INIT;
|
||||
}
|
||||
|
||||
void setObject(JSObject *obj) {
|
||||
this->obj = obj;
|
||||
}
|
||||
|
||||
JSObject * object() const {
|
||||
return obj;
|
||||
}
|
||||
|
||||
JSObject ** addr() {
|
||||
return &obj;
|
||||
}
|
||||
|
||||
friend void AutoGCRooter::trace(JSTracer *trc);
|
||||
friend void MarkRuntime(JSTracer *trc);
|
||||
|
||||
private:
|
||||
JSObject *obj;
|
||||
JS_DECL_USE_GUARD_OBJECT_NOTIFIER
|
||||
};
|
||||
|
||||
} /* namespace JS */
|
||||
|
||||
/************************************************************************/
|
||||
|
@ -1598,35 +1598,6 @@ typedef RootedVar<jsid> RootedVarId;
|
||||
typedef RootedVar<Value> RootedVarValue;
|
||||
|
||||
/* FIXME(bug 332648): Move this into a public header. */
|
||||
class AutoObjectRooter : private AutoGCRooter {
|
||||
public:
|
||||
AutoObjectRooter(JSContext *cx, JSObject *obj = NULL
|
||||
JS_GUARD_OBJECT_NOTIFIER_PARAM)
|
||||
: AutoGCRooter(cx, OBJECT), obj(obj)
|
||||
{
|
||||
JS_GUARD_OBJECT_NOTIFIER_INIT;
|
||||
}
|
||||
|
||||
void setObject(JSObject *obj) {
|
||||
this->obj = obj;
|
||||
}
|
||||
|
||||
JSObject * object() const {
|
||||
return obj;
|
||||
}
|
||||
|
||||
JSObject ** addr() {
|
||||
return &obj;
|
||||
}
|
||||
|
||||
friend void AutoGCRooter::trace(JSTracer *trc);
|
||||
friend void MarkRuntime(JSTracer *trc);
|
||||
|
||||
private:
|
||||
JSObject *obj;
|
||||
JS_DECL_USE_GUARD_OBJECT_NOTIFIER
|
||||
};
|
||||
|
||||
class AutoStringRooter : private AutoGCRooter {
|
||||
public:
|
||||
AutoStringRooter(JSContext *cx, JSString *str = NULL
|
||||
|
@ -2005,7 +2005,7 @@ AutoGCRooter::trace(JSTracer *trc)
|
||||
|
||||
case OBJECT:
|
||||
if (JSObject *obj = static_cast<AutoObjectRooter *>(this)->obj)
|
||||
MarkRoot(trc, obj, "js::AutoObjectRooter.obj");
|
||||
MarkRoot(trc, obj, "JS::AutoObjectRooter.obj");
|
||||
return;
|
||||
|
||||
case ID:
|
||||
|
@ -61,7 +61,7 @@
|
||||
#include "jsgc.h"
|
||||
#include "jsfriendapi.h"
|
||||
|
||||
#include "jscntxt.h" // AutoObjectRooter, AutoIdArray
|
||||
#include "jscntxt.h" // AutoIdArray
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace js;
|
||||
@ -3011,7 +3011,7 @@ xpc_CreateSandboxObject(JSContext * cx, jsval * vp, nsISupports *prinOrSop, JSOb
|
||||
wantXrays, &sandbox, &compartment);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
js::AutoObjectRooter tvr(cx, sandbox);
|
||||
JS::AutoObjectRooter tvr(cx, sandbox);
|
||||
|
||||
{
|
||||
JSAutoEnterCompartment ac;
|
||||
|
@ -191,7 +191,7 @@ GeneratePropertyOp(JSContext *cx, JSObject *obj, jsid id, uintN argc, Op pop)
|
||||
|
||||
JSObject *funobj = JS_GetFunctionObject(fun);
|
||||
|
||||
js::AutoObjectRooter tvr(cx, funobj);
|
||||
JS::AutoObjectRooter tvr(cx, funobj);
|
||||
|
||||
// Unfortunately, we cannot guarantee that Op is aligned. Use a
|
||||
// second object to work around this.
|
||||
|
@ -1249,7 +1249,6 @@ def writeDefiner(f, conf, interfaces):
|
||||
stubTopTemplate = '''\
|
||||
/* THIS FILE IS AUTOGENERATED - DO NOT EDIT */
|
||||
#include "jsapi.h"
|
||||
#include "jscntxt.h"
|
||||
#include "qsWinUndefs.h"
|
||||
#include "prtypes.h"
|
||||
#include "nsID.h"
|
||||
|
Loading…
Reference in New Issue
Block a user