Bug 677079 - Part x: Move AutoValueVector to jsapi.h; r=evilpie

This commit is contained in:
Ms2ger 2012-01-15 09:13:11 +01:00
Родитель 1944061fe4
Коммит 1633522a7d
4 изменённых файлов: 22 добавлений и 34 удалений

Просмотреть файл

@ -1106,6 +1106,19 @@ class AutoVectorRooter : protected AutoGCRooter
JS_DECL_USE_GUARD_OBJECT_NOTIFIER
};
class AutoValueVector : public AutoVectorRooter<Value>
{
public:
explicit AutoValueVector(JSContext *cx
JS_GUARD_OBJECT_NOTIFIER_PARAM)
: AutoVectorRooter<Value>(cx, VALVECTOR)
{
JS_GUARD_OBJECT_NOTIFIER_INIT;
}
JS_DECL_USE_GUARD_OBJECT_NOTIFIER
};
} /* namespace JS */
/************************************************************************/

Просмотреть файл

@ -2073,25 +2073,6 @@ SetValueRangeToNull(Value *vec, size_t len)
SetValueRangeToNull(vec, vec + len);
}
class AutoValueVector : public AutoVectorRooter<Value>
{
public:
explicit AutoValueVector(JSContext *cx
JS_GUARD_OBJECT_NOTIFIER_PARAM)
: AutoVectorRooter<Value>(cx, VALVECTOR)
{
JS_GUARD_OBJECT_NOTIFIER_INIT;
}
const jsval *jsval_begin() const { return begin(); }
jsval *jsval_begin() { return begin(); }
const jsval *jsval_end() const { return end(); }
jsval *jsval_end() { return end(); }
JS_DECL_USE_GUARD_OBJECT_NOTIFIER
};
class AutoObjectVector : public AutoVectorRooter<JSObject *>
{
public:

Просмотреть файл

@ -1310,7 +1310,6 @@ struct WrapperHasher
typedef HashMap<Value, Value, WrapperHasher, SystemAllocPolicy> WrapperMap;
class AutoValueVector;
class AutoIdVector;
} /* namespace js */

Просмотреть файл

@ -49,7 +49,7 @@
#include "AccessCheck.h"
#include "nsJSUtils.h"
#include "jscntxt.h" // js::AutoValueVector
#include "jsapi.h"
NS_IMPL_THREADSAFE_ISUPPORTS1(nsXPCWrappedJSClass, nsIXPCWrappedJSClass)
@ -1173,20 +1173,14 @@ nsXPCWrappedJSClass::CallMethod(nsXPCWrappedJS* wrapper, uint16_t methodIndex,
jsval* sp = nsnull;
jsval* argv = nsnull;
uint8_t i;
uint8_t argc=0;
uint8_t paramCount=0;
nsresult retval = NS_ERROR_FAILURE;
nsresult pending_result = NS_OK;
JSBool success;
JSBool readyToDoTheCall = false;
nsID param_iid;
JSObject* obj;
const char* name = info->name;
jsval fval;
JSBool foundDependentParam;
XPCContext* xpcc;
JSContext* cx;
JSObject* thisObj;
// Make sure not to set the callee on ccx until after we've gone through
// the whole nsIXPCFunctionThisTranslator bit. That code uses ccx to
@ -1197,13 +1191,14 @@ nsXPCWrappedJSClass::CallMethod(nsXPCWrappedJS* wrapper, uint16_t methodIndex,
if (!ccx.IsValid())
return retval;
xpcc = ccx.GetXPCContext();
cx = ccx.GetJSContext();
XPCContext *xpcc = ccx.GetXPCContext();
JSContext *cx = ccx.GetJSContext();
if (!cx || !xpcc || !IsReflectable(methodIndex))
return NS_ERROR_FAILURE;
obj = thisObj = wrapper->GetJSObject();
JSObject *obj = wrapper->GetJSObject();
JSObject *thisObj = obj;
JSAutoEnterCompartment ac;
if (!ac.enter(cx, obj))
@ -1211,13 +1206,13 @@ nsXPCWrappedJSClass::CallMethod(nsXPCWrappedJS* wrapper, uint16_t methodIndex,
ccx.SetScopeForNewJSObjects(obj);
js::AutoValueVector args(cx);
JS::AutoValueVector args(cx);
AutoScriptEvaluate scriptEval(cx);
ContextPrincipalGuard principalGuard(ccx);
// XXX ASSUMES that retval is last arg. The xpidl compiler ensures this.
paramCount = info->num_args;
argc = paramCount -
uint8_t paramCount = info->num_args;
uint8_t argc = paramCount -
(paramCount && XPT_PD_IS_RETVAL(info->params[paramCount-1].flags) ? 1 : 0);
if (!scriptEval.StartEvaluating(obj, xpcWrappedJSErrorReporter))
@ -1353,7 +1348,7 @@ nsXPCWrappedJSClass::CallMethod(nsXPCWrappedJS* wrapper, uint16_t methodIndex,
goto pre_call_clean_up;
}
argv = args.jsval_begin();
argv = args.begin();
sp = argv;
// build the args